fix: Start as Admin Error: Unable to open app when running elevated (#2411)

* fixed run-elevated error and powerpreview settings not working

* removed EXTENDED_STARTUPINFO_PRESENT flag

* removed test string

* Update Microsoft.PowerToys.Settings.UnitTest.csproj

* Rename PowerLauncher.cs to PowerLauncherViewModelTest.cs
This commit is contained in:
Lavius Motileng
2020-05-03 03:17:06 -07:00
committed by GitHub
parent 8e18104f38
commit b428fc97e9
17 changed files with 208 additions and 37 deletions

View File

@@ -56,6 +56,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
_startup = GeneralSettingsConfigs.Startup;
_autoDownloadUpdates = GeneralSettingsConfigs.AutoDownloadUpdates;
}
private bool _packaged = false;
@@ -65,6 +66,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private bool _isDarkThemeRadioButtonChecked = false;
private bool _isLightThemeRadioButtonChecked = false;
private bool _isSystemThemeRadioButtonChecked = false;
private bool _autoDownloadUpdates = false;
// Gets or sets a value indicating whether packaged.
public bool Packaged
@@ -97,6 +99,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
if (_startup != value)
{
_startup = value;
GeneralSettingsConfigs.Startup = value;
RaisePropertyChanged();
}
}
@@ -138,6 +141,24 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public bool AutoDownloadUpdates
{
get
{
return _autoDownloadUpdates;
}
set
{
if (_autoDownloadUpdates != value)
{
_autoDownloadUpdates = value;
GeneralSettingsConfigs.AutoDownloadUpdates = value;
RaisePropertyChanged();
}
}
}
public bool IsDarkThemeRadioButtonChecked
{
get
@@ -211,15 +232,17 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
await Launcher.LaunchUriAsync(new Uri("https://github.com/microsoft/PowerToys/releases"));
}
private void Restart_Elevated()
public void Restart_Elevated()
{
GeneralSettings settings = SettingsUtils.GetSettings<GeneralSettings>(string.Empty);
settings.RunElevated = true;
settings.CustomActionName = "restart_elevation";
OutGoingGeneralSettings outsettings = new OutGoingGeneralSettings(settings);
GeneralSettingsCustomAction customaction = new GeneralSettingsCustomAction(outsettings);
if (ShellPage.DefaultSndMSGCallback != null)
{
ShellPage.DefaultSndMSGCallback(outsettings.ToString());
ShellPage.DefaultSndMSGCallback(customaction.ToString());
}
}
}

View File

@@ -27,14 +27,14 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
SettingsUtils.SaveSettings(Settings.ToJsonString(), ModuleName);
}
this._svgRenderIsEnabled = Settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.Value;
this._mdRenderIsEnabled = Settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.Value;
this._svgRenderIsEnabled = Settings.properties.EnableSvg.Value;
this._mdRenderIsEnabled = Settings.properties.EnableMd.Value;
}
private bool _svgRenderIsEnabled = false;
private bool _mdRenderIsEnabled = false;
public bool SVGRenderIsEnebled
public bool SVGRenderIsEnabled
{
get
{
@@ -46,13 +46,13 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
if (value != _svgRenderIsEnabled)
{
_svgRenderIsEnabled = value;
Settings.properties.IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL.Value = value;
Settings.properties.EnableSvg.Value = value;
RaisePropertyChanged();
}
}
}
public bool MDRenderIsEnebled
public bool MDRenderIsEnabled
{
get
{
@@ -64,7 +64,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
if (value != _mdRenderIsEnabled)
{
_mdRenderIsEnabled = value;
Settings.properties.PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID.Value = value;
Settings.properties.EnableMd.Value = value;
RaisePropertyChanged();
}
}