mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-06-02 18:44:56 +12:00
[BUG] Microsoft Store Autostart not working (#131), version 1.0.23.0
This commit is contained in:
parent
8a6101d329
commit
f5234bcec3
|
@ -10,7 +10,7 @@
|
||||||
<Identity
|
<Identity
|
||||||
Name="49543SystemTrayMenu.SystemTrayMenu"
|
Name="49543SystemTrayMenu.SystemTrayMenu"
|
||||||
Publisher="CN=5884501C-92ED-45DE-9508-9D987C314243"
|
Publisher="CN=5884501C-92ED-45DE-9508-9D987C314243"
|
||||||
Version="1.0.22.0" />
|
Version="1.0.23.0" />
|
||||||
|
|
||||||
<Properties>
|
<Properties>
|
||||||
<DisplayName>SystemTrayMenu</DisplayName>
|
<DisplayName>SystemTrayMenu</DisplayName>
|
||||||
|
|
|
@ -39,5 +39,5 @@ using System.Runtime.InteropServices;
|
||||||
// You can specify all the values or you can default the Build and Revision Numbers
|
// You can specify all the values or you can default the Build and Revision Numbers
|
||||||
// by using the '*' as shown below:
|
// by using the '*' as shown below:
|
||||||
// [assembly: AssemblyVersion("1.0.*")]
|
// [assembly: AssemblyVersion("1.0.*")]
|
||||||
[assembly: AssemblyVersion("1.0.22.2")]
|
[assembly: AssemblyVersion("1.0.23.0")]
|
||||||
[assembly: AssemblyFileVersion("1.0.22.2")]
|
[assembly: AssemblyFileVersion("1.0.23.0")]
|
||||||
|
|
|
@ -286,7 +286,7 @@
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.22000.194" />
|
<PackageReference Include="Microsoft.Windows.SDK.Contracts" Version="10.0.22000.196" />
|
||||||
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
@ -297,6 +297,9 @@
|
||||||
<Folder Include="Packaging\AppPackages\" />
|
<Folder Include="Packaging\AppPackages\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<None Update="Package.appxmanifest">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</None>
|
||||||
<None Update="Properties\Settings.settings">
|
<None Update="Properties\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
|
|
34
UserInterface/SettingsForm.Designer.cs
generated
34
UserInterface/SettingsForm.Designer.cs
generated
|
@ -264,6 +264,7 @@ namespace SystemTrayMenu.UserInterface
|
||||||
this.buttonOk = new System.Windows.Forms.Button();
|
this.buttonOk = new System.Windows.Forms.Button();
|
||||||
this.buttonCancel = new System.Windows.Forms.Button();
|
this.buttonCancel = new System.Windows.Forms.Button();
|
||||||
this.colorDialog = new System.Windows.Forms.ColorDialog();
|
this.colorDialog = new System.Windows.Forms.ColorDialog();
|
||||||
|
this.buttonAddTaskManagerStartupTask = new System.Windows.Forms.Button();
|
||||||
this.tableLayoutPanelMain.SuspendLayout();
|
this.tableLayoutPanelMain.SuspendLayout();
|
||||||
this.tabControl.SuspendLayout();
|
this.tabControl.SuspendLayout();
|
||||||
this.tabPageGeneral.SuspendLayout();
|
this.tabPageGeneral.SuspendLayout();
|
||||||
|
@ -666,7 +667,7 @@ namespace SystemTrayMenu.UserInterface
|
||||||
this.groupBoxAutostart.MinimumSize = new System.Drawing.Size(400, 0);
|
this.groupBoxAutostart.MinimumSize = new System.Drawing.Size(400, 0);
|
||||||
this.groupBoxAutostart.Name = "groupBoxAutostart";
|
this.groupBoxAutostart.Name = "groupBoxAutostart";
|
||||||
this.groupBoxAutostart.Padding = new System.Windows.Forms.Padding(3, 6, 3, 6);
|
this.groupBoxAutostart.Padding = new System.Windows.Forms.Padding(3, 6, 3, 6);
|
||||||
this.groupBoxAutostart.Size = new System.Drawing.Size(400, 53);
|
this.groupBoxAutostart.Size = new System.Drawing.Size(400, 59);
|
||||||
this.groupBoxAutostart.TabIndex = 0;
|
this.groupBoxAutostart.TabIndex = 0;
|
||||||
this.groupBoxAutostart.TabStop = false;
|
this.groupBoxAutostart.TabStop = false;
|
||||||
this.groupBoxAutostart.Text = "groupBoxAutostart";
|
this.groupBoxAutostart.Text = "groupBoxAutostart";
|
||||||
|
@ -675,15 +676,18 @@ namespace SystemTrayMenu.UserInterface
|
||||||
//
|
//
|
||||||
this.tableLayoutPanelAutostart.AutoSize = true;
|
this.tableLayoutPanelAutostart.AutoSize = true;
|
||||||
this.tableLayoutPanelAutostart.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
this.tableLayoutPanelAutostart.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||||
this.tableLayoutPanelAutostart.ColumnCount = 1;
|
this.tableLayoutPanelAutostart.ColumnCount = 3;
|
||||||
this.tableLayoutPanelAutostart.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
this.tableLayoutPanelAutostart.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||||
|
this.tableLayoutPanelAutostart.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||||
|
this.tableLayoutPanelAutostart.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
|
this.tableLayoutPanelAutostart.Controls.Add(this.buttonAddTaskManagerStartupTask, 0, 0);
|
||||||
this.tableLayoutPanelAutostart.Controls.Add(this.checkBoxAutostart, 0, 0);
|
this.tableLayoutPanelAutostart.Controls.Add(this.checkBoxAutostart, 0, 0);
|
||||||
this.tableLayoutPanelAutostart.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.tableLayoutPanelAutostart.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.tableLayoutPanelAutostart.Location = new System.Drawing.Point(3, 22);
|
this.tableLayoutPanelAutostart.Location = new System.Drawing.Point(3, 22);
|
||||||
this.tableLayoutPanelAutostart.Name = "tableLayoutPanelAutostart";
|
this.tableLayoutPanelAutostart.Name = "tableLayoutPanelAutostart";
|
||||||
this.tableLayoutPanelAutostart.RowCount = 1;
|
this.tableLayoutPanelAutostart.RowCount = 1;
|
||||||
this.tableLayoutPanelAutostart.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
|
this.tableLayoutPanelAutostart.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||||
this.tableLayoutPanelAutostart.Size = new System.Drawing.Size(394, 25);
|
this.tableLayoutPanelAutostart.Size = new System.Drawing.Size(394, 31);
|
||||||
this.tableLayoutPanelAutostart.TabIndex = 0;
|
this.tableLayoutPanelAutostart.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// checkBoxAutostart
|
// checkBoxAutostart
|
||||||
|
@ -692,7 +696,7 @@ namespace SystemTrayMenu.UserInterface
|
||||||
this.checkBoxAutostart.Dock = System.Windows.Forms.DockStyle.Fill;
|
this.checkBoxAutostart.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||||
this.checkBoxAutostart.Location = new System.Drawing.Point(3, 3);
|
this.checkBoxAutostart.Location = new System.Drawing.Point(3, 3);
|
||||||
this.checkBoxAutostart.Name = "checkBoxAutostart";
|
this.checkBoxAutostart.Name = "checkBoxAutostart";
|
||||||
this.checkBoxAutostart.Size = new System.Drawing.Size(388, 19);
|
this.checkBoxAutostart.Size = new System.Drawing.Size(126, 25);
|
||||||
this.checkBoxAutostart.TabIndex = 0;
|
this.checkBoxAutostart.TabIndex = 0;
|
||||||
this.checkBoxAutostart.Text = "checkBoxAutostart";
|
this.checkBoxAutostart.Text = "checkBoxAutostart";
|
||||||
this.checkBoxAutostart.UseVisualStyleBackColor = true;
|
this.checkBoxAutostart.UseVisualStyleBackColor = true;
|
||||||
|
@ -702,7 +706,7 @@ namespace SystemTrayMenu.UserInterface
|
||||||
this.groupBoxHotkey.AutoSize = true;
|
this.groupBoxHotkey.AutoSize = true;
|
||||||
this.groupBoxHotkey.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
this.groupBoxHotkey.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||||
this.groupBoxHotkey.Controls.Add(this.tableLayoutPanelHotkey);
|
this.groupBoxHotkey.Controls.Add(this.tableLayoutPanelHotkey);
|
||||||
this.groupBoxHotkey.Location = new System.Drawing.Point(3, 289);
|
this.groupBoxHotkey.Location = new System.Drawing.Point(3, 295);
|
||||||
this.groupBoxHotkey.MaximumSize = new System.Drawing.Size(400, 0);
|
this.groupBoxHotkey.MaximumSize = new System.Drawing.Size(400, 0);
|
||||||
this.groupBoxHotkey.MinimumSize = new System.Drawing.Size(400, 0);
|
this.groupBoxHotkey.MinimumSize = new System.Drawing.Size(400, 0);
|
||||||
this.groupBoxHotkey.Name = "groupBoxHotkey";
|
this.groupBoxHotkey.Name = "groupBoxHotkey";
|
||||||
|
@ -755,7 +759,7 @@ namespace SystemTrayMenu.UserInterface
|
||||||
this.groupBoxLanguage.AutoSize = true;
|
this.groupBoxLanguage.AutoSize = true;
|
||||||
this.groupBoxLanguage.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
this.groupBoxLanguage.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||||
this.groupBoxLanguage.Controls.Add(this.tableLayoutPanelLanguage);
|
this.groupBoxLanguage.Controls.Add(this.tableLayoutPanelLanguage);
|
||||||
this.groupBoxLanguage.Location = new System.Drawing.Point(3, 354);
|
this.groupBoxLanguage.Location = new System.Drawing.Point(3, 360);
|
||||||
this.groupBoxLanguage.MaximumSize = new System.Drawing.Size(400, 0);
|
this.groupBoxLanguage.MaximumSize = new System.Drawing.Size(400, 0);
|
||||||
this.groupBoxLanguage.MinimumSize = new System.Drawing.Size(400, 0);
|
this.groupBoxLanguage.MinimumSize = new System.Drawing.Size(400, 0);
|
||||||
this.groupBoxLanguage.Name = "groupBoxLanguage";
|
this.groupBoxLanguage.Name = "groupBoxLanguage";
|
||||||
|
@ -3649,6 +3653,19 @@ namespace SystemTrayMenu.UserInterface
|
||||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||||
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
|
||||||
//
|
//
|
||||||
|
// buttonAddTaskManagerStartupTask
|
||||||
|
//
|
||||||
|
this.buttonAddTaskManagerStartupTask.AutoSize = true;
|
||||||
|
this.buttonAddTaskManagerStartupTask.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
|
||||||
|
this.buttonAddTaskManagerStartupTask.Location = new System.Drawing.Point(135, 3);
|
||||||
|
this.buttonAddTaskManagerStartupTask.MinimumSize = new System.Drawing.Size(75, 23);
|
||||||
|
this.buttonAddTaskManagerStartupTask.Name = "buttonAddTaskManagerStartupTask";
|
||||||
|
this.buttonAddTaskManagerStartupTask.Size = new System.Drawing.Size(204, 25);
|
||||||
|
this.buttonAddTaskManagerStartupTask.TabIndex = 1;
|
||||||
|
this.buttonAddTaskManagerStartupTask.Text = "buttonAddTaskManagerStartupTask";
|
||||||
|
this.buttonAddTaskManagerStartupTask.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonAddTaskManagerStartupTask.Click += new System.EventHandler(this.ButtonAddTaskManagerStartupTask_Click);
|
||||||
|
//
|
||||||
// SettingsForm
|
// SettingsForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
|
||||||
|
@ -4104,5 +4121,6 @@ namespace SystemTrayMenu.UserInterface
|
||||||
private System.Windows.Forms.TextBox textBoxColorIconsDarkMode;
|
private System.Windows.Forms.TextBox textBoxColorIconsDarkMode;
|
||||||
private System.Windows.Forms.CheckBox checkBoxPossibilityToSelectFolderByWindowsContextMenu;
|
private System.Windows.Forms.CheckBox checkBoxPossibilityToSelectFolderByWindowsContextMenu;
|
||||||
private System.Windows.Forms.Button buttonOpenFolder;
|
private System.Windows.Forms.Button buttonOpenFolder;
|
||||||
|
private System.Windows.Forms.Button buttonAddTaskManagerStartupTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -119,6 +119,7 @@ namespace SystemTrayMenu.UserInterface
|
||||||
buttonOpenAssemblyLocation.Text = Translator.GetText("Open the assembly location");
|
buttonOpenAssemblyLocation.Text = Translator.GetText("Open the assembly location");
|
||||||
groupBoxAutostart.Text = Translator.GetText("Autostart");
|
groupBoxAutostart.Text = Translator.GetText("Autostart");
|
||||||
checkBoxAutostart.Text = Translator.GetText("Launch on startup");
|
checkBoxAutostart.Text = Translator.GetText("Launch on startup");
|
||||||
|
buttonAddTaskManagerStartupTask.Text = Translator.GetText("Launch on startup");
|
||||||
groupBoxHotkey.Text = Translator.GetText("Hotkey");
|
groupBoxHotkey.Text = Translator.GetText("Hotkey");
|
||||||
buttonHotkeyDefault.Text = Translator.GetText("Default");
|
buttonHotkeyDefault.Text = Translator.GetText("Default");
|
||||||
groupBoxLanguage.Text = Translator.GetText("Language");
|
groupBoxLanguage.Text = Translator.GetText("Language");
|
||||||
|
@ -203,14 +204,19 @@ namespace SystemTrayMenu.UserInterface
|
||||||
InitializeAutostart();
|
InitializeAutostart();
|
||||||
void InitializeAutostart()
|
void InitializeAutostart()
|
||||||
{
|
{
|
||||||
checkBoxAutostart.Checked =
|
bool useStartupTask = false;
|
||||||
Settings.Default.IsAutostartActivated;
|
|
||||||
#if RELEASEPACKAGE
|
#if RELEASEPACKAGE
|
||||||
if (Settings.Default.IsAutostartActivated)
|
useStartupTask = true;
|
||||||
{
|
|
||||||
checkBoxAutostart.Enabled = false;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
if (useStartupTask)
|
||||||
|
{
|
||||||
|
checkBoxAutostart.Visible = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buttonAddTaskManagerStartupTask.Visible = false;
|
||||||
|
checkBoxAutostart.Checked = Settings.Default.IsAutostartActivated;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InitializeHotkey();
|
InitializeHotkey();
|
||||||
|
@ -568,84 +574,21 @@ namespace SystemTrayMenu.UserInterface
|
||||||
|
|
||||||
private void ButtonOk_Click(object sender, EventArgs e)
|
private void ButtonOk_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Settings.Default.UseIconFromRootFolder =
|
Settings.Default.UseIconFromRootFolder = checkBoxUseIconFromRootFolder.Checked;
|
||||||
checkBoxUseIconFromRootFolder.Checked;
|
#if !RELEASEPACKAGE
|
||||||
|
SaveAutostartRegistryEntry();
|
||||||
_ = SaveAutostartAsync().Wait(8000);
|
|
||||||
async Task SaveAutostartAsync()
|
|
||||||
{
|
|
||||||
bool useStartupTask = false;
|
|
||||||
#if RELEASEPACKAGE
|
|
||||||
useStartupTask = true;
|
|
||||||
#endif
|
#endif
|
||||||
if (checkBoxAutostart.Checked)
|
|
||||||
{
|
|
||||||
if (useStartupTask)
|
|
||||||
{
|
|
||||||
// Pass the task ID you specified in the appxmanifest file
|
|
||||||
StartupTask startupTask = await StartupTask.GetAsync("MyStartupId");
|
|
||||||
Log.Info($"Autostart {startupTask.State}.");
|
|
||||||
|
|
||||||
switch (startupTask.State)
|
|
||||||
{
|
|
||||||
case StartupTaskState.Enabled:
|
|
||||||
break;
|
|
||||||
case StartupTaskState.Disabled:
|
|
||||||
// Task is disabled but can be enabled.
|
|
||||||
StartupTaskState newState = await startupTask.RequestEnableAsync();
|
|
||||||
break;
|
|
||||||
case StartupTaskState.DisabledByUser:
|
|
||||||
Log.Info($"Please enable autostart via Task Manager.");
|
|
||||||
break;
|
|
||||||
case StartupTaskState.DisabledByPolicy:
|
|
||||||
Log.Info($"Autostart disabled by policy. Please add autostart manually, see issue #131");
|
|
||||||
break;
|
|
||||||
case StartupTaskState.EnabledByPolicy:
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RegistryKey key = Registry.CurrentUser.OpenSubKey(
|
|
||||||
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
|
|
||||||
key.SetValue(
|
|
||||||
Assembly.GetExecutingAssembly().GetName().Name,
|
|
||||||
System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
Settings.Default.IsAutostartActivated = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (useStartupTask)
|
|
||||||
{
|
|
||||||
// when added by StartupTask, then only possible to disable autostart via Task Manager.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
RegistryKey key = Registry.CurrentUser.OpenSubKey(
|
|
||||||
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
|
|
||||||
key.DeleteValue("SystemTrayMenu", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
Settings.Default.IsAutostartActivated = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SaveHotkey();
|
SaveHotkey();
|
||||||
void SaveHotkey()
|
void SaveHotkey()
|
||||||
{
|
{
|
||||||
Settings.Default.HotKey =
|
Settings.Default.HotKey = new KeysConverter().ConvertToInvariantString(
|
||||||
new KeysConverter().ConvertToInvariantString(
|
|
||||||
textBoxHotkey.Hotkey | textBoxHotkey.HotkeyModifiers);
|
textBoxHotkey.Hotkey | textBoxHotkey.HotkeyModifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
SaveLanguage();
|
SaveLanguage();
|
||||||
void SaveLanguage()
|
void SaveLanguage()
|
||||||
{
|
{
|
||||||
Settings.Default.CurrentCultureInfoName =
|
Settings.Default.CurrentCultureInfoName = comboBoxLanguage.SelectedValue.ToString();
|
||||||
comboBoxLanguage.SelectedValue.ToString();
|
|
||||||
Translator.Initialize();
|
Translator.Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -689,6 +632,58 @@ namespace SystemTrayMenu.UserInterface
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SaveAutostartRegistryEntry()
|
||||||
|
{
|
||||||
|
if (checkBoxAutostart.Checked)
|
||||||
|
{
|
||||||
|
RegistryKey key = Registry.CurrentUser.OpenSubKey(
|
||||||
|
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
|
||||||
|
key.SetValue(
|
||||||
|
Assembly.GetExecutingAssembly().GetName().Name,
|
||||||
|
System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
|
||||||
|
|
||||||
|
Settings.Default.IsAutostartActivated = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RegistryKey key = Registry.CurrentUser.OpenSubKey(
|
||||||
|
@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
|
||||||
|
key.DeleteValue("SystemTrayMenu", false);
|
||||||
|
|
||||||
|
Settings.Default.IsAutostartActivated = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ButtonAddTaskManagerStartupTask_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_ = AddStartUpAsync();
|
||||||
|
static async Task AddStartUpAsync()
|
||||||
|
{
|
||||||
|
// Pass the task ID you specified in the appxmanifest file
|
||||||
|
StartupTask startupTask = await StartupTask.GetAsync("MyStartupId");
|
||||||
|
Log.Info($"Autostart {startupTask.State}.");
|
||||||
|
|
||||||
|
switch (startupTask.State)
|
||||||
|
{
|
||||||
|
case StartupTaskState.Enabled:
|
||||||
|
break;
|
||||||
|
case StartupTaskState.Disabled:
|
||||||
|
// Task is disabled but can be enabled.
|
||||||
|
StartupTaskState newState = await startupTask.RequestEnableAsync();
|
||||||
|
break;
|
||||||
|
case StartupTaskState.DisabledByUser:
|
||||||
|
Log.Info($"Please enable autostart via Task Manager.");
|
||||||
|
break;
|
||||||
|
case StartupTaskState.DisabledByPolicy:
|
||||||
|
Log.Info($"Autostart disabled by policy. Please add autostart manually, see issue #131");
|
||||||
|
break;
|
||||||
|
case StartupTaskState.EnabledByPolicy:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void ButtonHotkeyDefault_Click(object sender, EventArgs e)
|
private void ButtonHotkeyDefault_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
textBoxHotkey.SetHotkey("Ctrl+LWin");
|
textBoxHotkey.SetHotkey("Ctrl+LWin");
|
||||||
|
|
Loading…
Reference in a new issue