#115, version 0.11.1.9

[Feature] Show icon in taskbar when application is running #115
This commit is contained in:
Markus Hofknecht 2020-06-27 15:50:36 +02:00
parent 68ef1f752a
commit c140284f2a
4 changed files with 26 additions and 14 deletions

View file

@ -51,6 +51,7 @@ namespace SystemTrayMenu
{
TaskbarForm taskbarForm = (TaskbarForm)sender;
taskbarForm.WindowState = FormWindowState.Minimized;
taskbarForm.Focus();
menus.SwitchOpenCloseByTaskbarItem();
}

View file

@ -155,6 +155,7 @@ namespace SystemTrayMenu.Business
keyboardInput.ClosePressed += MenusFadeOut;
keyboardInput.RowDeselected += waitToOpenMenu.RowDeselected;
keyboardInput.RowSelected += waitToOpenMenu.RowSelected;
keyboardInput.EnterPressed += waitToOpenMenu.EnterOpensInstantly;
timerStillActiveCheck.Interval = 1000;
timerStillActiveCheck.Tick += StillActiveTick;
@ -228,6 +229,13 @@ namespace SystemTrayMenu.Business
{
if (menuToDispose != null)
{
menuToDispose.MouseWheel -= AdjustMenusSizeAndLocation;
menuToDispose.MouseLeave -= waitLeave.Start;
menuToDispose.MouseEnter -= waitLeave.Stop;
menuToDispose.KeyPress -= keyboardInput.KeyPress;
menuToDispose.CmdKeyProcessed -= keyboardInput.CmdKeyProcessed;
menuToDispose.SearchTextChanging -= keyboardInput.SearchTextChanging;
menuToDispose.SearchTextChanged -= Menu_SearchTextChanged;
DataGridView dgv = menuToDispose.GetDataGridView();
dgv.CellMouseEnter -= waitToOpenMenu.MouseEnter;
dgv.CellMouseLeave -= waitToOpenMenu.MouseLeave;
@ -452,14 +460,8 @@ namespace SystemTrayMenu.Business
menu.MouseEnter += waitLeave.Stop;
menu.KeyPress += keyboardInput.KeyPress;
menu.CmdKeyProcessed += keyboardInput.CmdKeyProcessed;
keyboardInput.EnterPressed += waitToOpenMenu.EnterOpensInstantly;
menu.SearchTextChanging += keyboardInput.SearchTextChanging;
menu.SearchTextChanged += Menu_SearchTextChanged;
void Menu_SearchTextChanged(object sender, EventArgs e)
{
keyboardInput.SearchTextChanged(sender, e);
AdjustMenusSizeAndLocation();
}
menu.Deactivate += Deactivate;
void Deactivate(object sender, EventArgs e)
{
@ -759,5 +761,11 @@ namespace SystemTrayMenu.Business
menuPredecessor = menu;
}
}
private void Menu_SearchTextChanged(object sender, EventArgs e)
{
keyboardInput.SearchTextChanged(sender, e);
AdjustMenusSizeAndLocation();
}
}
}

View file

@ -36,12 +36,12 @@
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(0, 0);
this.ClientSize = new System.Drawing.Size(50, 50);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "TaskbarForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
this.Text = "TaskbarForm";
this.Text = "STM";
this.TransparencyKey = System.Drawing.Color.White;
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.ResumeLayout(false);

View file

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
namespace SystemTrayMenu.UserInterface
@ -13,6 +8,14 @@ namespace SystemTrayMenu.UserInterface
public TaskbarForm()
{
InitializeComponent();
//Hide the form under the taskbar of primary screen
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);
}
}
}