[Feature] Add 'Settings' and 'Restart' to main menu (#244), version 1.1.0.3

This commit is contained in:
Markus Hofknecht 2021-11-21 17:24:01 +01:00
parent 8d0c0bb307
commit cc9ebd4ecd
14 changed files with 214 additions and 81 deletions

View file

@ -25,8 +25,6 @@ namespace SystemTrayMenu
SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;
menus.LoadStarted += menuNotifyIcon.LoadingStart;
menus.LoadStopped += menuNotifyIcon.LoadingStop;
menuNotifyIcon.Exit += Application.Exit;
menuNotifyIcon.Restart += AppRestart.ByMenuNotifyIcon;
menuNotifyIcon.Click += () => menus.SwitchOpenClose(true);
menuNotifyIcon.OpenLog += Log.OpenLogFile;
menus.MainPreload();

View file

@ -88,6 +88,10 @@ namespace SystemTrayMenu
public static Bitmap BitmapPin { get; set; }
public static Bitmap BitmapSettings { get; set; }
public static Bitmap BitmapRestart { get; set; }
public static Bitmap BitmapPinActive { get; set; }
public static Bitmap BitmapSearch { get; set; }

View file

@ -43,6 +43,8 @@ namespace SystemTrayMenu
AppColors.BitmapOpenFolder.Dispose();
AppColors.BitmapPin.Dispose();
AppColors.BitmapPinActive.Dispose();
AppColors.BitmapSettings.Dispose();
AppColors.BitmapRestart.Dispose();
AppColors.BitmapSearch.Dispose();
AppColors.BitmapFoldersCount.Dispose();
AppColors.BitmapFilesCount.Dispose();
@ -263,6 +265,8 @@ namespace SystemTrayMenu
AppColors.BitmapOpenFolder = ReadSvg(Properties.Resources.ic_fluent_folder_arrow_right_48_regular, htmlColorCodeIcons);
AppColors.BitmapPin = ReadSvg(Properties.Resources.ic_fluent_pin_48_regular, htmlColorCodeIcons);
AppColors.BitmapSettings = ReadSvg(Properties.Resources.ic_fluent_settings_28_regular, htmlColorCodeIcons);
AppColors.BitmapRestart = ReadSvg(Properties.Resources.ic_fluent_arrow_sync_24_regular, htmlColorCodeIcons);
AppColors.BitmapPinActive = ReadSvg(Properties.Resources.ic_fluent_pin_48_filled, htmlColorCodeIcons);
AppColors.BitmapSearch = ReadSvg(Properties.Resources.ic_fluent_search_48_regular, htmlColorCodeIcons);
AppColors.BitmapFoldersCount = ReadSvg(Properties.Resources.ic_fluent_folder_48_regular, htmlColorCodeIcons);

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.1.0.2")]
[assembly: AssemblyFileVersion("1.1.0.2")]
[assembly: AssemblyVersion("1.1.0.3")]
[assembly: AssemblyFileVersion("1.1.0.3")]

View file

@ -60,6 +60,16 @@ namespace SystemTrayMenu.Properties {
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Byte[].
/// </summary>
public static byte[] ic_fluent_arrow_sync_24_regular {
get {
object obj = ResourceManager.GetObject("ic_fluent_arrow_sync_24_regular", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Byte[].
/// </summary>
@ -120,6 +130,16 @@ namespace SystemTrayMenu.Properties {
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Byte[].
/// </summary>
public static byte[] ic_fluent_settings_28_regular {
get {
object obj = ResourceManager.GetObject("ic_fluent_settings_28_regular", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Icon ähnlich wie (Symbol).
/// </summary>

View file

@ -112,12 +112,12 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="White50Percentage" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\White50Percentage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -148,4 +148,10 @@
<data name="Loading" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Loading.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ic_fluent_arrow_sync_24_regular" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ic_fluent_arrow_sync_24_regular.svg;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="ic_fluent_settings_28_regular" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\ic_fluent_settings_28_regular.svg;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

View file

@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill="#585858" d="M16.2506 5.18011C15.9994 5.50947 16.0627 5.9801 16.3921 6.23128C18.1804 7.59515 19.25 9.70821 19.25 12C19.25 15.736 16.4242 18.812 12.7933 19.2071L13.4697 18.5303C13.7626 18.2374 13.7626 17.7626 13.4697 17.4697C13.2034 17.2034 12.7867 17.1792 12.4931 17.3971L12.409 17.4697L10.409 19.4697C10.1427 19.7359 10.1185 20.1526 10.3364 20.4462L10.409 20.5303L12.409 22.5303C12.7019 22.8232 13.1768 22.8232 13.4697 22.5303C13.7359 22.2641 13.7601 21.8474 13.5423 21.5538L13.4697 21.4697L12.7194 20.7208C17.2154 20.355 20.75 16.5903 20.75 12C20.75 9.23526 19.4582 6.68321 17.3017 5.03856C16.9724 4.78738 16.5017 4.85075 16.2506 5.18011ZM10.5303 1.46967C10.2374 1.76256 10.2374 2.23744 10.5303 2.53033L11.2796 3.27923C6.78409 3.6456 3.25 7.41008 3.25 12C3.25 14.6445 4.43126 17.0974 6.43081 18.7491C6.75016 19.0129 7.22289 18.9679 7.48669 18.6485C7.75048 18.3292 7.70545 17.8564 7.3861 17.5926C5.72793 16.2229 4.75 14.1922 4.75 12C4.75 8.26436 7.57532 5.18861 11.2057 4.79301L10.5303 5.46967C10.2374 5.76256 10.2374 6.23744 10.5303 6.53033C10.8232 6.82322 11.2981 6.82322 11.591 6.53033L13.591 4.53033C13.8839 4.23744 13.8839 3.76256 13.591 3.46967L11.591 1.46967C11.2981 1.17678 10.8232 1.17678 10.5303 1.46967Z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -0,0 +1,4 @@
<svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill="#585858" d="M14 9.5C11.5147 9.5 9.5 11.5147 9.5 14C9.5 16.4853 11.5147 18.5 14 18.5C15.3488 18.5 16.559 17.9066 17.3838 16.9666C18.0787 16.1745 18.5 15.1365 18.5 14C18.5 13.5401 18.431 13.0962 18.3028 12.6783C17.7382 10.838 16.0253 9.5 14 9.5ZM11 14C11 12.3431 12.3431 11 14 11C15.6569 11 17 12.3431 17 14C17 15.6569 15.6569 17 14 17C12.3431 17 11 15.6569 11 14Z"/>
<path fill="#585858" d="M21.7093 22.3947L19.9818 21.6364C19.4876 21.4197 18.9071 21.4514 18.44 21.7219C17.9729 21.9923 17.675 22.4692 17.6157 23.0065L17.408 24.8855C17.3651 25.2729 17.084 25.5917 16.7055 25.6819C14.9263 26.106 13.0725 26.106 11.2933 25.6819C10.9148 25.5917 10.6336 25.2729 10.5908 24.8855L10.3834 23.0093C10.3225 22.473 10.0112 21.9976 9.54452 21.728C9.07783 21.4585 8.51117 21.4269 8.01859 21.6424L6.29071 22.4009C5.93281 22.558 5.51493 22.4718 5.24806 22.1858C4.00474 20.8536 3.07924 19.2561 2.54122 17.5136C2.42533 17.1383 2.55922 16.7307 2.8749 16.4976L4.40219 15.3703C4.83721 15.05 5.09414 14.5415 5.09414 14.0006C5.09414 13.4597 4.83721 12.9512 4.40162 12.6305L2.87529 11.5051C2.55914 11.272 2.42513 10.8638 2.54142 10.4881C3.08038 8.74728 4.00637 7.15157 5.24971 5.82108C5.51684 5.53522 5.93492 5.44935 6.29276 5.60685L8.01296 6.36398C8.50793 6.58162 9.07696 6.54875 9.54617 6.27409C10.0133 6.00258 10.3244 5.52521 10.3844 4.98787L10.5933 3.11011C10.637 2.71797 10.9245 2.39697 11.3089 2.31131C12.19 2.11498 13.0891 2.01065 14.0131 2C14.9147 2.01041 15.8128 2.11478 16.6928 2.31143C17.077 2.39728 17.3643 2.71817 17.4079 3.11011L17.617 4.98931C17.7116 5.85214 18.4387 6.50566 19.3055 6.50657C19.5385 6.50694 19.769 6.45832 19.9843 6.36288L21.7048 5.60562C22.0626 5.44812 22.4807 5.53399 22.7478 5.81984C23.9912 7.15034 24.9172 8.74605 25.4561 10.4869C25.5723 10.8623 25.4386 11.2702 25.1228 11.5034L23.5978 12.6297C23.1628 12.9499 22.9 13.4585 22.9 13.9994C22.9 14.5402 23.1628 15.0488 23.5988 15.3697L25.1251 16.4964C25.441 16.7296 25.5748 17.1376 25.4586 17.513C24.9198 19.2536 23.9944 20.8491 22.7517 22.1799C22.4849 22.4657 22.0671 22.5518 21.7093 22.3947ZM16.263 22.1965C16.4982 21.4684 16.9889 20.8288 17.6884 20.4238C18.5702 19.9132 19.6536 19.8546 20.5841 20.2626L21.9281 20.8526C22.791 19.8537 23.4593 18.7013 23.8981 17.4551L22.7095 16.5777L22.7086 16.577C21.898 15.9799 21.4 15.0276 21.4 13.9994C21.4 12.9718 21.8974 12.0195 22.7073 11.4227L22.7085 11.4217L23.8957 10.545C23.4567 9.29874 22.7881 8.1463 21.9248 7.14764L20.5922 7.73419L20.5899 7.73521C20.1844 7.91457 19.7472 8.00716 19.3039 8.00657C17.6715 8.00447 16.3046 6.77425 16.1261 5.15459L16.1259 5.15285L15.9635 3.69298C15.3202 3.57322 14.6677 3.50866 14.013 3.50011C13.3389 3.50885 12.6821 3.57361 12.0377 3.69322L11.8751 5.15446C11.7625 6.16266 11.1793 7.05902 10.3019 7.5698C9.41937 8.08554 8.34453 8.14837 7.40869 7.73688L6.07273 7.14887C5.20949 8.14745 4.54092 9.29977 4.10196 10.5459L5.29181 11.4232C6.11115 12.0268 6.59414 12.9836 6.59414 14.0006C6.59414 15.0172 6.11142 15.9742 5.29237 16.5776L4.10161 17.4565C4.54002 18.7044 5.2085 19.8584 6.07205 20.8587L7.41742 20.2681C8.34745 19.8613 9.41573 19.9214 10.2947 20.4291C11.174 20.9369 11.7593 21.8319 11.8738 22.84L11.8744 22.8445L12.0362 24.3087C13.3326 24.5638 14.6662 24.5638 15.9626 24.3087L16.1247 22.8417C16.1491 22.6217 16.1955 22.4054 16.263 22.1965Z"/>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

View file

@ -16,10 +16,6 @@ namespace SystemTrayMenu.Helper
{
public event EventHandlerEmpty ClickedOpenLog;
public event EventHandlerEmpty ClickedRestart;
public event EventHandlerEmpty ClickedExit;
public ContextMenuStrip Create()
{
ContextMenuStrip menu = new()
@ -124,7 +120,7 @@ namespace SystemTrayMenu.Helper
restart.Click += Restart_Click;
void Restart_Click(object sender, EventArgs e)
{
ClickedRestart?.Invoke();
AppRestart.ByAppContextMenu();
}
menu.Items.Add(restart);
@ -136,7 +132,7 @@ namespace SystemTrayMenu.Helper
exit.Click += Exit_Click;
void Exit_Click(object sender, EventArgs e)
{
ClickedExit?.Invoke();
Application.Exit();
}
menu.Items.Add(exit);

View file

@ -35,18 +35,6 @@ namespace SystemTrayMenu.UserInterface
OpenLog?.Invoke();
}
contextMenus.ClickedRestart += ClickedRestart;
void ClickedRestart()
{
Restart?.Invoke();
}
contextMenus.ClickedExit += ClickedExit;
void ClickedExit()
{
Exit?.Invoke();
}
notifyIcon.ContextMenuStrip = contextMenus.Create();
notifyIcon.MouseClick += NotifyIcon_MouseClick;
void NotifyIcon_MouseClick(object sender, MouseEventArgs e)
@ -65,10 +53,6 @@ namespace SystemTrayMenu.UserInterface
public event EventHandlerEmpty OpenLog;
public event EventHandlerEmpty Restart;
public event EventHandlerEmpty Exit;
public void Dispose()
{
notifyIcon.Icon = null;

View file

@ -98,13 +98,21 @@ namespace SystemTrayMenu.UserInterface
customScrollbar.Name = "customScrollbar";
customScrollbar.Size = new Size(Scaling.Scale(15), 40);
pictureBoxOpenFolder.Size = new Size(
Scaling.Scale(pictureBoxOpenFolder.Width),
Scaling.Scale(pictureBoxOpenFolder.Height));
pictureBoxMenuAlwaysOpen.Size = new Size(
Scaling.Scale(pictureBoxMenuAlwaysOpen.Width),
Scaling.Scale(pictureBoxMenuAlwaysOpen.Height));
pictureBoxOpenFolder.Size = new Size(
Scaling.Scale(pictureBoxOpenFolder.Width),
Scaling.Scale(pictureBoxOpenFolder.Height));
pictureBoxSettings.Size = new Size(
Scaling.Scale(pictureBoxSettings.Width),
Scaling.Scale(pictureBoxSettings.Height));
pictureBoxRestart.Size = new Size(
Scaling.Scale(pictureBoxRestart.Width),
Scaling.Scale(pictureBoxRestart.Height));
pictureBoxSearch.Size = new Size(
Scaling.Scale(pictureBoxSearch.Width),

View file

@ -48,6 +48,8 @@
this.tableLayoutPanelTitle = new System.Windows.Forms.TableLayoutPanel();
this.pictureBoxOpenFolder = new System.Windows.Forms.PictureBox();
this.pictureBoxMenuAlwaysOpen = new System.Windows.Forms.PictureBox();
this.pictureBoxSettings = new System.Windows.Forms.PictureBox();
this.pictureBoxRestart = new System.Windows.Forms.PictureBox();
this.timerUpdateIcons = new System.Windows.Forms.Timer(this.components);
this.tableLayoutPanelDgvAndScrollbar.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dgv)).BeginInit();
@ -59,6 +61,8 @@
this.tableLayoutPanelTitle.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxOpenFolder)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxMenuAlwaysOpen)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxSettings)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxRestart)).BeginInit();
this.SuspendLayout();
//
// tableLayoutPanelDgvAndScrollbar
@ -241,12 +245,16 @@
this.tableLayoutPanelTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanelTitle.AutoSize = true;
this.tableLayoutPanelTitle.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tableLayoutPanelTitle.ColumnCount = 3;
this.tableLayoutPanelTitle.ColumnCount = 5;
this.tableLayoutPanelTitle.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelTitle.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanelTitle.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelTitle.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelTitle.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanelTitle.Controls.Add(this.pictureBoxOpenFolder, 0, 0);
this.tableLayoutPanelTitle.Controls.Add(this.pictureBoxMenuAlwaysOpen, 2, 0);
this.tableLayoutPanelTitle.Controls.Add(this.pictureBoxSettings, 3, 0);
this.tableLayoutPanelTitle.Controls.Add(this.pictureBoxRestart, 4, 0);
this.tableLayoutPanelTitle.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanelTitle.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanelTitle.Name = "tableLayoutPanelTitle";
@ -265,7 +273,7 @@
this.pictureBoxOpenFolder.Size = new System.Drawing.Size(20, 20);
this.pictureBoxOpenFolder.TabIndex = 1;
this.pictureBoxOpenFolder.TabStop = false;
this.pictureBoxOpenFolder.Paint += new System.Windows.Forms.PaintEventHandler(this.PictureBoxMenuOpenFolder_Paint);
this.pictureBoxOpenFolder.Paint += new System.Windows.Forms.PaintEventHandler(this.PictureBoxOpenFolder_Paint);
this.pictureBoxOpenFolder.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PictureBoxOpenFolder_Click);
this.pictureBoxOpenFolder.MouseEnter += new System.EventHandler(this.PictureBox_MouseEnter);
this.pictureBoxOpenFolder.MouseLeave += new System.EventHandler(this.PictureBox_MouseLeave);
@ -275,7 +283,7 @@
//
this.pictureBoxMenuAlwaysOpen.BackColor = System.Drawing.Color.Transparent;
this.pictureBoxMenuAlwaysOpen.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.pictureBoxMenuAlwaysOpen.Location = new System.Drawing.Point(108, 1);
this.pictureBoxMenuAlwaysOpen.Location = new System.Drawing.Point(64, 1);
this.pictureBoxMenuAlwaysOpen.Margin = new System.Windows.Forms.Padding(1);
this.pictureBoxMenuAlwaysOpen.Name = "pictureBoxMenuAlwaysOpen";
this.pictureBoxMenuAlwaysOpen.Size = new System.Drawing.Size(20, 20);
@ -287,6 +295,38 @@
this.pictureBoxMenuAlwaysOpen.MouseEnter += new System.EventHandler(this.PictureBox_MouseEnter);
this.pictureBoxMenuAlwaysOpen.MouseLeave += new System.EventHandler(this.PictureBox_MouseLeave);
this.pictureBoxMenuAlwaysOpen.Resize += new System.EventHandler(this.PictureBox_Resize);
//
// pictureBoxSettings
//
this.pictureBoxSettings.BackColor = System.Drawing.Color.Transparent;
this.pictureBoxSettings.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.pictureBoxSettings.Location = new System.Drawing.Point(86, 1);
this.pictureBoxSettings.Margin = new System.Windows.Forms.Padding(1);
this.pictureBoxSettings.Name = "pictureBoxSettings";
this.pictureBoxSettings.Size = new System.Drawing.Size(20, 20);
this.pictureBoxSettings.TabIndex = 2;
this.pictureBoxSettings.TabStop = false;
this.pictureBoxSettings.Paint += new System.Windows.Forms.PaintEventHandler(this.PictureBoxSettings_Paint);
this.pictureBoxSettings.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PictureBoxSettings_MouseClick);
this.pictureBoxSettings.MouseEnter += new System.EventHandler(this.PictureBox_MouseEnter);
this.pictureBoxSettings.MouseLeave += new System.EventHandler(this.PictureBox_MouseLeave);
this.pictureBoxSettings.Resize += new System.EventHandler(this.PictureBox_Resize);
//
// pictureBoxRestart
//
this.pictureBoxRestart.BackColor = System.Drawing.Color.Transparent;
this.pictureBoxRestart.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.pictureBoxRestart.Location = new System.Drawing.Point(108, 1);
this.pictureBoxRestart.Margin = new System.Windows.Forms.Padding(1);
this.pictureBoxRestart.Name = "pictureBoxRestart";
this.pictureBoxRestart.Size = new System.Drawing.Size(20, 20);
this.pictureBoxRestart.TabIndex = 3;
this.pictureBoxRestart.TabStop = false;
this.pictureBoxRestart.Paint += new System.Windows.Forms.PaintEventHandler(this.PictureBoxRestart_Paint);
this.pictureBoxRestart.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PictureBoxRestart_MouseClick);
this.pictureBoxRestart.MouseEnter += new System.EventHandler(this.PictureBox_MouseEnter);
this.pictureBoxRestart.MouseLeave += new System.EventHandler(this.PictureBox_MouseLeave);
this.pictureBoxRestart.Resize += new System.EventHandler(this.PictureBox_Resize);
//
// Controls like the scrollbar are removed when open the designer
// When adding after InitializeComponent(), then e.g. scrollbar on high dpi not more working
@ -295,7 +335,6 @@
//
// timerUpdateIcons
//
this.timerUpdateIcons.Interval = 100;
this.timerUpdateIcons.Tick += new System.EventHandler(this.TimerUpdateIcons_Tick);
//
// Menu
@ -327,6 +366,8 @@
this.tableLayoutPanelTitle.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBoxOpenFolder)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxMenuAlwaysOpen)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxSettings)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxRestart)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -351,5 +392,7 @@
private System.Windows.Forms.PictureBox pictureBoxFoldersCount;
private System.Windows.Forms.Label labelFoldersCount;
private System.Windows.Forms.Timer timerUpdateIcons;
private System.Windows.Forms.PictureBox pictureBoxSettings;
private System.Windows.Forms.PictureBox pictureBoxRestart;
}
}

