mirror of
https://github.com/Hofknecht/SystemTrayMenu.git
synced 2024-06-10 22:44:37 +12:00
This commit is contained in:
parent
a9f3308b27
commit
3c0ed17988
|
@ -168,27 +168,6 @@ namespace SystemTrayMenu.Handler
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// While menu is open user presses a key to search for specific entries.
|
||||
/// </summary>
|
||||
/// <param name="sender">not used.</param>
|
||||
/// <param name="e">Key data of the pressed key.</param>
|
||||
internal void KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (char.IsLetterOrDigit(e.KeyChar) ||
|
||||
char.IsPunctuation(e.KeyChar) ||
|
||||
char.IsWhiteSpace(e.KeyChar) ||
|
||||
char.IsSeparator(e.KeyChar))
|
||||
{
|
||||
string letter = e.KeyChar.ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
Menu menu = menus[iMenuKey];
|
||||
menu.KeyPressedSearch(letter);
|
||||
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
internal void SearchTextChanging()
|
||||
{
|
||||
ClearIsSelectedByKey();
|
||||
|
@ -582,12 +561,15 @@ namespace SystemTrayMenu.Handler
|
|||
if (dgv.Rows.Count > rowIndex)
|
||||
{
|
||||
DataGridViewRow row = dgv.Rows[rowIndex];
|
||||
RowData rowData = (RowData)row.Cells[2].Value;
|
||||
rowData.IsSelected = false;
|
||||
row.Selected = false;
|
||||
RowData rowData = (RowData)row.Cells[2].Value;
|
||||
if (rowData != null)
|
||||
{
|
||||
rowData.IsSelected = false;
|
||||
rowData.IsClicking = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -630,7 +630,6 @@ namespace SystemTrayMenu.Business
|
|||
menuToDispose.MouseWheel -= AdjustMenusSizeAndLocation;
|
||||
menuToDispose.MouseLeave -= waitLeave.Start;
|
||||
menuToDispose.MouseEnter -= waitLeave.Stop;
|
||||
menuToDispose.KeyPress -= keyboardInput.KeyPress;
|
||||
menuToDispose.CmdKeyProcessed -= keyboardInput.CmdKeyProcessed;
|
||||
menuToDispose.SearchTextChanging -= keyboardInput.SearchTextChanging;
|
||||
menuToDispose.KeyPressCheck -= Menu_KeyPressCheck;
|
||||
|
@ -896,7 +895,6 @@ namespace SystemTrayMenu.Business
|
|||
menu.MouseWheel += AdjustMenusSizeAndLocation;
|
||||
menu.MouseLeave += waitLeave.Start;
|
||||
menu.MouseEnter += waitLeave.Stop;
|
||||
menu.KeyPress += keyboardInput.KeyPress;
|
||||
menu.CmdKeyProcessed += keyboardInput.CmdKeyProcessed;
|
||||
menu.KeyPressCheck += Menu_KeyPressCheck;
|
||||
menu.SearchTextChanging += Menu_SearchTextChanging;
|
||||
|
|
|
@ -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.2.8.8")]
|
||||
[assembly: AssemblyFileVersion("1.2.8.8")]
|
||||
[assembly: AssemblyVersion("1.2.8.9")]
|
||||
[assembly: AssemblyFileVersion("1.2.8.9")]
|
||||
|
|
|
@ -12,18 +12,13 @@ namespace SystemTrayMenu.UserInterface
|
|||
|
||||
internal class AppNotifyIcon : IDisposable
|
||||
{
|
||||
private readonly Timer load = new();
|
||||
private readonly NotifyIcon notifyIcon = new();
|
||||
private bool threadsLoading;
|
||||
|
||||
public AppNotifyIcon()
|
||||
{
|
||||
notifyIcon.Icon = Resources.StaticResources.LoadingIcon;
|
||||
load.Tick += Load_Tick;
|
||||
load.Interval = 15;
|
||||
notifyIcon.Text = Translator.GetText("SystemTrayMenu");
|
||||
notifyIcon.Visible = true;
|
||||
notifyIcon.Icon = Config.GetAppIcon();
|
||||
notifyIcon.Visible = true;
|
||||
|
||||
AppContextMenu contextMenus = new();
|
||||
|
||||
|
@ -55,19 +50,16 @@ namespace SystemTrayMenu.UserInterface
|
|||
{
|
||||
notifyIcon.Icon = null;
|
||||
notifyIcon.Dispose();
|
||||
load.Dispose();
|
||||
}
|
||||
|
||||
public void LoadingStart()
|
||||
{
|
||||
threadsLoading = true;
|
||||
load.Start();
|
||||
notifyIcon.Icon = Resources.StaticResources.LoadingIcon;
|
||||
}
|
||||
|
||||
public void LoadingStop()
|
||||
{
|
||||
Cursor.Current = Cursors.Default;
|
||||
threadsLoading = false;
|
||||
notifyIcon.Icon = Config.GetAppIcon();
|
||||
}
|
||||
|
||||
private void VerifyClick(MouseEventArgs e)
|
||||
|
@ -77,26 +69,5 @@ namespace SystemTrayMenu.UserInterface
|
|||
Click?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private void Load_Tick(object sender, EventArgs e)
|
||||
{
|
||||
if (threadsLoading)
|
||||
{
|
||||
notifyIcon.Icon = Resources.StaticResources.LoadingIcon;
|
||||
|
||||
// see #361, rotating icon caused rare GDI+ exception at GetHicon
|
||||
// rotationAngle += 5;
|
||||
// using Bitmap bitmapLoading = Resources.StaticResources.LoadingIcon.ToBitmap();
|
||||
// using Bitmap bitmapLoadingRotated = new(ImagingHelper.RotateImage(bitmapLoading, rotationAngle));
|
||||
// IntPtr hIcon = bitmapLoadingRotated.GetHicon();
|
||||
// notifyIcon.Icon = (Icon)Icon.FromHandle(hIcon).Clone();
|
||||
// DllImports.NativeMethods.User32DestroyIcon(hIcon);
|
||||
}
|
||||
else
|
||||
{
|
||||
notifyIcon.Icon = Config.GetAppIcon();
|
||||
load.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -569,21 +569,16 @@ namespace SystemTrayMenu.UserInterface
|
|||
}
|
||||
}
|
||||
|
||||
internal void KeyPressedSearch(string letter)
|
||||
{
|
||||
textBoxSearch.Text += letter;
|
||||
textBoxSearch.SelectionStart = textBoxSearch.Text.Length;
|
||||
textBoxSearch.SelectionLength = 0;
|
||||
textBoxSearch.Focus();
|
||||
}
|
||||
|
||||
internal void AdjustScrollbar()
|
||||
{
|
||||
if (dgv.Rows.Count > 0)
|
||||
{
|
||||
customScrollbar.Value = (int)Math.Round(
|
||||
dgv.FirstDisplayedScrollingRowIndex * (decimal)customScrollbar.Maximum / dgv.Rows.Count,
|
||||
0,
|
||||
MidpointRounding.AwayFromZero);
|
||||
}
|
||||
}
|
||||
|
||||
internal void SetCounts(int foldersCount, int filesCount)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue