最近我开始实现一个解决方案,它将使用PhPbb数据库进行表单授权,我使用了以下类中的类:
所以我在'ValidateUser'函数中使用这个类编写了一个成员资格提供者:
public override bool ValidateUser(string username, string password)
{
ForumsDataContext db = Root.ForumsDataContext;
PhPbbCryptoServiceProvider phpbbCrypt = new PhPbbCryptoServiceProvider();
string remoteHash = db.Users.Where(u => u.UserName == username).FirstOrDefault().UserPassword;
if (String.IsNullOrEmpty(remoteHash))
return false;
return phpbbCrypt.phpbbCheckHash(password, remoteHash);
}
Run Code Online (Sandbox Code Playgroud)
然而,这总是返回false,因为'phpbbCrypt.phpbbCheckHash'返回false并且我不太了解PhPbb以确定散列不匹配的原因.
任何sugestions?
最近我正在研究一个网站,我想创建一个水平分隔符,可以使用jquery调整页面上的两个元素.
基本上:
内容
___ 分频器_ __ _ _
内容
当:拖动分隔符时,它应该将其中任何一侧的"内容"元素调整为用户所需的大小.
这是我到目前为止所拥有的.
<div id="WorkRequests"></div>
<div id="Divider" style="height:10px; padding:5px; cursor:n-resize;"><hr /></div>
<div id="WorkRequest_Ajax"></div>
Run Code Online (Sandbox Code Playgroud)
和剧本:
var totalHeight = $("#Divider").parent().height();
function ResizePage(divPosition) {
var validDrag = true;
// Math
var minPercent = totalHeight * 0.25;
var minBuffer = totalHeight * 0.05;
var topHeight = divPosition.top - $("#content").position().top;
var bottomHeight = (totalHeight - divPosition.top);
// Check Drag
if (topHeight < minPercent) {
validDrag = false;
$("#WorkRequests").height(minPercent + minBuffer);
}
if (bottomHeight < minPercent) { …Run Code Online (Sandbox Code Playgroud) 我重新开始重新安装Visual Studio 2010,因为这样做我无法弄清楚如何让它再次识别.cshtml文件...我尝试安装MVC 3但它说已经安装了,基本上当我打开.cshtml文件时Visual Studio他们没有代码高照明或智能感.
任何sugestions?
谢谢,亚历克斯.
我只是想知道为什么Range验证属性可以将Type和两个字符串作为参数?这是用于验证字符串对Enum或类似的东西?
我正在尝试做的是找到一种简单的方法来验证一个3字符串,它必须存在于枚举,任何sugestions?
谢谢,亚历克斯.
将我的一个网站升级到MVC 4并升级NuGet中的所有软件包后,我似乎丢失了NuGet的MvcMailer软件包的Send()扩展方法.除了升级项目所需的代码之外,我没有进行任何代码更改,我有:
using Mvc.Mailer;
Run Code Online (Sandbox Code Playgroud)
在我的代码文件的顶部.
有人可以告诉我这里可能会发生什么吗?
我只是尝试将两个控件绑定为命令参数,并将它们作为一个传递给我的命令object[].
XAML:
<UserControl.Resources>
<C:MultiValueConverter x:Key="MultiParamConverter"></C:MultiValueConverter>
</UserControl.Resources>
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal">
<Button Name="Expander" Content="+" Width="25" Margin="4,0,4,0" Command="{Binding ExpanderCommand}">
<Button.CommandParameter>
<MultiBinding Converter="{StaticResource MultiParamConverter}">
<Binding ElementName="Content"/>
<Binding ElementName="Expander"/>
</MultiBinding>
</Button.CommandParameter>
</Button>
<Label FontWeight="Bold">GENERAL INFORMATION</Label>
</StackPanel>
<StackPanel Name="Content" Orientation="Vertical" Visibility="Collapsed">
<Label>Test</Label>
</StackPanel>
</StackPanel>
Run Code Online (Sandbox Code Playgroud)
命令:
public ICommand ExpanderCommand
{
get
{
return new RelayCommand(delegate(object param)
{
var args = (object[])param;
var content = (UIElement)args[0];
var button = (Button)args[1];
content.Visibility = (content.Visibility == Visibility.Visible) ? Visibility.Collapsed : Visibility.Visible;
button.Content = (content.Visibility == Visibility.Visible) ? …Run Code Online (Sandbox Code Playgroud) 我正在尝试为StackPanel设置动画,当它的可见性从0宽度增加到自动宽度时,这就是我现在所拥有的:
<Trigger Property="Visibility" Value="Visible">
<Setter Property="Width" Value="0"></Setter>
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Width" Duration="0:0:1">
<DiscreteObjectKeyFrame KeyTime="0">
<DiscreteObjectKeyFrame.Value>
<System:Double>NaN</System:Double>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
</Trigger>
Run Code Online (Sandbox Code Playgroud)
有人可以解释我如何实现这个动画吗?这可能不是我试图做的方式吗?
谢谢,亚历克斯.
我只是想知道如何才能找到以前访问过的会话URL?
因此,在用户执行某些操作后,我可以将其重定向到该URL.
有没有标准的方法来做到这一点?否则,我将向Global.asax添加一些覆盖,并使用会话变量来存储URL历史记录.
例如,当我有一个只包含一些属性和一些验证代码的基本模型然后我围绕这个基础模型构建一个视图模型时,我应该如何使用WPF MVVM让我困惑一段时间,视图模型应该如何结构化.
例如:
基础模型 - >
Imports ModellingHelper
Imports FTNHelper
Imports System.ComponentModel
Imports System.ComponentModel.DataAnnotations
Public Class Parser
Inherits BaseModel
<Required(ErrorMessage:="Name is required.")>
Public Property Name As String
Get
Return GetValue(Function() Name)
End Get
Set(value As String)
SetValue(Function() Name, value)
End Set
End Property
<Required(ErrorMessage:="Description is required.")>
Public Property Description As String
Get
Return GetValue(Function() Description)
End Get
Set(value As String)
SetValue(Function() Description, value)
End Set
End Property
Public Property InputHeaderInfo As InputHeader
Get
Return GetValue(Function() InputHeaderInfo)
End Get
Set(value As …Run Code Online (Sandbox Code Playgroud) 我试图将项目水平放置在ItemControl中,同时使它们填充父控件.
这是我的XAMl:
<ItemsControl ItemsSource="{Binding AnnualWeatherViewModels}" Visibility="{Binding IsAnnualWeatherViewModels, Converter={StaticResource VisibilityConverter}}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"></StackPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<V:AerosolSimpleWeatherCharacteristicsView DataContext="{Binding}"></V:AerosolSimpleWeatherCharacteristicsView>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
Run Code Online (Sandbox Code Playgroud)
我尝试过的两种变体ItemsControl.ItemsPanel是:
<StackPanel Orientation="Horizontal"></StackPanel>
Run Code Online (Sandbox Code Playgroud)
和:
<DockPanel LastChildFill="False"></DockPanel>
Run Code Online (Sandbox Code Playgroud)
然而,两者都没有达到预期的结果,StackPanel压缩所有项目,并且DockPanel将填充父控件的空间,其中大部分空间专用于最后一项,或者不填充父空间,具体取决于值LastChildFill.
那么如何布置ItemsControl水平项目并让它们填充父控件的空间?
我最终创建了这个自定义控件作为答案中的sugested:
public partial class StretchingPanel : Grid
{
public static readonly DependencyProperty OrientationProperty =
DependencyProperty.Register("Orientation", typeof(Orientation), typeof(StretchingPanel), new UIPropertyMetadata(System.Windows.Controls.Orientation.Horizontal));
public static readonly DependencyProperty FillFirstItemProperty =
DependencyProperty.Register("FillFirstItem", typeof(bool), typeof(StretchingPanel), new UIPropertyMetadata(true));
public static readonly DependencyProperty FillFirstItemFactorProperty =
DependencyProperty.Register("FillFirstItemFactor", typeof(double), typeof(StretchingPanel), new …Run Code Online (Sandbox Code Playgroud) c# ×6
wpf ×4
.net ×3
.net-4.0 ×3
xaml ×2
asp.net-mvc ×1
binding ×1
javascript ×1
jquery ×1
jquery-ui ×1
multibinding ×1
mvcmailer ×1
mvvm ×1
phpbb ×1
phpbb3 ×1
vb.net ×1
wpf-4.0 ×1
wpf-controls ×1