[Feature] Search all throughout the subfolders (#211, #232), version 1.0.25.8

This commit is contained in:
Markus Hofknecht 2021-11-13 08:18:33 +01:00
parent ec7a2467f1
commit fd554ec7ea
8 changed files with 2070 additions and 96 deletions

View file

@ -75,13 +75,26 @@ namespace SystemTrayMenu.Business
switch (menuData.Validity) switch (menuData.Validity)
{ {
case MenuDataValidity.Valid: case MenuDataValidity.Valid:
if (!Properties.Settings.Default.CacheMainMenu) if (Properties.Settings.Default.CacheMainMenu)
{
if (IconReader.MainPreload)
{
workerMainMenu.DoWork -= LoadMenu;
menus[0] = Create(menuData, Path.GetFileName(Config.Path));
IconReader.MainPreload = false;
}
else
{
AsEnumerable.ToList().ForEach(m => { m.ShowWithFade(); });
}
}
else
{ {
DisposeMenu(menus[menuData.Level]); DisposeMenu(menus[menuData.Level]);
menus[0] = Create(menuData, Path.GetFileName(Config.Path)); menus[0] = Create(menuData, Path.GetFileName(Config.Path));
AsEnumerable.ToList().ForEach(m => { m.ShowWithFade(); });
} }
AsEnumerable.ToList().ForEach(m => { m.ShowWithFade(); });
break; break;
case MenuDataValidity.Empty: case MenuDataValidity.Empty:
if (!showingMessageBox) if (!showingMessageBox)
@ -591,28 +604,25 @@ namespace SystemTrayMenu.Business
internal void MainPreload() internal void MainPreload()
{ {
IconReader.SingleThread = true; IconReader.MainPreload = true;
LoadStarted();
menus[0] = Create(
GetData(workerMainMenu, Config.Path, 0),
Path.GetFileName(Config.Path));
IconReader.SingleThread = false;
AdjustMenusSizeAndLocation();
if (Properties.Settings.Default.CacheMainMenu)
{
workerMainMenu.DoWork -= LoadMenu;
}
else
{
DisposeMenu(menus[0]);
}
LoadStopped();
if (FileUrl.GetDefaultBrowserPath(out string browserPath)) if (FileUrl.GetDefaultBrowserPath(out string browserPath))
{ {
IconReader.GetFileIconWithCache(browserPath, true, true, out _); IconReader.GetFileIconWithCache(browserPath, true, true, out _);
} }
timerShowProcessStartedAsLoadingIcon.Tick += Tick;
timerShowProcessStartedAsLoadingIcon.Start();
void Tick(object sender, EventArgs e)
{
timerShowProcessStartedAsLoadingIcon.Tick -= Tick;
SwitchOpenClose(false);
}
if (!Properties.Settings.Default.CacheMainMenu)
{
DisposeMenu(menus[0]);
}
} }
internal void StartWorker() internal void StartWorker()
@ -1080,7 +1090,7 @@ namespace SystemTrayMenu.Business
private void FadeHalfOrOutIfNeeded() private void FadeHalfOrOutIfNeeded()
{ {
if (menus[0].IsUsable) if (menus[0] != null && menus[0].IsUsable)
{ {
if (!IsActive()) if (!IsActive())
{ {

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 // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.25.7")] [assembly: AssemblyVersion("1.0.25.8")]
[assembly: AssemblyFileVersion("1.0.25.7")] [assembly: AssemblyFileVersion("1.0.25.8")]

View file

@ -89,7 +89,6 @@ namespace SystemTrayMenu.UserInterface
{ {
threadsLoading = true; threadsLoading = true;
load.Start(); load.Start();
Load_Tick(load, null);
} }
public void LoadingStop() public void LoadingStop()
@ -124,13 +123,13 @@ namespace SystemTrayMenu.UserInterface
notifyIcon.Icon = systemTrayMenu; notifyIcon.Icon = systemTrayMenu;
load.Stop(); load.Stop();
} }
}
private void DisposeIconIfNotDefaultIcon() void DisposeIconIfNotDefaultIcon()
{
if (notifyIcon.Icon.GetHashCode() != systemTrayMenu.GetHashCode())
{ {
notifyIcon.Icon?.Dispose(); if (notifyIcon.Icon.GetHashCode() != systemTrayMenu.GetHashCode())
{
notifyIcon.Icon?.Dispose();
}
} }
} }
} }

View file

@ -149,9 +149,7 @@ namespace SystemTrayMenu.UserInterface.FolderBrowseDialog
public void Dispose() public void Dispose()
{ {
Dispose(true); Dispose(true);
#if DEBUG
GC.SuppressFinalize(this); GC.SuppressFinalize(this);
#endif
} }
protected virtual void Dispose(bool disposing) protected virtual void Dispose(bool disposing)

View file

@ -280,7 +280,7 @@ namespace SystemTrayMenu.UserInterface
try try
{ {
foreach (string pathAndRecursivString in Properties.Settings.Default.PathsAddToMainMenu.Split(@"|")) foreach (string pathAndRecursivString in Settings.Default.PathsAddToMainMenu.Split(@"|"))
{ {
if (string.IsNullOrEmpty(pathAndRecursivString)) if (string.IsNullOrEmpty(pathAndRecursivString))
{ {

View file

@ -36,8 +36,10 @@
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.BackColor = System.Drawing.Color.White; this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(120, 0); this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.ClientSize = new System.Drawing.Size(159, 136);
this.DoubleBuffered = true;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false; this.MaximizeBox = false;
this.Name = "TaskbarForm"; this.Name = "TaskbarForm";

File diff suppressed because it is too large Load diff

View file

@ -37,7 +37,7 @@ namespace SystemTrayMenu.Utilities
} }
// see https://github.com/Hofknecht/SystemTrayMenu/issues/209. // see https://github.com/Hofknecht/SystemTrayMenu/issues/209.
public static bool SingleThread { get; set; } public static bool MainPreload { get; set; }
public static void Dispose() public static void Dispose()
{ {
@ -222,7 +222,7 @@ namespace SystemTrayMenu.Utilities
if (updateIconInBackground) if (updateIconInBackground)
{ {
if (SingleThread) if (MainPreload)
{ {
DictIconCache.GetOrAdd(key, GetFolder); DictIconCache.GetOrAdd(key, GetFolder);
} }