From 7c234efad68592369f17a1baa2168647d8656bdd Mon Sep 17 00:00:00 2001 From: Markus Hofknecht Date: Sat, 23 Oct 2021 13:45:22 +0200 Subject: [PATCH] [BUG] Microsoft Store Autostart not working (#131), version 1.0.23.0 --- Resources/lang.Designer.cs | 36 ++++++++++++---- Resources/lang.cs-CZ.resx | 12 ++++-- Resources/lang.de-DE.resx | 12 ++++-- Resources/lang.es-ES.resx | 12 ++++-- Resources/lang.fr-FR.resx | 12 ++++-- Resources/lang.it-IT.resx | 12 ++++-- Resources/lang.ja-JP.resx | 12 ++++-- Resources/lang.ko-KR.resx | 12 ++++-- Resources/lang.nl-NL.resx | 12 ++++-- Resources/lang.pt-BR.resx | 12 ++++-- Resources/lang.resx | 12 ++++-- Resources/lang.ru-RU.resx | 12 ++++-- Resources/lang.tr-TR.resx | 12 ++++-- Resources/lang.vi-VN.resx | 12 ++++-- Resources/lang.zh-CN.resx | 12 ++++-- UserInterface/SettingsForm.Designer.cs | 41 ++++++++++++------ UserInterface/SettingsForm.cs | 59 ++++++++++++++++++++------ 17 files changed, 227 insertions(+), 77 deletions(-) diff --git a/Resources/lang.Designer.cs b/Resources/lang.Designer.cs index a52ba13..4b3c94c 100644 --- a/Resources/lang.Designer.cs +++ b/Resources/lang.Designer.cs @@ -69,6 +69,15 @@ namespace SystemTrayMenu.Resources { } } + /// + /// Looks up a localized string similar to Activated. + /// + internal static string Activated { + get { + return ResourceManager.GetString("Activated", resourceCulture); + } + } + /// /// Looks up a localized string similar to Advanced. /// @@ -285,6 +294,15 @@ namespace SystemTrayMenu.Resources { } } + /// + /// Looks up a localized string similar to Deactivated. + /// + internal static string Deactivated { + get { + return ResourceManager.GetString("Deactivated", resourceCulture); + } + } + /// /// Looks up a localized string similar to Default. /// @@ -303,15 +321,6 @@ namespace SystemTrayMenu.Resources { } } - /// - /// Looks up a localized string similar to Expert. - /// - internal static string Expert { - get { - return ResourceManager.GetString("Expert", resourceCulture); - } - } - /// /// Looks up a localized string similar to Folder. /// @@ -691,6 +700,15 @@ namespace SystemTrayMenu.Resources { } } + /// + /// Looks up a localized string similar to Task Manger. + /// + internal static string Task_Manger { + get { + return ResourceManager.GetString("Task Manger", resourceCulture); + } + } + /// /// Looks up a localized string similar to Read the FAQ and then choose a root directory for the SystemTrayMenu.. /// diff --git a/Resources/lang.cs-CZ.resx b/Resources/lang.cs-CZ.resx index 9df25a6..885d3a8 100644 --- a/Resources/lang.cs-CZ.resx +++ b/Resources/lang.cs-CZ.resx @@ -192,9 +192,6 @@ Nemáte přístup do kořenové složky pro SystemTrayMenu. Udělte přístup ke složce nebo změňte kořenovou složku. - - Expert - Jediným kliknutím otevřete položku namísto dvojitého kliknutí @@ -348,4 +345,13 @@ Otevřete složku + + Aktivováno + + + Deaktivováno + + + Správce úloh + \ No newline at end of file diff --git a/Resources/lang.de-DE.resx b/Resources/lang.de-DE.resx index b120a1d..48d6f55 100644 --- a/Resources/lang.de-DE.resx +++ b/Resources/lang.de-DE.resx @@ -192,9 +192,6 @@ Du hast keine Rechte für den Hauptordner. Gewähre die Rechte oder ändere den Hauptordner. - - Experte - Öffnen durch einfachen Klick anstelle eines Doppelklicks @@ -348,4 +345,13 @@ Ordner öffnen + + Aktiviert + + + Deaktiviert + + + Taskmanager + \ No newline at end of file diff --git a/Resources/lang.es-ES.resx b/Resources/lang.es-ES.resx index a37d8c1..c4253ee 100644 --- a/Resources/lang.es-ES.resx +++ b/Resources/lang.es-ES.resx @@ -192,9 +192,6 @@ No tiene acceso a la carpeta raíz del SystemTrayMenu. Otorgue acceso a la carpeta o cambie la carpeta raíz. - - Experta - Un solo clic para abrir un elemento en lugar de hacer doble clic @@ -348,4 +345,13 @@ Abra carpeta + + Activado + + + Desactivado + + + Administrador de tareas + \ No newline at end of file diff --git a/Resources/lang.fr-FR.resx b/Resources/lang.fr-FR.resx index 5abad33..3563aca 100644 --- a/Resources/lang.fr-FR.resx +++ b/Resources/lang.fr-FR.resx @@ -192,9 +192,6 @@ Vous n'avez pas accès au répertoire des raccourcis. Donnez les droits ou changez de répertoire. - - Expert - Un simple clic pour ouvrir un élément au lieu d'un double clic @@ -348,4 +345,13 @@ Ouvrez de dossier + + Activé + + + Désactivé + + + Gestionnaire des tâches + \ No newline at end of file diff --git a/Resources/lang.it-IT.resx b/Resources/lang.it-IT.resx index 7d10852..9a4dfeb 100644 --- a/Resources/lang.it-IT.resx +++ b/Resources/lang.it-IT.resx @@ -192,9 +192,6 @@ Non hai accesso alla cartella principale per SystemTrayMenu. Concedi l'accesso alla cartella o cambia la cartella principale. - - Esperto - Clic singolo per aprire un elemento invece del doppio clic @@ -348,4 +345,13 @@ Aprire cartella + + Attivato + + + Disattivato + + + Task Manger + \ No newline at end of file diff --git a/Resources/lang.ja-JP.resx b/Resources/lang.ja-JP.resx index 52799cc..548ac63 100644 --- a/Resources/lang.ja-JP.resx +++ b/Resources/lang.ja-JP.resx @@ -192,9 +192,6 @@ SystemTrayMenu のルート フォルダーにアクセスできません。 フォルダーへのアクセスを許可するか、ルート フォルダーを変更します。 - - エキスパート - ダブルクリックではなく、シングルクリックでアイテムを開きます @@ -348,4 +345,13 @@ 開いたフォルダ + + 有効化 + + + 非アクティブ化 + + + タスクマネージャー + \ No newline at end of file diff --git a/Resources/lang.ko-KR.resx b/Resources/lang.ko-KR.resx index 413f8cc..a6a06d4 100644 --- a/Resources/lang.ko-KR.resx +++ b/Resources/lang.ko-KR.resx @@ -192,9 +192,6 @@ SystemTrayMenu의 루트 폴더에 액세스 할 수 없습니다. 폴더에 대한 액세스 권한을 부여하거나 루트 폴더를 변경하십시오. - - 전문가 - 두 번 클릭하는 대신 한 번 클릭하여 항목을 엽니 다. @@ -348,4 +345,13 @@ 폴더 열기 + + 활성화됨 + + + 비활성화됨 + + + 작업 관리자 + \ No newline at end of file diff --git a/Resources/lang.nl-NL.resx b/Resources/lang.nl-NL.resx index ee41494..5c4bbae 100644 --- a/Resources/lang.nl-NL.resx +++ b/Resources/lang.nl-NL.resx @@ -192,9 +192,6 @@ U heeft geen toegang tot de hoofdmap voor het SystemTrayMenu. Verleen toegang tot de map of wijzig de hoofdmap. - - Expert - Enkele klik om een item te openen in plaats van dubbelklikken @@ -348,4 +345,13 @@ Open Map + + Geactiveerd + + + Gedeactiveerd + + + Taakbeheer + \ No newline at end of file diff --git a/Resources/lang.pt-BR.resx b/Resources/lang.pt-BR.resx index 15eb8a0..b093c9a 100644 --- a/Resources/lang.pt-BR.resx +++ b/Resources/lang.pt-BR.resx @@ -192,9 +192,6 @@ Você não possui acesso à pasta raiz para o SystemTrayMenu. Conceda acesso à pasta ou mude a pasta raiz. - - Expert - Clique uma vez para abrir um item em vez de clicar duas vezes @@ -348,4 +345,13 @@ Abra Pasta + + Ativado + + + Desativado + + + Gerenciador de tarefas + \ No newline at end of file diff --git a/Resources/lang.resx b/Resources/lang.resx index a92dabc..f45bf0d 100644 --- a/Resources/lang.resx +++ b/Resources/lang.resx @@ -192,9 +192,6 @@ You have no access to the root folder for the SystemTrayMenu. Grant access to the folder or change the root folder. - - Expert - Single click to open an item instead of double click @@ -348,4 +345,13 @@ Open Folder + + Task Manger + + + Deactivated + + + Activated + \ No newline at end of file diff --git a/Resources/lang.ru-RU.resx b/Resources/lang.ru-RU.resx index 8bbba36..799ed20 100644 --- a/Resources/lang.ru-RU.resx +++ b/Resources/lang.ru-RU.resx @@ -192,9 +192,6 @@ У вас нет доступа к корневой папке для SystemTrayMenu. Разрешите доступ к папке или измените корневую папку. - - Эксперт - Один щелчок, чтобы открыть элемент, вместо двойного щелчка @@ -348,4 +345,13 @@ Открыть папку + + Активирован + + + Деактивировано + + + Диспетчер задач + \ No newline at end of file diff --git a/Resources/lang.tr-TR.resx b/Resources/lang.tr-TR.resx index 7a30bfa..2df471a 100644 --- a/Resources/lang.tr-TR.resx +++ b/Resources/lang.tr-TR.resx @@ -192,9 +192,6 @@ SystemTrayMenu için ana klasöre erişiminiz yok. Klasöre erişim izni verin veya ana klasörü değiştirin. - - Uzman - Bir öğeyi açmak için çift tıklama yerine tek tıklama @@ -348,4 +345,13 @@ Klasörü Aç + + Aktif + + + Devre dışı + + + Görev Yöneticisi + \ No newline at end of file diff --git a/Resources/lang.vi-VN.resx b/Resources/lang.vi-VN.resx index e3972a4..03e536a 100644 --- a/Resources/lang.vi-VN.resx +++ b/Resources/lang.vi-VN.resx @@ -192,9 +192,6 @@ Bạn không có quyền truy cập vào thư mục gốc cho SystemTrayMenu. Cấp quyền truy cập vào thư mục hoặc thay đổi thư mục gốc. - - Chuyên gia - Nhấp một lần để mở một mục thay vì nhấp đúp @@ -348,4 +345,13 @@ Mở thư mục + + Đã kích hoạt + + + Đã hủy kích hoạt + + + Quản lý công việc + \ No newline at end of file diff --git a/Resources/lang.zh-CN.resx b/Resources/lang.zh-CN.resx index 0864a82..e7fc45a 100644 --- a/Resources/lang.zh-CN.resx +++ b/Resources/lang.zh-CN.resx @@ -192,9 +192,6 @@ 您无权访问 SystemTrayMenu 的根文件夹。 授予对该文件夹的访问权限或更改根文件夹。 - - 专家 - 单击以打开项目而不是双击 @@ -348,4 +345,13 @@ 打开文件夹 + + 活性 + + + 停用 + + + 任务管理器 + \ No newline at end of file diff --git a/UserInterface/SettingsForm.Designer.cs b/UserInterface/SettingsForm.Designer.cs index 43047a8..bfae80d 100644 --- a/UserInterface/SettingsForm.Designer.cs +++ b/UserInterface/SettingsForm.Designer.cs @@ -50,7 +50,9 @@ namespace SystemTrayMenu.UserInterface this.checkBoxStoreConfigAtAssemblyLocation = new System.Windows.Forms.CheckBox(); this.groupBoxAutostart = new System.Windows.Forms.GroupBox(); this.tableLayoutPanelAutostart = new System.Windows.Forms.TableLayoutPanel(); + this.buttonAddTaskManagerStartupTask = new System.Windows.Forms.Button(); this.checkBoxAutostart = new System.Windows.Forms.CheckBox(); + this.labelStartupTaskStatus = new System.Windows.Forms.Label(); this.groupBoxHotkey = new System.Windows.Forms.GroupBox(); this.tableLayoutPanelHotkey = new System.Windows.Forms.TableLayoutPanel(); this.textBoxHotkeyPlaceholder = new System.Windows.Forms.TextBox(); @@ -264,7 +266,6 @@ namespace SystemTrayMenu.UserInterface this.buttonOk = new System.Windows.Forms.Button(); this.buttonCancel = new System.Windows.Forms.Button(); this.colorDialog = new System.Windows.Forms.ColorDialog(); - this.buttonAddTaskManagerStartupTask = new System.Windows.Forms.Button(); this.tableLayoutPanelMain.SuspendLayout(); this.tabControl.SuspendLayout(); this.tabPageGeneral.SuspendLayout(); @@ -682,6 +683,7 @@ namespace SystemTrayMenu.UserInterface 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.labelStartupTaskStatus, 2, 0); this.tableLayoutPanelAutostart.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanelAutostart.Location = new System.Drawing.Point(3, 22); this.tableLayoutPanelAutostart.Name = "tableLayoutPanelAutostart"; @@ -690,6 +692,19 @@ namespace SystemTrayMenu.UserInterface this.tableLayoutPanelAutostart.Size = new System.Drawing.Size(394, 31); this.tableLayoutPanelAutostart.TabIndex = 0; // + // 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); + // // checkBoxAutostart // this.checkBoxAutostart.AutoSize = true; @@ -701,6 +716,16 @@ namespace SystemTrayMenu.UserInterface this.checkBoxAutostart.Text = "checkBoxAutostart"; this.checkBoxAutostart.UseVisualStyleBackColor = true; // + // labelStartupTaskStatus + // + this.labelStartupTaskStatus.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.labelStartupTaskStatus.AutoSize = true; + this.labelStartupTaskStatus.Location = new System.Drawing.Point(345, 0); + this.labelStartupTaskStatus.Name = "labelStartupTaskStatus"; + this.labelStartupTaskStatus.Size = new System.Drawing.Size(46, 31); + this.labelStartupTaskStatus.TabIndex = 2; + this.labelStartupTaskStatus.Text = "labelStartupTaskStatus"; + // // groupBoxHotkey // this.groupBoxHotkey.AutoSize = true; @@ -3653,19 +3678,6 @@ namespace SystemTrayMenu.UserInterface this.buttonCancel.UseVisualStyleBackColor = true; 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 // this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); @@ -4122,5 +4134,6 @@ namespace SystemTrayMenu.UserInterface private System.Windows.Forms.CheckBox checkBoxPossibilityToSelectFolderByWindowsContextMenu; private System.Windows.Forms.Button buttonOpenFolder; private System.Windows.Forms.Button buttonAddTaskManagerStartupTask; + private System.Windows.Forms.Label labelStartupTaskStatus; } } \ No newline at end of file diff --git a/UserInterface/SettingsForm.cs b/UserInterface/SettingsForm.cs index 74fa659..c84a435 100644 --- a/UserInterface/SettingsForm.cs +++ b/UserInterface/SettingsForm.cs @@ -118,6 +118,11 @@ namespace SystemTrayMenu.UserInterface checkBoxStoreConfigAtAssemblyLocation.Text = Translator.GetText("Store config at the assembly location"); buttonOpenAssemblyLocation.Text = Translator.GetText("Open the assembly location"); groupBoxAutostart.Text = Translator.GetText("Autostart"); + if (IsStartupTask()) + { + groupBoxAutostart.Text += $" ({Translator.GetText("Task Manger")})"; + } + checkBoxAutostart.Text = Translator.GetText("Launch on startup"); buttonAddTaskManagerStartupTask.Text = Translator.GetText("Launch on startup"); groupBoxHotkey.Text = Translator.GetText("Hotkey"); @@ -204,17 +209,15 @@ namespace SystemTrayMenu.UserInterface InitializeAutostart(); void InitializeAutostart() { - bool useStartupTask = false; -#if RELEASEPACKAGE - useStartupTask = true; -#endif - if (useStartupTask) + if (IsStartupTask()) { checkBoxAutostart.Visible = false; + labelStartupTaskStatus.Text = string.Empty; } else { buttonAddTaskManagerStartupTask.Visible = false; + labelStartupTaskStatus.Visible = false; checkBoxAutostart.Checked = Settings.Default.IsAutostartActivated; } } @@ -575,9 +578,12 @@ namespace SystemTrayMenu.UserInterface private void ButtonOk_Click(object sender, EventArgs e) { Settings.Default.UseIconFromRootFolder = checkBoxUseIconFromRootFolder.Checked; -#if !RELEASEPACKAGE - SaveAutostartRegistryEntry(); -#endif + + if (!IsStartupTask()) + { + SaveAutostartRegistryEntry(); + } + SaveHotkey(); void SaveHotkey() { @@ -657,7 +663,7 @@ namespace SystemTrayMenu.UserInterface private void ButtonAddTaskManagerStartupTask_Click(object sender, EventArgs e) { _ = AddStartUpAsync(); - static async Task AddStartUpAsync() + async Task AddStartUpAsync() { // Pass the task ID you specified in the appxmanifest file StartupTask startupTask = await StartupTask.GetAsync("MyStartupId"); @@ -666,24 +672,44 @@ namespace SystemTrayMenu.UserInterface switch (startupTask.State) { case StartupTaskState.Enabled: + case StartupTaskState.EnabledByPolicy: + UpdateLabelStartupStatus(startupTask.State); break; case StartupTaskState.Disabled: // Task is disabled but can be enabled. StartupTaskState newState = await startupTask.RequestEnableAsync(); + UpdateLabelStartupStatus(newState); break; case StartupTaskState.DisabledByUser: - Log.Info($"Please enable autostart via Task Manager."); + UpdateLabelStartupStatus(startupTask.State); break; case StartupTaskState.DisabledByPolicy: - Log.Info($"Autostart disabled by policy. Please add autostart manually, see issue #131"); + UpdateLabelStartupStatus(startupTask.State); break; - case StartupTaskState.EnabledByPolicy: default: break; } } } + private void UpdateLabelStartupStatus(StartupTaskState newState) + { + switch (newState) + { + case StartupTaskState.Disabled: + case StartupTaskState.DisabledByUser: + case StartupTaskState.DisabledByPolicy: + labelStartupTaskStatus.Text = Translator.GetText("Deactivated"); + break; + case StartupTaskState.Enabled: + case StartupTaskState.EnabledByPolicy: + labelStartupTaskStatus.Text = Translator.GetText("Activated"); + break; + default: + break; + } + } + private void ButtonHotkeyDefault_Click(object sender, EventArgs e) { textBoxHotkey.SetHotkey("Ctrl+LWin"); @@ -905,5 +931,14 @@ namespace SystemTrayMenu.UserInterface e.Handled = e.SuppressKeyPress = true; } } + + private bool IsStartupTask() + { + bool useStartupTask = false; +#if RELEASEPACKAGE + useStartupTask = true; +#endif + return useStartupTask; + } } }