Index: Application/Application.Ringtoets/App.xaml.cs =================================================================== diff -u -rf2497d09cbac743fec0fefea14188519daeaed4d -rb13a656f78f98541b955433ea4074da47b57f8bc --- Application/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision f2497d09cbac743fec0fefea14188519daeaed4d) +++ Application/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision b13a656f78f98541b955433ea4074da47b57f8bc) @@ -129,8 +129,20 @@ Resources.Add(SystemParameters.MenuPopupAnimationKey, PopupAnimation.None); - gui = new RingtoetsGui + var settings = new GuiCoreSettings { + StartPageUrl = "http://www.helpdeskwater.nl", + SupportEmailAddress = "support@deltaressystems.nl", + SupportPhoneNumber = "+31 (0)88 335 8100", + Copyright = "© Deltares 2015", + LicenseDescription = "Free", + MainWindowTitle = "Ringtoets", + LicenseFilePath = "License.rtf", + ManualFilePath = "Ringtoets_Manual.pdf" + }; + + gui = new RingtoetsGui(settings) + { Plugins = { new ProjectExplorerGuiPlugin(), Index: Application/Application.Ringtoets/app.config =================================================================== diff -u -rcefa4b33b2ee1f5073bc18d6b769ceaf7c727f66 -rb13a656f78f98541b955433ea4074da47b57f8bc --- Application/Application.Ringtoets/app.config (.../app.config) (revision cefa4b33b2ee1f5073bc18d6b769ceaf7c727f66) +++ Application/Application.Ringtoets/app.config (.../app.config) (revision b13a656f78f98541b955433ea4074da47b57f8bc) @@ -14,18 +14,6 @@ - - - - - - - - - - - - Index: Core/Common/src/Core.Common.Base/ApplicationCore.cs =================================================================== diff -u -rcefa4b33b2ee1f5073bc18d6b769ceaf7c727f66 -rb13a656f78f98541b955433ea4074da47b57f8bc --- Core/Common/src/Core.Common.Base/ApplicationCore.cs (.../ApplicationCore.cs) (revision cefa4b33b2ee1f5073bc18d6b769ceaf7c727f66) +++ Core/Common/src/Core.Common.Base/ApplicationCore.cs (.../ApplicationCore.cs) (revision b13a656f78f98541b955433ea4074da47b57f8bc) @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Collections.Specialized; using System.Configuration; using System.Linq; using Core.Common.Base.Workflow; @@ -19,8 +18,6 @@ plugins = new List(); activityRunner = new ActivityRunner(); - Settings = ConfigurationManager.AppSettings; - if (RunningActivityLogAppender.Instance != null) { RunningActivityLogAppender.Instance.ActivityRunner = ActivityRunner; @@ -43,8 +40,6 @@ } } - public NameValueCollection Settings { get; set; } - public IEnumerable FileImporters { get Index: Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj =================================================================== diff -u -r6819809d62f8609b8311b58dfef1b6ddef5701fe -rb13a656f78f98541b955433ea4074da47b57f8bc --- Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision 6819809d62f8609b8311b58dfef1b6ddef5701fe) +++ Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision b13a656f78f98541b955433ea4074da47b57f8bc) @@ -131,6 +131,7 @@ + Index: Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs =================================================================== diff -u -rcefa4b33b2ee1f5073bc18d6b769ceaf7c727f66 -rb13a656f78f98541b955433ea4074da47b57f8bc --- Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision cefa4b33b2ee1f5073bc18d6b769ceaf7c727f66) +++ Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision b13a656f78f98541b955433ea4074da47b57f8bc) @@ -272,7 +272,7 @@ public void ShowStartPage(bool checkUseSettings = true) { - if (!checkUseSettings || Convert.ToBoolean((object) Gui.UserSettings["showStartPage"], CultureInfo.InvariantCulture)) + if (!checkUseSettings || Convert.ToBoolean(Gui.UserSettings["showStartPage"], CultureInfo.InvariantCulture)) { log.Info(Properties.Resources.MainWindow_ShowStartPage_Adding_welcome_page_); OpenStartPage(); @@ -948,7 +948,7 @@ AddRecentlyOpenedProjectsToFileMenu(); SetColorTheme((string) Gui.UserSettings["colorTheme"]); - FileManualButton.IsEnabled = File.Exists(ConfigurationManager.AppSettings["manualFileName"]); + FileManualButton.IsEnabled = File.Exists(Gui.FixedSettings.ManualFilePath); // TODO: Enable as soon as relevant/implemented LicenseButton.IsEnabled = false; @@ -1180,19 +1180,19 @@ private void OnFileHelpLicense_Clicked(object sender, RoutedEventArgs e) { - var licensePageName = ConfigurationManager.AppSettings["licensePageName"]; + var licensePageName = Properties.Resources.MainWindow_LicenseView_Name; + foreach (var view in Gui.DocumentViews.OfType()) { if (view.Text == licensePageName) { Gui.DocumentViews.ActiveView = view; + return; } } - var licensePagePath = ConfigurationManager.AppSettings["licensePagePath"]; - var license = new RichTextView(licensePageName, licensePagePath); - Gui.DocumentViews.Add(license); + Gui.DocumentViews.Add(new RichTextView(licensePageName, Gui.FixedSettings.LicenseFilePath)); } private void OnFileHelpSubmitFeedback_Clicked(object sender, RoutedEventArgs e) @@ -1206,7 +1206,8 @@ private void OnFileManual_Clicked(object sender, RoutedEventArgs e) { - var manualFileName = ConfigurationManager.AppSettings["manualFileName"]; + var manualFileName = Gui.FixedSettings.ManualFilePath; + if (File.Exists(manualFileName)) { Process.Start(manualFileName); @@ -1216,9 +1217,10 @@ private void OpenStartPage() { var welcomePageName = (string) Gui.UserSettings["startPageName"]; - var welcomePageUrl = Gui.ApplicationCore.Settings["startPageUrl"]; + var welcomePageUrl = Gui.FixedSettings.StartPageUrl; var url = new Url(welcomePageName, welcomePageUrl); + Gui.CommandHandler.OpenView(url); } @@ -1291,8 +1293,8 @@ { HasProgress = false, VersionText = SettingsHelper.ApplicationVersion, - CopyrightText = Gui.ApplicationCore.Settings["copyright"], - LicenseText = Gui.ApplicationCore.Settings["license"], + CopyrightText = Gui.FixedSettings.Copyright, + LicenseText = Gui.FixedSettings.LicenseDescription, CompanyText = SettingsHelper.ApplicationCompany, AllowsTransparency = false, WindowStyle = WindowStyle.SingleBorderWindow, Index: Core/Common/src/Core.Common.Gui/GuiCommandHandler.cs =================================================================== diff -u -ra0af742d946a15bead91b315b77086154f1ed15e -rb13a656f78f98541b955433ea4074da47b57f8bc --- Core/Common/src/Core.Common.Gui/GuiCommandHandler.cs (.../GuiCommandHandler.cs) (revision a0af742d946a15bead91b315b77086154f1ed15e) +++ Core/Common/src/Core.Common.Gui/GuiCommandHandler.cs (.../GuiCommandHandler.cs) (revision b13a656f78f98541b955433ea4074da47b57f8bc) @@ -453,22 +453,11 @@ [InvokeRequired] private void RefreshGui() { - var project = gui.Project; - // Set the gui selection to the current project - gui.Selection = project; + gui.Selection = gui.Project; - var mainWindowTitle = gui.ApplicationCore.Settings != null - ? gui.ApplicationCore.Settings["mainWindowTitle"] - : "Ringtoets"; - - if (project == null) - { - gui.MainWindow.Title = string.Format(Resources.GuiCommandHandler_UpdateGui_no_project_opened_0_, mainWindowTitle); - return; - } - - gui.MainWindow.Title = project.Name + " - " + mainWindowTitle; + // Update the window title + gui.UpdateTitle(); } public void UpdateObserver() Index: Core/Common/src/Core.Common.Gui/GuiCoreSettings.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Gui/GuiCoreSettings.cs (revision 0) +++ Core/Common/src/Core.Common.Gui/GuiCoreSettings.cs (revision b13a656f78f98541b955433ea4074da47b57f8bc) @@ -0,0 +1,48 @@ +namespace Core.Common.Gui +{ + /// + /// Container for settings in the graphical user interface. + /// + public class GuiCoreSettings + { + /// + /// The start page url to use in the graphical user interface. + /// + public string StartPageUrl { get; set; } + + /// + /// The support email address to show in the graphical user interface. + /// + public string SupportEmailAddress { get; set; } + + /// + /// The support phone number to show in the graphical user interface. + /// + public string SupportPhoneNumber { get; set; } + + /// + /// The copyright to show in the graphical user interface. + /// + public string Copyright { get; set; } + + /// + /// The license description to show in the graphical user interface. + /// + public string LicenseDescription { get; set; } + + /// + /// The title to show in the main window of the graphical user interface. + /// + public string MainWindowTitle { get; set; } + + /// + /// The path of the license file to use in the graphical interface. + /// + public string LicenseFilePath { get; set; } + + /// + /// The path of the manual file to use in the graphical interface. + /// + public string ManualFilePath { get; set; } + } +} Index: Core/Common/src/Core.Common.Gui/IGui.cs =================================================================== diff -u -rcefa4b33b2ee1f5073bc18d6b769ceaf7c727f66 -rb13a656f78f98541b955433ea4074da47b57f8bc --- Core/Common/src/Core.Common.Gui/IGui.cs (.../IGui.cs) (revision cefa4b33b2ee1f5073bc18d6b769ceaf7c727f66) +++ Core/Common/src/Core.Common.Gui/IGui.cs (.../IGui.cs) (revision b13a656f78f98541b955433ea4074da47b57f8bc) @@ -78,8 +78,13 @@ IList Plugins { get; } /// - /// Gets the user settings of the . + /// Gets the fixed settings of the . /// + GuiCoreSettings FixedSettings { get; } + + /// + /// Gets the user specific settings of the . + /// ApplicationSettingsBase UserSettings { get; } /// @@ -123,6 +128,11 @@ /// Path to the project to be opened. void Run(string projectPath); + /// + /// Updates the title of the main window. + /// + void UpdateTitle(); + #endregion #region Events Index: Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs =================================================================== diff -u -r96ade40e5e48006c1969093078e9b43f1b210db3 -rb13a656f78f98541b955433ea4074da47b57f8bc --- Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 96ade40e5e48006c1969093078e9b43f1b210db3) +++ Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision b13a656f78f98541b955433ea4074da47b57f8bc) @@ -1029,15 +1029,6 @@ } /// - /// Looks up a localized string similar to < geen project geopend > - {0}. - /// - public static string GuiCommandHandler_UpdateGui_no_project_opened_0_ { - get { - return ResourceManager.GetString("GuiCommandHandler_UpdateGui_no_project_opened_0_", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Exporteren mislukt.. /// public static string GuiExportHandler_ExporterItemUsingFileOpenDialog_Export_failed { @@ -1230,6 +1221,15 @@ } /// + /// Looks up a localized string similar to Licentie. + /// + public static string MainWindow_LicenseView_Name { + get { + return ResourceManager.GetString("MainWindow_LicenseView_Name", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Hoofdschermvenster is aangemaakt.. /// public static string MainWindow_MainWindow_Main_window_created_ { @@ -1956,6 +1956,15 @@ } /// + /// Looks up a localized string similar to Onbekend. + /// + public static string RingtoetsGui_UpdateTitle_Unknown { + get { + return ResourceManager.GetString("RingtoetsGui_UpdateTitle_Unknown", resourceCulture); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap SaveAllHS { Index: Core/Common/src/Core.Common.Gui/Properties/Resources.resx =================================================================== diff -u -r96ade40e5e48006c1969093078e9b43f1b210db3 -rb13a656f78f98541b955433ea4074da47b57f8bc --- Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision 96ade40e5e48006c1969093078e9b43f1b210db3) +++ Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision b13a656f78f98541b955433ea4074da47b57f8bc) @@ -623,9 +623,6 @@ ..\Resources\OrgChartHS.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - < geen project geopend > - {0} - ..\Resources\brick_link.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -812,4 +809,10 @@ Profielmeting {0} bevat aaneengesloten dubbele geometrie punten, welke zijn genegeerd. + + Onbekend + + + Licentie + \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/RingtoetsGui.cs =================================================================== diff -u -rcefa4b33b2ee1f5073bc18d6b769ceaf7c727f66 -rb13a656f78f98541b955433ea4074da47b57f8bc --- Core/Common/src/Core.Common.Gui/RingtoetsGui.cs (.../RingtoetsGui.cs) (revision cefa4b33b2ee1f5073bc18d6b769ceaf7c727f66) +++ Core/Common/src/Core.Common.Gui/RingtoetsGui.cs (.../RingtoetsGui.cs) (revision b13a656f78f98541b955433ea4074da47b57f8bc) @@ -65,7 +65,7 @@ private bool userSettingsDirty; private ApplicationSettingsBase userSettings; - public RingtoetsGui() + public RingtoetsGui(GuiCoreSettings fixedSettings = null) { // error detection code, make sure we use only a single instance of RingtoetsGui at a time if (instance != null) @@ -74,6 +74,8 @@ throw new InvalidOperationException(Resources.RingtoetsGui_Only_a_single_instance_of_Ringtoets_is_allowed_at_the_same_time_per_process_Make_sure_that_the_previous_instance_was_disposed_correctly_stack_trace + instanceCreationStackTrace); } + FixedSettings = fixedSettings ?? new GuiCoreSettings(); + instance = this; instanceCreationStackTrace = new StackTrace().ToString(); ViewPropertyEditor.Gui = this; @@ -83,8 +85,6 @@ UserSettings = Settings.Default; - applicationCore.Settings = ConfigurationManager.AppSettings; - CommandHandler = new GuiCommandHandler(this); Application.EnableVisualStyles(); @@ -241,6 +241,8 @@ public IList Plugins { get; private set; } + public GuiCoreSettings FixedSettings { get; private set; } + public ApplicationSettingsBase UserSettings { get @@ -736,8 +738,8 @@ splashScreen = new SplashScreen { VersionText = SettingsHelper.ApplicationVersion, - CopyrightText = ApplicationCore.Settings["copyright"], - LicenseText = ApplicationCore.Settings["license"], + CopyrightText = FixedSettings.Copyright, + LicenseText = FixedSettings.LicenseDescription, CompanyText = SettingsHelper.ApplicationCompany }; @@ -836,22 +838,14 @@ log.Info(Resources.RingtoetsGui_InitializeWindows_All_windows_are_created); } - private void UpdateTitle() + public void UpdateTitle() { - //NOTE: DUPLICATED BY GuiCommandHandler::UpdateGui --> todo, remove the duplication - - string mainWindowTitle = ApplicationCore.Settings["mainWindowTitle"]; - - string projectTitle = ""; - if (Project != null) - { - projectTitle = Project.Name; - } - - // TODO: this must be moved to MainWindow which should listen to project changes if (mainWindow != null) { - mainWindow.Title = projectTitle + " - " + mainWindowTitle; + mainWindow.Title = string.Format("{0} - {1} {2}", + Project != null ? Project.Name : Resources.RingtoetsGui_UpdateTitle_Unknown, + FixedSettings.MainWindowTitle, + SettingsHelper.ApplicationVersion); } }