diff --git a/Project/Source/Forms/MainForm/MainForm.Initialize.Menus.cs b/Project/Source/Forms/MainForm/MainForm.Initialize.Menus.cs index 1368cf8ac..99f0d6132 100644 --- a/Project/Source/Forms/MainForm/MainForm.Initialize.Menus.cs +++ b/Project/Source/Forms/MainForm/MainForm.Initialize.Menus.cs @@ -46,6 +46,42 @@ public void CreateSystemInformationMenu() /// public void InitializeSpecialMenus() { + CreateProvidersLinks(); + CommonMenusControl.Instance.ActionViewStats.Enabled = Settings.UsageStatisticsEnabled; + CommonMenusControl.Instance.ActionViewLog.Enabled = DebugManager.TraceEnabled; + ActionWebLinks.Visible = Settings.WebLinksMenuEnabled; + if ( Settings.WebLinksMenuEnabled ) + { + ActionWebLinks.InitializeFromWebLinks(InitializeSpecialMenus); + ActionWebLinks.DuplicateTo(MenuWebLinks); + } + MenuWebLinks.Visible = Settings.WebLinksMenuEnabled; + MenuWebLinks.Enabled = Settings.WebLinksMenuEnabled; + ActionLocalWeather.Visible = Settings.WeatherMenuItemsEnabled; + ActionOnlineWeather.Visible = Settings.WeatherMenuItemsEnabled; + SeparatorMenuWeather.Visible = Settings.WeatherMenuItemsEnabled; + ActionWebLinks.Enabled = Settings.WebLinksMenuEnabled; + ActionLocalWeather.Enabled = Settings.WeatherMenuItemsEnabled; + ActionOnlineWeather.Enabled = Settings.WeatherMenuItemsEnabled; + SeparatorMenuWeather.Enabled = Settings.WeatherMenuItemsEnabled; + var isVisible = Settings.WeatherMenuItemsEnabled ? (int?)null : int.MinValue; + ActionLocalWeather.Tag = isVisible; + ActionOnlineWeather.Tag = isVisible; + SeparatorMenuWeather.Tag = isVisible; + ActionTools.DuplicateTo(MenuTools); + ActionInformation.DuplicateTo(MenuInformation); + if ( !Settings.AllowSuspendReminder && ActionEnableReminder.Enabled ) + ActionEnableReminder.PerformClick(); + ActionDisableReminder.Enabled = Settings.AllowSuspendReminder; + MenuDisableReminder.Enabled = Settings.AllowSuspendReminder; + } + + /// + /// Create providers links menu items. + /// + private void CreateProvidersLinks() + { + // Weekly parashah menu ActionStudyOnline.InitializeFromProviders(HebrewGlobals.WebProvidersParashah, (sender, e) => { var menuitem = (ToolStripMenuItem)sender; @@ -55,6 +91,15 @@ public void InitializeSpecialMenus() weekParashah.Factory, weekParashah.Day.HasLinkedParashah); }); + ActionOpenVerseOnline.InitializeFromProviders(HebrewGlobals.WebProvidersBible, (sender, e) => + { + var menuitem = (ToolStripMenuItem)sender; + var weekParashah = ApplicationDatabase.Instance.GetWeeklyParashah(); + if ( weekParashah.Factory == null ) return; + string verse = $"{(int)weekParashah.Factory.Book}.{weekParashah.Factory.VerseBegin}"; + HebrewTools.OpenBibleProvider((string)menuitem.Tag, verse); + }); + // Visual month context menu ContextMenuDayParashahStudy.InitializeFromProviders(HebrewGlobals.WebProvidersParashah, (sender, e) => { var menuitem = (ToolStripMenuItem)sender; @@ -64,14 +109,6 @@ public void InitializeSpecialMenus() weekParashah, ContextMenuDayCurrentEvent.HasLinkedParashah); }); - ActionOpenVerseOnline.InitializeFromProviders(HebrewGlobals.WebProvidersBible, (sender, e) => - { - var menuitem = (ToolStripMenuItem)sender; - var weekParashah = ApplicationDatabase.Instance.GetWeeklyParashah(); - if ( weekParashah.Factory == null ) return; - string verse = $"{(int)weekParashah.Factory.Book}.{weekParashah.Factory.VerseBegin}"; - HebrewTools.OpenBibleProvider((string)menuitem.Tag, verse); - }); ContextMenuDayParashahRead.InitializeFromProviders(HebrewGlobals.WebProvidersBible, (sender, e) => { var menuitem = (ToolStripMenuItem)sender; @@ -80,33 +117,6 @@ public void InitializeSpecialMenus() string verse = $"{(int)weekParashah.Book}.{weekParashah.VerseBegin}"; HebrewTools.OpenBibleProvider((string)menuitem.Tag, verse); }); - CommonMenusControl.Instance.ActionViewStats.Enabled = Settings.UsageStatisticsEnabled; - CommonMenusControl.Instance.ActionViewLog.Enabled = DebugManager.TraceEnabled; - ActionWebLinks.Visible = Settings.WebLinksMenuEnabled; - ActionLocalWeather.Visible = Settings.WeatherMenuItemsEnabled; - ActionOnlineWeather.Visible = Settings.WeatherMenuItemsEnabled; - SeparatorMenuWeather.Visible = Settings.WeatherMenuItemsEnabled; - ActionWebLinks.Enabled = Settings.WebLinksMenuEnabled; - ActionLocalWeather.Enabled = Settings.WeatherMenuItemsEnabled; - ActionOnlineWeather.Enabled = Settings.WeatherMenuItemsEnabled; - SeparatorMenuWeather.Enabled = Settings.WeatherMenuItemsEnabled; - var isVisible = Settings.WeatherMenuItemsEnabled ? (int?)null : int.MinValue; - ActionLocalWeather.Tag = isVisible; - ActionOnlineWeather.Tag = isVisible; - SeparatorMenuWeather.Tag = isVisible; - MenuWebLinks.Visible = Settings.WebLinksMenuEnabled; - MenuWebLinks.Enabled = Settings.WebLinksMenuEnabled; - if ( Settings.WebLinksMenuEnabled ) - { - ActionWebLinks.InitializeFromWebLinks(InitializeSpecialMenus); - ActionWebLinks.DuplicateTo(MenuWebLinks); - } - ActionTools.DuplicateTo(MenuTools); - ActionInformation.DuplicateTo(MenuInformation); - if ( !Settings.AllowSuspendReminder && ActionEnableReminder.Enabled ) - ActionEnableReminder.PerformClick(); - ActionDisableReminder.Enabled = Settings.AllowSuspendReminder; - MenuDisableReminder.Enabled = Settings.AllowSuspendReminder; } } diff --git a/Project/Source/Program/Program.cs b/Project/Source/Program/Program.cs index 1009a1da0..ba1a4b0e2 100644 --- a/Project/Source/Program/Program.cs +++ b/Project/Source/Program/Program.cs @@ -319,6 +319,7 @@ void update(Form form) }); } MainForm.Instance.CalendarMonth._btnToday.ButtonText = AppTranslations.Today.GetLang(); + task?.Wait(); MainForm.Instance.CreateSystemInformationMenu(); } catch ( Exception ex ) @@ -327,7 +328,6 @@ void update(Form form) } finally { - task?.Wait(); Globals.ChronoTranslate.Stop(); Settings.BenchmarkTranslate = Globals.ChronoTranslate.ElapsedMilliseconds; }