我为.NET WPF应用程序开发了一个带有WiX的自定义安装程序.如果我右键单击并以管理员身份运行,它可以正常工作,但是当没有运行时,由于权限不足,某些组件无法安装.
这些组件包括SQL Server Express 2008 R2,FoxIt Reader,ActiveX组件和其他一些组件.它还要求在新安装的数据库上运行一些SQL脚本 - 无论如何,它们都需要管理员权限.
我尝试将InstallScope ="perMachine"和InstallPrivileges ="elevated"属性添加到Package节点,但这似乎没有什么区别.
我确定这是愚蠢的,但我在参考或在线找不到任何东西.
我目前正在开发一个MVC5 Web应用程序,使用ASP.NET Identity 2进行帐户控制,我遇到的具体问题是在电子邮件确认后自动登录用户.
所以流程如下:
控制器上的确认电子邮件操作如下所示:
[AllowAnonymous]
public async Task<ActionResult> ConfirmEmail(string userId, string code)
{
// If userId or code is empty, show an error or redirect
if (userId == null || code == null)
{
return View("Error");
}
// Attempt to confirm the email address
var confirmEmailResult = await UserManager.ConfirmEmailAsync(userId, code);
// Retrieve the user (ApplicationUser)
var user = await UserManager.Users.FirstOrDefaultAsync(u => u.Id == userId);
if (user == null)
{
// If …Run Code Online (Sandbox Code Playgroud) 我正在使用C#开发SL5应用程序,我希望将其国际化.我发现以下内容来设置UI文化:
var culture = new CultureInfo(Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName);
Thread.CurrentThread.CurrentUICulture = culture;
Thread.CurrentThread.CurrentCulture = culture;
Run Code Online (Sandbox Code Playgroud)
像DatePicker这样的一些控件似乎可以解决这个问题.如果我使用'd'格式字符串格式化任何日期时间,我仍然会得到默认格式"M/dd/yyyy".
究竟SL如何解释文化以及如何为整个应用程序正确设置?
谢谢
更新:
找到答案:
首先,在Application_Startup中设置适当的文化:
var culture = new CultureInfo("nl-BE");
Thread.CurrentThread.CurrentUICulture = culture;
Thread.CurrentThread.CurrentCulture = culture;
Run Code Online (Sandbox Code Playgroud)
然而,关键因素是添加以下内容以强制RootVisual的文化/语言:
var root = RootVisual as Page;
if (root != null)
{
root.Language = XmlLanguage.GetLanguage(Thread.CurrentThread.CurrentCulture.Name);
}
Run Code Online (Sandbox Code Playgroud) 我正在基类中实现INotifyPropertyChanged,如下所示:
public class NotifyPropertyChangedBase : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void RaisePropertyChanged(string propertyName)
{
var propChangedHandler = PropertyChanged;
if (propChangedHandler != null)
{
var args = new PropertyChangedEventArgs(propertyName);
propChangedHandler(this, args);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我使用它如下:
RaisePropertyChanged("Name");
Run Code Online (Sandbox Code Playgroud)
我得到一个NullReferenceException,而参数,"this"和处理程序是非null.任何人都可以对此有所了解吗?
谢谢.
- >例外的完整堆栈跟踪:http://pastebin.com/bH9FeurJ
更新当我覆盖包含此属性的类的实例时发生异常.简化示例:
public class Person : INotifyPropertyChanged
{
private string _name;
public string Name
{
get { return _name; }
set
{
_name = value;
RaisePropertyChanged("Name");
}
}
// More properties etc.
}
Run Code Online (Sandbox Code Playgroud)
-snip-
public …Run Code Online (Sandbox Code Playgroud) .net ×3
c# ×3
asp.net ×1
asp.net-mvc ×1
cultureinfo ×1
email ×1
installer ×1
localization ×1
mvvm ×1
silverlight ×1
wix ×1
wpf ×1