#115, version 0.11.1.11

[Feature] Show icon in taskbar when application is running #115
This commit is contained in:
Markus Hofknecht 2020-06-28 15:17:23 +02:00
parent c140284f2a
commit 1052dbb01c
5 changed files with 30 additions and 20 deletions

View file

@ -36,21 +36,22 @@ namespace SystemTrayMenu
menuNotifyIcon.OpenLog += Log.OpenLogFile;
menus.MainPreload();
taskbarForm.Deactivate += TasbkarItemDeactivated;
taskbarForm.Activated += TasbkarItemActivated;
taskbarForm.Resize += TaskbarForm_Resize;
taskbarForm.Show();
}
internal void TasbkarItemDeactivated(object sender, EventArgs e)
private void TaskbarForm_Resize(object sender, EventArgs e)
{
TaskbarForm taskbarForm = (TaskbarForm)sender;
taskbarForm.WindowState = FormWindowState.Minimized;
if (taskbarForm.WindowState == FormWindowState.Minimized)
{
taskbarForm.WindowState = FormWindowState.Normal;
}
}
internal void TasbkarItemActivated(object sender, EventArgs e)
{
TaskbarForm taskbarForm = (TaskbarForm)sender;
taskbarForm.WindowState = FormWindowState.Minimized;
taskbarForm.Activate();
taskbarForm.Focus();
menus.SwitchOpenCloseByTaskbarItem();
}

View file

@ -710,7 +710,8 @@ namespace SystemTrayMenu.Business
private static bool IsActive()
{
return Form.ActiveForm is Menu;
return Form.ActiveForm is Menu ||
Form.ActiveForm is UserInterface.TaskbarForm;
}
private void MenusFadeOut()

View file

@ -35,5 +35,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("0.11.1.10")]
[assembly: AssemblyFileVersion("0.11.1.10")]
[assembly: AssemblyVersion("0.11.1.11")]
[assembly: AssemblyFileVersion("0.11.1.11")]

View file

@ -36,14 +36,14 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(50, 50);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.ClientSize = new System.Drawing.Size(120, 0);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "TaskbarForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "STM";
this.TransparencyKey = System.Drawing.Color.White;
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.LocationChanged += new System.EventHandler(this.TaskbarForm_LocationChanged);
this.ResumeLayout(false);
}

View file

@ -8,14 +8,22 @@ namespace SystemTrayMenu.UserInterface
public TaskbarForm()
{
InitializeComponent();
//Hide the form under the taskbar of primary screen
SetLocation();
}
private void TaskbarForm_LocationChanged(object sender, System.EventArgs e)
{
SetLocation();
}
private void SetLocation()
{
Screen screen = Screen.PrimaryScreen;
Location = new Point(screen.Bounds.Right - 155,
screen.Bounds.Bottom);
//This would be above of taskbar
//Location = new Point(screen.Bounds.Right - 155,
// screen.Bounds.Bottom - Height - 65);
Location = new Point(screen.Bounds.Right - Size.Width,
//we could show behind taskbar?
//screen.Bounds.Bottom- Size.Height);
//but at the moment we dont want to see this
screen.Bounds.Bottom); // - Size.Height);
}
}
}