[Feature] Option to remove taskbar icon (#123), version 1.0.14.1

This commit is contained in:
Markus Hofknecht 2020-08-05 15:33:45 +02:00
parent 3f7bacd93a
commit fed20a59d7
10 changed files with 239 additions and 34 deletions

View file

@ -17,7 +17,7 @@ namespace SystemTrayMenu
{
private readonly AppNotifyIcon menuNotifyIcon = new AppNotifyIcon();
private readonly Menus menus = new Menus();
private readonly TaskbarForm taskbarForm = new TaskbarForm();
private readonly TaskbarForm taskbarForm = null;
public App()
{
@ -35,26 +35,30 @@ namespace SystemTrayMenu
menuNotifyIcon.OpenLog += Log.OpenLogFile;
menus.MainPreload();
taskbarForm.Activated += TasbkarItemActivated;
void TasbkarItemActivated(object sender, EventArgs e)
if (!Properties.Settings.Default.HideTaskbarForm)
{
SetStateNormal();
taskbarForm.Activate();
taskbarForm.Focus();
menus.SwitchOpenCloseByTaskbarItem();
}
taskbarForm = new TaskbarForm();
taskbarForm.Activated += TasbkarItemActivated;
void TasbkarItemActivated(object sender, EventArgs e)
{
SetStateNormal();
taskbarForm.Activate();
taskbarForm.Focus();
menus.SwitchOpenCloseByTaskbarItem();
}
taskbarForm.Resize += TaskbarForm_Resize;
taskbarForm.FormClosed += TaskbarForm_FormClosed;
static void TaskbarForm_FormClosed(object sender, FormClosedEventArgs e)
{
Application.Exit();
}
taskbarForm.Resize += TaskbarForm_Resize;
taskbarForm.FormClosed += TaskbarForm_FormClosed;
static void TaskbarForm_FormClosed(object sender, FormClosedEventArgs e)
{
Application.Exit();
}
taskbarForm.Deactivate += TaskbarForm_Deactivate;
void TaskbarForm_Resize(object sender, EventArgs e)
{
SetStateNormal();
taskbarForm.Deactivate += TaskbarForm_Deactivate;
void TaskbarForm_Resize(object sender, EventArgs e)
{
SetStateNormal();
}
}
DllImports.NativeMethods.User32ShowInactiveTopmost(taskbarForm);
@ -62,7 +66,7 @@ namespace SystemTrayMenu
public void Dispose()
{
taskbarForm.Dispose();
taskbarForm?.Dispose();
menus.Dispose();
menuNotifyIcon.Dispose();
}

View file

@ -39,5 +39,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.14.0")]
[assembly: AssemblyFileVersion("1.0.14.0")]
[assembly: AssemblyVersion("1.0.14.1")]
[assembly: AssemblyFileVersion("1.0.14.1")]

View file

@ -51,7 +51,7 @@ namespace SystemTrayMenu.Properties
/// Gets the setting key this is returning must set before the settings are used.
/// e.g. <c>Properties.Settings.Default.SettingsKey = @"C:\temp\user.config";</c>.
/// </summary>
private string UserConfigPath
private static string UserConfigPath
{
get
{

View file

@ -87,5 +87,29 @@ namespace SystemTrayMenu.Properties {
this["IsUpgraded"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool HideTaskbarForm {
get {
return ((bool)(this["HideTaskbarForm"]));
}
set {
this["HideTaskbarForm"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("False")]
public bool OpenItemWithOneClick {
get {
return ((bool)(this["OpenItemWithOneClick"]));
}
set {
this["OpenItemWithOneClick"] = value;
}
}
}
}

View file

@ -17,5 +17,11 @@
<Setting Name="IsUpgraded" Provider="CustomSettingsProvider" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="HideTaskbarForm" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="OpenItemWithOneClick" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>

View file

@ -132,6 +132,15 @@ namespace SystemTrayMenu.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Expert.
/// </summary>
internal static string Expert {
get {
return ResourceManager.GetString("Expert", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Folder.
/// </summary>
@ -186,6 +195,15 @@ namespace SystemTrayMenu.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Hide Taskbar Icon.
/// </summary>
internal static string Hide_Taskbar_Icon {
get {
return ResourceManager.GetString("Hide Taskbar Icon", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Hotkey.
/// </summary>
@ -267,6 +285,15 @@ namespace SystemTrayMenu.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Single click to start item.
/// </summary>
internal static string Single_click_to_start_item {
get {
return ResourceManager.GetString("Single click to start item", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to SystemTrayMenu.
/// </summary>

View file

@ -195,4 +195,13 @@
<data name="MessageRootFolderNoAccess" xml:space="preserve">
<value>Du hast keine Rechte für den Hauptordner. Gewähre die Rechte oder ändere den Hauptordner.</value>
</data>
<data name="Expert" xml:space="preserve">
<value>Experte</value>
</data>
<data name="Hide Taskbar Icon" xml:space="preserve">
<value>Taskbar Icon verstecken</value>
</data>
<data name="Single click to start item" xml:space="preserve">
<value>Einzelner Klick, um Item zu starten</value>
</data>
</root>

View file

@ -195,4 +195,13 @@
<data name="MessageRootFolderNoAccess" xml:space="preserve">
<value>You have no access to the root folder for the SystemTrayMenu. Grant access to the folder or change the root folder.</value>
</data>
<data name="Expert" xml:space="preserve">
<value>Expert</value>
</data>
<data name="Hide Taskbar Icon" xml:space="preserve">
<value>Hide Taskbar Icon</value>
</data>
<data name="Single click to start item" xml:space="preserve">
<value>Single click to start item</value>
</data>
</root>

View file

@ -32,7 +32,7 @@ namespace SystemTrayMenu.UserInterface
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingsForm));
this.tableLayoutPanelMain = new System.Windows.Forms.TableLayoutPanel();
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabControlExpert = new System.Windows.Forms.TabControl();
this.tabPageGeneral = new System.Windows.Forms.TabPage();
this.tableLayoutPanelGeneral = new System.Windows.Forms.TableLayoutPanel();
this.comboBoxLanguage = new System.Windows.Forms.ComboBox();
@ -52,13 +52,21 @@ namespace SystemTrayMenu.UserInterface
this.tableLayoutPanelBottom = new System.Windows.Forms.TableLayoutPanel();
this.buttonOk = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.tabPageExpert = new System.Windows.Forms.TabPage();
this.tableLayoutPanel6 = new System.Windows.Forms.TableLayoutPanel();
this.labelHideTaskbarForm = new System.Windows.Forms.Label();
this.labelOpenItemWithOneClick = new System.Windows.Forms.Label();
this.checkBoxOpenItemWithOneClick = new System.Windows.Forms.CheckBox();
this.checkBoxHideTaskbarForm = new System.Windows.Forms.CheckBox();
this.tableLayoutPanelMain.SuspendLayout();
this.tabControl1.SuspendLayout();
this.tabControlExpert.SuspendLayout();
this.tabPageGeneral.SuspendLayout();
this.tableLayoutPanelGeneral.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.tableLayoutPanel5.SuspendLayout();
this.tableLayoutPanelBottom.SuspendLayout();
this.tabPageExpert.SuspendLayout();
this.tableLayoutPanel6.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanelMain
@ -67,7 +75,7 @@ namespace SystemTrayMenu.UserInterface
this.tableLayoutPanelMain.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanelMain.ColumnCount = 1;
this.tableLayoutPanelMain.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanelMain.Controls.Add(this.tabControl1, 0, 0);
this.tableLayoutPanelMain.Controls.Add(this.tabControlExpert, 0, 0);
this.tableLayoutPanelMain.Controls.Add(this.tableLayoutPanelBottom, 0, 1);
this.tableLayoutPanelMain.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanelMain.Name = "tableLayoutPanelMain";
@ -79,12 +87,13 @@ namespace SystemTrayMenu.UserInterface
//
// tabControl1
//
this.tabControl1.Controls.Add(this.tabPageGeneral);
this.tabControl1.Location = new System.Drawing.Point(3, 3);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(395, 240);
this.tabControl1.TabIndex = 0;
this.tabControlExpert.Controls.Add(this.tabPageGeneral);
this.tabControlExpert.Controls.Add(this.tabPageExpert);
this.tabControlExpert.Location = new System.Drawing.Point(3, 3);
this.tabControlExpert.Name = "tabControl1";
this.tabControlExpert.SelectedIndex = 0;
this.tabControlExpert.Size = new System.Drawing.Size(395, 240);
this.tabControlExpert.TabIndex = 0;
//
// tabPageGeneral
//
@ -122,6 +131,8 @@ namespace SystemTrayMenu.UserInterface
this.tableLayoutPanelGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanelGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanelGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanelGeneral.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanelGeneral.Size = new System.Drawing.Size(313, 145);
this.tableLayoutPanelGeneral.TabIndex = 0;
//
@ -365,6 +376,85 @@ namespace SystemTrayMenu.UserInterface
this.buttonCancel.UseVisualStyleBackColor = true;
this.buttonCancel.Click += new System.EventHandler(this.ButtonCancel_Click);
//
// tabPageExpert
//
this.tabPageExpert.Controls.Add(this.tableLayoutPanel6);
this.tabPageExpert.Location = new System.Drawing.Point(4, 22);
this.tabPageExpert.Name = "tabPageExpert";
this.tabPageExpert.Size = new System.Drawing.Size(387, 214);
this.tabPageExpert.TabIndex = 1;
this.tabPageExpert.Text = "tabPageExpert";
this.tabPageExpert.UseVisualStyleBackColor = true;
//
// tableLayoutPanel6
//
this.tableLayoutPanel6.AutoSize = true;
this.tableLayoutPanel6.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanel6.ColumnCount = 3;
this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 12F));
this.tableLayoutPanel6.Controls.Add(this.labelHideTaskbarForm, 0, 0);
this.tableLayoutPanel6.Controls.Add(this.labelOpenItemWithOneClick, 0, 1);
this.tableLayoutPanel6.Controls.Add(this.checkBoxOpenItemWithOneClick, 1, 1);
this.tableLayoutPanel6.Controls.Add(this.checkBoxHideTaskbarForm, 1, 0);
this.tableLayoutPanel6.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel6.Name = "tableLayoutPanel6";
this.tableLayoutPanel6.RowCount = 3;
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel6.Size = new System.Drawing.Size(361, 88);
this.tableLayoutPanel6.TabIndex = 1;
//
// labelShowTaskbarForm
//
this.labelHideTaskbarForm.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelHideTaskbarForm.AutoSize = true;
this.labelHideTaskbarForm.Location = new System.Drawing.Point(3, 5);
this.labelHideTaskbarForm.Name = "labelShowTaskbarForm";
this.labelHideTaskbarForm.Size = new System.Drawing.Size(118, 13);
this.labelHideTaskbarForm.TabIndex = 104;
this.labelHideTaskbarForm.Text = "labelShowTaskbarForm";
//
// labelOpenItemWithOneClick
//
this.labelOpenItemWithOneClick.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.labelOpenItemWithOneClick.AutoSize = true;
this.labelOpenItemWithOneClick.Location = new System.Drawing.Point(3, 29);
this.labelOpenItemWithOneClick.Name = "labelOpenItemWithOneClick";
this.labelOpenItemWithOneClick.Size = new System.Drawing.Size(140, 13);
this.labelOpenItemWithOneClick.TabIndex = 105;
this.labelOpenItemWithOneClick.Text = "labelOpenItemWithOneClick";
//
// checkBoxOpenItemWithOneClick
//
this.checkBoxOpenItemWithOneClick.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.checkBoxOpenItemWithOneClick.AutoSize = true;
this.checkBoxOpenItemWithOneClick.Location = new System.Drawing.Point(155, 31);
this.checkBoxOpenItemWithOneClick.Margin = new System.Windows.Forms.Padding(9, 7, 9, 0);
this.checkBoxOpenItemWithOneClick.Name = "checkBoxOpenItemWithOneClick";
this.checkBoxOpenItemWithOneClick.Size = new System.Drawing.Size(185, 17);
this.checkBoxOpenItemWithOneClick.TabIndex = 106;
this.checkBoxOpenItemWithOneClick.Text = "checkBoxOpenItemWithOneClick";
this.checkBoxOpenItemWithOneClick.UseVisualStyleBackColor = true;
//
// checkBoxShowTaskbarForm
//
this.checkBoxHideTaskbarForm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.checkBoxHideTaskbarForm.AutoSize = true;
this.checkBoxHideTaskbarForm.Location = new System.Drawing.Point(155, 7);
this.checkBoxHideTaskbarForm.Margin = new System.Windows.Forms.Padding(9, 7, 9, 0);
this.checkBoxHideTaskbarForm.Name = "checkBoxShowTaskbarForm";
this.checkBoxHideTaskbarForm.Size = new System.Drawing.Size(185, 17);
this.checkBoxHideTaskbarForm.TabIndex = 107;
this.checkBoxHideTaskbarForm.Text = "checkBoxShowTaskbarForm";
this.checkBoxHideTaskbarForm.UseVisualStyleBackColor = true;
//
// SettingsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@ -383,7 +473,7 @@ namespace SystemTrayMenu.UserInterface
this.Load += new System.EventHandler(this.SettingsForm_Load);
this.tableLayoutPanelMain.ResumeLayout(false);
this.tableLayoutPanelMain.PerformLayout();
this.tabControl1.ResumeLayout(false);
this.tabControlExpert.ResumeLayout(false);
this.tabPageGeneral.ResumeLayout(false);
this.tabPageGeneral.PerformLayout();
this.tableLayoutPanelGeneral.ResumeLayout(false);
@ -394,6 +484,10 @@ namespace SystemTrayMenu.UserInterface
this.tableLayoutPanel5.PerformLayout();
this.tableLayoutPanelBottom.ResumeLayout(false);
this.tableLayoutPanelBottom.PerformLayout();
this.tabPageExpert.ResumeLayout(false);
this.tabPageExpert.PerformLayout();
this.tableLayoutPanel6.ResumeLayout(false);
this.tableLayoutPanel6.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
@ -404,7 +498,7 @@ namespace SystemTrayMenu.UserInterface
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelMain;
private System.Windows.Forms.Button buttonOk;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelBottom;
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabControl tabControlExpert;
private System.Windows.Forms.TabPage tabPageGeneral;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.ComboBox comboBoxLanguage;
@ -423,5 +517,11 @@ namespace SystemTrayMenu.UserInterface
private System.Windows.Forms.Label labelAutostart;
private System.Windows.Forms.Label labelHotkey;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanelGeneral;
private System.Windows.Forms.TabPage tabPageExpert;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel6;
private System.Windows.Forms.Label labelHideTaskbarForm;
private System.Windows.Forms.Label labelOpenItemWithOneClick;
private System.Windows.Forms.CheckBox checkBoxOpenItemWithOneClick;
private System.Windows.Forms.CheckBox checkBoxHideTaskbarForm;
}
}

View file

@ -29,11 +29,16 @@ namespace SystemTrayMenu.UserInterface
{
Text = Translator.GetText("Settings");
tabPageGeneral.Text = Translator.GetText("General");
tabPageExpert.Text = Translator.GetText("Expert");
labelFolder.Text = Translator.GetText("Folder");
labelAutostart.Text = Translator.GetText("Autostart");
checkBoxAutostart.Text = Translator.GetText("Launch on startup");
labelHotkey.Text = Translator.GetText("Hotkey");
labelLanguage.Text = Translator.GetText("Language");
labelHideTaskbarForm.Text = string.Empty;
checkBoxHideTaskbarForm.Text = Translator.GetText("Hide Taskbar Icon");
labelOpenItemWithOneClick.Text = string.Empty;
checkBoxOpenItemWithOneClick.Text = Translator.GetText("Single click to start item");
buttonOk.Text = Translator.GetText("buttonOk");
buttonCancel.Text = Translator.GetText("buttonCancel");
}
@ -75,6 +80,20 @@ namespace SystemTrayMenu.UserInterface
comboBoxLanguage.SelectedValue = "en";
}
}
InitializeHideTaskbarForm();
void InitializeHideTaskbarForm()
{
checkBoxHideTaskbarForm.Checked =
Properties.Settings.Default.HideTaskbarForm;
}
InitializeOpenItemWithOneClick();
void InitializeOpenItemWithOneClick()
{
checkBoxOpenItemWithOneClick.Checked =
Properties.Settings.Default.OpenItemWithOneClick;
}
}
public string NewHotKey => newHotKey;
@ -237,7 +256,7 @@ namespace SystemTrayMenu.UserInterface
private void SettingsForm_Load(object sender, EventArgs e)
{
tabControl1.Size = new Size(
tabControlExpert.Size = new Size(
tableLayoutPanelGeneral.Size.Width,
tableLayoutPanelGeneral.Size.Height);
}
@ -247,6 +266,7 @@ namespace SystemTrayMenu.UserInterface
SetAutostart();
SetHotkey();
SetLanguage();
SetExpertOptions();
Properties.Settings.Default.Save();
DialogResult = DialogResult.OK;
Close();
@ -285,6 +305,12 @@ namespace SystemTrayMenu.UserInterface
comboBoxLanguage.SelectedValue.ToString();
}
private void SetExpertOptions()
{
Properties.Settings.Default.HideTaskbarForm = checkBoxHideTaskbarForm.Checked;
Properties.Settings.Default.OpenItemWithOneClick = checkBoxOpenItemWithOneClick.Checked;
}
private void ButtonCancel_Click(object sender, EventArgs e)
{
Properties.Settings.Default.Reload();