View file

@ -137,8 +137,10 @@ namespace SystemTrayMenu.UserInterface
dgv.MouseEnter += ControlsMouseEnter;
labelTitle.MouseEnter += ControlsMouseEnter;
textBoxSearch.MouseEnter += ControlsMouseEnter;
pictureBoxMenuAlwaysOpen.MouseEnter += ControlsMouseEnter;
pictureBoxOpenFolder.MouseEnter += ControlsMouseEnter;
pictureBoxMenuAlwaysOpen.MouseEnter += ControlsMouseEnter;
pictureBoxSettings.MouseEnter += ControlsMouseEnter;
pictureBoxRestart.MouseEnter += ControlsMouseEnter;
pictureBoxSearch.MouseEnter += ControlsMouseEnter;
pictureBoxFilesCount.MouseEnter += ControlsMouseEnter;
pictureBoxFoldersCount.MouseEnter += ControlsMouseEnter;
@ -156,6 +158,8 @@ namespace SystemTrayMenu.UserInterface
textBoxSearch.MouseLeave += ControlsMouseLeave;
pictureBoxMenuAlwaysOpen.MouseLeave += ControlsMouseLeave;
pictureBoxOpenFolder.MouseLeave += ControlsMouseLeave;
pictureBoxSettings.MouseLeave += ControlsMouseLeave;
pictureBoxRestart.MouseLeave += ControlsMouseLeave;
pictureBoxSearch.MouseLeave += ControlsMouseLeave;
pictureBoxFilesCount.MouseLeave += ControlsMouseLeave;
pictureBoxFoldersCount.MouseLeave += ControlsMouseLeave;
@ -179,6 +183,8 @@ namespace SystemTrayMenu.UserInterface
internal event EventHandlerEmpty UserClickedOpenFolder;
internal event EventHandlerEmpty UserClickedRestart;
internal event EventHandler<Keys> CmdKeyProcessed;
internal event EventHandlerEmpty SearchTextChanging;
@ -254,6 +260,8 @@ namespace SystemTrayMenu.UserInterface
if (type != MenuType.Main)
{
pictureBoxMenuAlwaysOpen.Visible = false;
pictureBoxSettings.Visible = false;
pictureBoxRestart.Visible = false;
}
switch (type)
@ -285,9 +293,8 @@ namespace SystemTrayMenu.UserInterface
pictureBoxMenuAlwaysOpen.Paint -= PictureBoxMenuAlwaysOpen_Paint;
pictureBoxMenuAlwaysOpen.Paint += LoadingMenu_Paint;
timerUpdateIcons.Tick -= TimerUpdateIcons_Tick;
timerUpdateIcons.Tick += TimerUpdateLoadingMenu_Tick;
timerUpdateIcons.Tick += (sender, e) => pictureBoxMenuAlwaysOpen.Invalidate();
timerUpdateIcons.Interval = 15;
pictureBoxMenuAlwaysOpen.Visible = true;
break;
default:
break;
@ -787,22 +794,25 @@ namespace SystemTrayMenu.UserInterface
pictureBox.Invalidate();
}
private void PictureBoxSearch_Paint(object sender, PaintEventArgs e)
private void PictureBoxOpenFolder_Paint(object sender, PaintEventArgs e)
{
PictureBox pictureBox = (PictureBox)sender;
e.Graphics.DrawImage(AppColors.BitmapSearch, new Rectangle(Point.Empty, pictureBox.ClientSize));
e.Graphics.DrawImage(AppColors.BitmapOpenFolder, new Rectangle(Point.Empty, pictureBox.ClientSize));
if (pictureBox.Tag != null && (bool)pictureBox.Tag)
{
Rectangle rowBounds = new(0, 0, pictureBox.Width, pictureBox.Height);
ControlPaint.DrawBorder(e.Graphics, rowBounds, MenuDefines.ColorSelectedItemBorder, ButtonBorderStyle.Solid);
}
}
private void PictureBoxFoldersCount_Paint(object sender, PaintEventArgs e)
private void PictureBoxOpenFolder_Click(object sender, MouseEventArgs e)
{
PictureBox pictureBox = (PictureBox)sender;
e.Graphics.DrawImage(AppColors.BitmapFoldersCount, new Rectangle(Point.Empty, pictureBox.ClientSize));
}
private void PictureBoxFilesCount_Paint(object sender, PaintEventArgs e)
{
PictureBox pictureBox = (PictureBox)sender;
e.Graphics.DrawImage(AppColors.BitmapFilesCount, new Rectangle(Point.Empty, pictureBox.ClientSize));
if (e.Button == MouseButtons.Left)
{
UserClickedOpenFolder?.Invoke();
}
}
private void PictureBoxMenuAlwaysOpen_Paint(object sender, PaintEventArgs e)
@ -825,9 +835,85 @@ namespace SystemTrayMenu.UserInterface
}
}
private void TimerUpdateLoadingMenu_Tick(object sender, EventArgs e)
private void PictureBoxMenuAlwaysOpen_Click(object sender, EventArgs e)
{
pictureBoxMenuAlwaysOpen.Invalidate();
PictureBox pictureBox = (PictureBox)sender;
Config.AlwaysOpenByPin = !Config.AlwaysOpenByPin;
pictureBox.Invalidate();
}
private void PictureBoxSettings_Paint(object sender, PaintEventArgs e)
{
PictureBox pictureBox = (PictureBox)sender;
e.Graphics.DrawImage(AppColors.BitmapSettings, new Rectangle(Point.Empty, pictureBox.ClientSize));
if (pictureBox.Tag != null && (bool)pictureBox.Tag)
{
Rectangle rowBounds = new(0, 0, pictureBox.Width, pictureBox.Height);
ControlPaint.DrawBorder(e.Graphics, rowBounds, MenuDefines.ColorSelectedItemBorder, ButtonBorderStyle.Solid);
}
}
private void PictureBoxSettings_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
SettingsForm settingsForm = new();
if (settingsForm.ShowDialog() == DialogResult.OK)
{
AppRestart.ByConfigChange();
}
}
}
private void PictureBoxRestart_Paint(object sender, PaintEventArgs e)
{
PictureBox pictureBox = (PictureBox)sender;
e.Graphics.DrawImage(AppColors.BitmapRestart, new Rectangle(Point.Empty, pictureBox.ClientSize));
if (pictureBox.Tag != null && (bool)pictureBox.Tag)
{
Rectangle rowBounds = new(0, 0, pictureBox.Width, pictureBox.Height);
ControlPaint.DrawBorder(e.Graphics, rowBounds, MenuDefines.ColorSelectedItemBorder, ButtonBorderStyle.Solid);
}
}
private void PictureBoxRestart_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
AppRestart.ByMenuButton();
}
}
private void PictureBoxRestart_Click(object sender, EventArgs e)
{
}
private void PictureBoxSettings_Click(object sender, EventArgs e)
{
}
private void PictureBoxSearch_Paint(object sender, PaintEventArgs e)
{
PictureBox pictureBox = (PictureBox)sender;
e.Graphics.DrawImage(AppColors.BitmapSearch, new Rectangle(Point.Empty, pictureBox.ClientSize));
}
private void PictureBoxFoldersCount_Paint(object sender, PaintEventArgs e)
{
PictureBox pictureBox = (PictureBox)sender;
e.Graphics.DrawImage(AppColors.BitmapFoldersCount, new Rectangle(Point.Empty, pictureBox.ClientSize));
}
private void PictureBoxFilesCount_Paint(object sender, PaintEventArgs e)
{
PictureBox pictureBox = (PictureBox)sender;
e.Graphics.DrawImage(AppColors.BitmapFilesCount, new Rectangle(Point.Empty, pictureBox.ClientSize));
}
private void LoadingMenu_Paint(object sender, PaintEventArgs e)
@ -839,34 +925,6 @@ namespace SystemTrayMenu.UserInterface
new Rectangle(Point.Empty, new Size(pictureBox.ClientSize.Width - 2, pictureBox.ClientSize.Height - 2)));
}
private void PictureBoxMenuOpenFolder_Paint(object sender, PaintEventArgs e)
{
PictureBox pictureBox = (PictureBox)sender;
e.Graphics.DrawImage(AppColors.BitmapOpenFolder, new Rectangle(Point.Empty, pictureBox.ClientSize));
if (pictureBox.Tag != null && (bool)pictureBox.Tag)
{
Rectangle rowBounds = new(0, 0, pictureBox.Width, pictureBox.Height);
ControlPaint.DrawBorder(e.Graphics, rowBounds, MenuDefines.ColorSelectedItemBorder, ButtonBorderStyle.Solid);
}
}
private void PictureBoxMenuAlwaysOpen_Click(object sender, EventArgs e)
{
PictureBox pictureBox = (PictureBox)sender;
Config.AlwaysOpenByPin = !Config.AlwaysOpenByPin;
pictureBox.Invalidate();
}
private void PictureBoxOpenFolder_Click(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
UserClickedOpenFolder?.Invoke();
}
}
private void TimerUpdateIcons_Tick(object sender, EventArgs e)
{
int iconsToUpdate = 0;

View file

@ -19,7 +19,7 @@ namespace SystemTrayMenu.Utilities
Restart(GetCurrentMethod());
}
internal static void ByMenuNotifyIcon()
internal static void ByAppContextMenu()
{
Restart(GetCurrentMethod());
}
@ -34,6 +34,11 @@ namespace SystemTrayMenu.Utilities
Restart(GetCurrentMethod());
}
internal static void ByMenuButton()
{
Restart(GetCurrentMethod());
}
private static void Restart(string reason)
{
BeforeRestarting?.Invoke();