diff --git a/Business/Menus.cs b/Business/Menus.cs index 5c7ec66..bba78a8 100644 --- a/Business/Menus.cs +++ b/Business/Menus.cs @@ -123,7 +123,27 @@ namespace SystemTrayMenu.Business menus[rowData.MenuLevel + 1].Tag as RowData != rowData)) { loadingRowData = rowData; - LoadStarted(); + + CreateAndShowLoadingMenu(rowData); + void CreateAndShowLoadingMenu(RowData rowData) + { + MenuData menuDataLoading = new MenuData + { + RowDatas = new List(), + Validity = MenuDataValidity.Valid, + Level = rowData.MenuLevel + 1, + }; + + Menu menuLoading = Create(menuDataLoading, Path.GetFileName(Config.Path)); + menuLoading.IsLoadingMenu = true; + AdjustMenusSizeAndLocation(); + menus[rowData.MenuLevel + 1] = menuLoading; + menuLoading.Tag = menuDataLoading.RowDataParent = rowData; + menuDataLoading.RowDataParent.SubMenu = menuLoading; + menuLoading.SetTypeLoading(); + ShowSubMenu(menuLoading); + } + BackgroundWorker workerSubMenu = workersSubMenu. Where(w => !w.IsBusy).FirstOrDefault(); if (workerSubMenu == null) @@ -142,10 +162,23 @@ namespace SystemTrayMenu.Business void LoadSubMenuCompleted(object senderCompleted, RunWorkerCompletedEventArgs e) { - LoadStopped(); MenuData menuData = (MenuData)e.Result; - if (menus[0].IsUsable && - menuData.Validity != MenuDataValidity.AbortedOrUnknown) + if (menuData.Validity == MenuDataValidity.AbortedOrUnknown) + { + CloseLoadingMenu(); + void CloseLoadingMenu() + { + if (loadingRowData != null) + { + Menu menuLoading = menus[loadingRowData.MenuLevel + 1]; + if (menuLoading != null && menuLoading.IsLoadingMenu) + { + CloseMenu(loadingRowData.MenuLevel + 1); + } + } + } + } + else if (menus[0].IsUsable) { Menu menu = Create(menuData); switch (menuData.Validity) diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index b8269fc..839ca49 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -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.0.19.3")] -[assembly: AssemblyFileVersion("1.0.19.3")] +[assembly: AssemblyVersion("1.0.19.4")] +[assembly: AssemblyFileVersion("1.0.19.4")] diff --git a/Properties/Resources.resx b/Properties/Resources.resx index 7682f88..db9c720 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -199,10 +199,10 @@ ..\Resources\ic_fluent_folder_arrow_right_48_regular.svg;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - ..\Resources\Loading.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\NotFound.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Loading.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/Resources/Loading.ico b/Resources/Loading.ico index f8e5489..11f8349 100644 Binary files a/Resources/Loading.ico and b/Resources/Loading.ico differ diff --git a/Resources/lang.Designer.cs b/Resources/lang.Designer.cs index d23f857..b25ee9e 100644 --- a/Resources/lang.Designer.cs +++ b/Resources/lang.Designer.cs @@ -411,6 +411,15 @@ namespace SystemTrayMenu.Resources { } } + /// + /// Looks up a localized string similar to loading. + /// + internal static string loading { + get { + return ResourceManager.GetString("loading", resourceCulture); + } + } + /// /// Looks up a localized string similar to Log File. /// diff --git a/Resources/lang.cs-CZ.resx b/Resources/lang.cs-CZ.resx index 23384a7..3e87785 100644 --- a/Resources/lang.cs-CZ.resx +++ b/Resources/lang.cs-CZ.resx @@ -336,4 +336,7 @@ Nastavit jako složku SystemTrayMenu + + načítání + \ No newline at end of file diff --git a/Resources/lang.de-DE.resx b/Resources/lang.de-DE.resx index 96bae8f..e485f63 100644 --- a/Resources/lang.de-DE.resx +++ b/Resources/lang.de-DE.resx @@ -336,4 +336,7 @@ Als SystemTrayMenu-Ordner festlegen + + Wird geladen + \ No newline at end of file diff --git a/Resources/lang.es-ES.resx b/Resources/lang.es-ES.resx index 896870c..33f70cf 100644 --- a/Resources/lang.es-ES.resx +++ b/Resources/lang.es-ES.resx @@ -336,4 +336,7 @@ Establecer como carpeta SystemTrayMenu + + cargando + \ No newline at end of file diff --git a/Resources/lang.fr-FR.resx b/Resources/lang.fr-FR.resx index 4ebeaf0..8995355 100644 --- a/Resources/lang.fr-FR.resx +++ b/Resources/lang.fr-FR.resx @@ -336,4 +336,7 @@ Définir comme dossier SystemTrayMenu + + Chargement en cours + \ No newline at end of file diff --git a/Resources/lang.it-IT.resx b/Resources/lang.it-IT.resx index ed4e317..9b8c670 100644 --- a/Resources/lang.it-IT.resx +++ b/Resources/lang.it-IT.resx @@ -336,4 +336,7 @@ Imposta come cartella SystemTrayMenu + + Caricamento in corso + \ No newline at end of file diff --git a/Resources/lang.ja-JP.resx b/Resources/lang.ja-JP.resx index c796dc9..68248fa 100644 --- a/Resources/lang.ja-JP.resx +++ b/Resources/lang.ja-JP.resx @@ -336,4 +336,7 @@ SystemTrayMenuフォルダーとして設定 + + 読み込み中 + \ No newline at end of file diff --git a/Resources/lang.ko-KR.resx b/Resources/lang.ko-KR.resx index ae29b50..866591e 100644 --- a/Resources/lang.ko-KR.resx +++ b/Resources/lang.ko-KR.resx @@ -336,4 +336,7 @@ SystemTrayMenu 폴더로 설정 + + 로딩 + \ No newline at end of file diff --git a/Resources/lang.nl-NL.resx b/Resources/lang.nl-NL.resx index da1f8f5..42dc735 100644 --- a/Resources/lang.nl-NL.resx +++ b/Resources/lang.nl-NL.resx @@ -336,4 +336,7 @@ Instellen als SystemTrayMenu-map + + bezig met laden + \ No newline at end of file diff --git a/Resources/lang.pt-BR.resx b/Resources/lang.pt-BR.resx index 554e54e..81515e3 100644 --- a/Resources/lang.pt-BR.resx +++ b/Resources/lang.pt-BR.resx @@ -336,4 +336,7 @@ Definir como pasta SystemTrayMenu + + Carregando + \ No newline at end of file diff --git a/Resources/lang.resx b/Resources/lang.resx index cc74ef9..84a0d46 100644 --- a/Resources/lang.resx +++ b/Resources/lang.resx @@ -336,4 +336,7 @@ Set as SystemTrayMenu folder + + loading + \ No newline at end of file diff --git a/Resources/lang.ru-RU.resx b/Resources/lang.ru-RU.resx index 60da43b..20ae354 100644 --- a/Resources/lang.ru-RU.resx +++ b/Resources/lang.ru-RU.resx @@ -336,4 +336,7 @@ Установить как папку SystemTrayMenu + + загрузка + \ No newline at end of file diff --git a/Resources/lang.vi-VN.resx b/Resources/lang.vi-VN.resx index 9ac9b51..9866e66 100644 --- a/Resources/lang.vi-VN.resx +++ b/Resources/lang.vi-VN.resx @@ -336,4 +336,7 @@ Đặt làm thư mục SystemTrayMenu + + Đang tải + \ No newline at end of file diff --git a/Resources/lang.zh-CN.resx b/Resources/lang.zh-CN.resx index 2298f94..824f51f 100644 --- a/Resources/lang.zh-CN.resx +++ b/Resources/lang.zh-CN.resx @@ -336,4 +336,7 @@ 设置为 SystemTrayMenu 文件夹 + + 加载 + \ No newline at end of file diff --git a/UserInterface/AppNotifyIcon.cs b/UserInterface/AppNotifyIcon.cs index c807b5b..1ef5afa 100644 --- a/UserInterface/AppNotifyIcon.cs +++ b/UserInterface/AppNotifyIcon.cs @@ -126,7 +126,6 @@ namespace SystemTrayMenu.UserInterface { if (DateTime.Now - timeLoadingStart > new TimeSpan(0, 0, 0, 0, 500)) { - Cursor.Current = Cursors.WaitCursor; notifyIcon.Icon = bitmapsLoading[loadCount++ % indexLoad]; } } diff --git a/UserInterface/Menu.ControlsTheDesignerRemoves.cs b/UserInterface/Menu.ControlsTheDesignerRemoves.cs index 9c3744d..ecc954d 100644 --- a/UserInterface/Menu.ControlsTheDesignerRemoves.cs +++ b/UserInterface/Menu.ControlsTheDesignerRemoves.cs @@ -11,6 +11,8 @@ namespace SystemTrayMenu.UserInterface internal partial class Menu { + public bool IsLoadingMenu { get; internal set; } + private void InitializeComponentControlsTheDesignerRemoves() { DataGridViewCellStyle dataGridViewCellStyle1 = new DataGridViewCellStyle(); diff --git a/UserInterface/Menu.cs b/UserInterface/Menu.cs index 78cdac0..5a945f1 100644 --- a/UserInterface/Menu.cs +++ b/UserInterface/Menu.cs @@ -7,6 +7,7 @@ namespace SystemTrayMenu.UserInterface using System; using System.Data; using System.Drawing; + using System.Drawing.Drawing2D; using System.Globalization; using System.IO; using System.Reflection; @@ -19,10 +20,12 @@ namespace SystemTrayMenu.UserInterface internal partial class Menu : Form { + private static readonly Icon LoadingIcon = Properties.Resources.Loading; private static readonly Icon Search = Properties.Resources.search; private readonly Fading fading = new Fading(); private bool isShowing; private bool directionToRight; + private int rotationAngle; internal Menu() { @@ -178,6 +181,7 @@ namespace SystemTrayMenu.UserInterface Empty, NoAccess, MaxReached, + Loading, } internal enum StartLocation @@ -223,6 +227,11 @@ namespace SystemTrayMenu.UserInterface SetType(MenuType.NoAccess); } + internal void SetTypeLoading() + { + SetType(MenuType.Loading); + } + internal void SetType(MenuType type) { if (type != MenuType.Main) @@ -232,6 +241,8 @@ namespace SystemTrayMenu.UserInterface switch (type) { + case MenuType.Main: + break; case MenuType.Sub: break; case MenuType.Empty: @@ -255,7 +266,18 @@ namespace SystemTrayMenu.UserInterface textBoxSearch.Visible = false; tableLayoutPanelSearch.Visible = false; break; - case MenuType.Main: + case MenuType.Loading: + SetTitle(Translator.GetText("loading")); + pictureBoxSearch.Visible = false; + textBoxSearch.Visible = false; + tableLayoutPanelSearch.Visible = false; + pictureBoxOpenFolder.Visible = false; + pictureBoxMenuAlwaysOpen.Paint -= PictureBoxMenuAlwaysOpen_Paint; + pictureBoxMenuAlwaysOpen.Paint += LoadingMenu_Paint; + timerUpdateIcons.Tick -= TimerUpdateIcons_Tick; + timerUpdateIcons.Tick += TimerUpdateLoadingMenu_Tick; + timerUpdateIcons.Interval = 15; + pictureBoxMenuAlwaysOpen.Visible = true; break; default: break; @@ -769,6 +791,50 @@ namespace SystemTrayMenu.UserInterface } } + private void TimerUpdateLoadingMenu_Tick(object sender, EventArgs e) + { + pictureBoxMenuAlwaysOpen.Invalidate(); + } + + private void LoadingMenu_Paint(object sender, PaintEventArgs e) + { + PictureBox pictureBox = (PictureBox)sender; + rotationAngle = rotationAngle + 5; + e.Graphics.DrawImage( + RotateImage(LoadingIcon.ToBitmap(), rotationAngle), + new Rectangle(Point.Empty, new Size(pictureBox.ClientSize.Width - 2, pictureBox.ClientSize.Height - 2))); + } + + private Image RotateImage(Image img, float rotationAngle) + { + // create an empty Bitmap image + Bitmap bmp = new Bitmap(img.Width, img.Height); + + // turn the Bitmap into a Graphics object + Graphics gfx = Graphics.FromImage(bmp); + + // now we set the rotation point to the center of our image + gfx.TranslateTransform(0.5f + ((float)bmp.Width / 2), 0.5f + ((float)bmp.Height / 2)); + + // now rotate the image + gfx.RotateTransform(rotationAngle); + + gfx.TranslateTransform(0.5f - ((float)bmp.Width / 2), 0.5f - ((float)bmp.Height / 2)); + + // set the InterpolationMode to HighQualityBicubic so to ensure a high + // quality image once it is transformed to the specified size + gfx.InterpolationMode = InterpolationMode.HighQualityBicubic; + + // now draw our new image onto the graphics object + gfx.DrawImage(img, new Point(0, 0)); + + // dispose of our Graphics object + gfx.Dispose(); + + // return the image + return bmp; + } + private void PictureBoxMenuOpenFolder_Paint(object sender, PaintEventArgs e) { PictureBox pictureBox = (PictureBox)sender;