Index: Application/Ringtoets/src/Application.Ringtoets/App.xaml.cs =================================================================== diff -u -r7e20649afed3f6e23febb57c28bfc32fa75fedc6 -r8facffc48a20cd49759e32aea1ecc100047c68a2 --- Application/Ringtoets/src/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision 7e20649afed3f6e23febb57c28bfc32fa75fedc6) +++ Application/Ringtoets/src/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision 8facffc48a20cd49759e32aea1ecc100047c68a2) @@ -48,6 +48,7 @@ using Ringtoets.Integration.Plugin; using Ringtoets.Piping.Plugin; using MessageBox = System.Windows.MessageBox; + #if INCLUDE_DEMOPROJECT using Demo.Ringtoets.GUIs; @@ -143,8 +144,8 @@ var settings = new GuiCoreSettings { StartPageUrl = "http://www.helpdeskwater.nl", - SupportEmailAddress = "support@deltaressystems.nl", - SupportPhoneNumber = "+31 (0)88 335 8100", + SupportEmailAddress = "www.helpdeskwater.nl", + SupportPhoneNumber = "+31 (0)88-797 7102", Copyright = "© Deltares 2016", LicenseDescription = "Gratis", MainWindowTitle = "Ringtoets", Index: Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r8facffc48a20cd49759e32aea1ecc100047c68a2 --- Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision 8facffc48a20cd49759e32aea1ecc100047c68a2) @@ -35,12 +35,10 @@ using System.Windows.Input; using System.Windows.Interop; using System.Windows.Media.Imaging; - using Core.Common.Gui.Commands; using Core.Common.Gui.Forms.MessageWindow; using Core.Common.Gui.Forms.Options; using Core.Common.Gui.Forms.ViewManager; - using Core.Common.Gui.Selection; using Core.Common.Gui.Settings; using Core.Common.Gui.Theme; @@ -104,7 +102,7 @@ private string lastNonContextualTab; private IGui gui; - + /// /// Initializes a new instance of the class. /// @@ -199,10 +197,13 @@ } } - public IntPtr Handle { get + public IntPtr Handle { - return windowInteropHelper.Handle; - } } + get + { + return windowInteropHelper.Handle; + } + } public bool InvokeRequired { @@ -290,32 +291,6 @@ } /// - /// Initializes and shows the property grid tool window. - /// - /// - /// When a gui hasn't been set with . - /// - public void InitPropertiesWindowAndActivate() - { - if (gui == null) - { - throw new InvalidOperationException("Must call 'SetGui(IGui)' before calling 'InitPropertiesWindowAndActivate'."); - } - - if ((propertyGrid == null) || (propertyGrid.IsDisposed)) - { - propertyGrid = new PropertyGridView.PropertyGridView(applicationSelection, gui.PropertyResolver); - } - - propertyGrid.Text = Properties.Resources.Properties_Title; - propertyGrid.Data = propertyGrid.GetObjectProperties(applicationSelection.Selection); - - toolViewController.ToolWindowViews.Add(propertyGrid, ViewLocation.Right | ViewLocation.Bottom); - - toolViewController.ToolWindowViews.ActiveView = propertyGrid; - } - - /// /// Shows the welcome page. /// /// If set to true the user settings determine @@ -408,12 +383,38 @@ messageWindow.Dispose(); messageWindow = null; } - + ribbonCommandHandlers = null; SetGui(null); } + /// + /// Initializes and shows the property grid tool window. + /// + /// + /// When a gui hasn't been set with . + /// + public void InitPropertiesWindowAndActivate() + { + if (gui == null) + { + throw new InvalidOperationException("Must call 'SetGui(IGui)' before calling 'InitPropertiesWindowAndActivate'."); + } + + if ((propertyGrid == null) || (propertyGrid.IsDisposed)) + { + propertyGrid = new PropertyGridView.PropertyGridView(applicationSelection, gui.PropertyResolver); + } + + propertyGrid.Text = Properties.Resources.Properties_Title; + propertyGrid.Data = propertyGrid.GetObjectProperties(applicationSelection.Selection); + + toolViewController.ToolWindowViews.Add(propertyGrid, ViewLocation.Right | ViewLocation.Bottom); + + toolViewController.ToolWindowViews.ActiveView = propertyGrid; + } + public void ValidateItems() { if (gui == null) @@ -470,26 +471,6 @@ Mouse.OverrideCursor = null; } - #region Implementation: ISynchronizeInvoke - - public IAsyncResult BeginInvoke(Delegate method, object[] args) - { - Dispatcher.BeginInvoke(method, args); - return null; - } - - public object EndInvoke(IAsyncResult result) - { - throw new NotImplementedException(); - } - - public object Invoke(Delegate method, object[] args) - { - return Dispatcher.Invoke(method, args); - } - - #endregion - private void ToolWindowViews_CollectionChanged(object sender, NotifyCollectionChangeEventArgs e) { if (e.Action != NotifyCollectionChangeAction.Remove) @@ -608,7 +589,7 @@ private void CommitMruToSettings() { - var mruList = (StringCollection)Properties.Settings.Default["mruList"]; + var mruList = (StringCollection) Properties.Settings.Default["mruList"]; mruList.Clear(); @@ -1132,7 +1113,8 @@ VersionText = SettingsHelper.ApplicationVersion, CopyrightText = settings.FixedSettings.Copyright, LicenseText = settings.FixedSettings.LicenseDescription, - CompanyText = SettingsHelper.ApplicationCompany, + SupportEmail = settings.FixedSettings.SupportEmailAddress, + SupportPhoneNumber = settings.FixedSettings.SupportPhoneNumber, AllowsTransparency = false, WindowStyle = WindowStyle.SingleBorderWindow, Title = Properties.Resources.Ribbon_About, @@ -1153,5 +1135,25 @@ aboutDialog.ShowDialog(); } + + #region Implementation: ISynchronizeInvoke + + public IAsyncResult BeginInvoke(Delegate method, object[] args) + { + Dispatcher.BeginInvoke(method, args); + return null; + } + + public object EndInvoke(IAsyncResult result) + { + throw new NotImplementedException(); + } + + public object Invoke(Delegate method, object[] args) + { + return Dispatcher.Invoke(method, args); + } + + #endregion } } \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/Forms/SplashScreen/SplashScreen.xaml =================================================================== diff -u -rf072ff34ee0274ef9878a187893b6839d72f2b3f -r8facffc48a20cd49759e32aea1ecc100047c68a2 --- Core/Common/src/Core.Common.Gui/Forms/SplashScreen/SplashScreen.xaml (.../SplashScreen.xaml) (revision f072ff34ee0274ef9878a187893b6839d72f2b3f) +++ Core/Common/src/Core.Common.Gui/Forms/SplashScreen/SplashScreen.xaml (.../SplashScreen.xaml) (revision 8facffc48a20cd49759e32aea1ecc100047c68a2) @@ -3,33 +3,61 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Properties="clr-namespace:Core.Common.Gui.Properties" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="Core.Common.Gui.Forms.SplashScreen.SplashScreen" - Width="492px" Height="312px" WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" BorderThickness="0,0,0,0" Foreground="{x:Null}" AllowsTransparency="True" Icon="/Core.Common.Gui;component/Resources/Ringtoets.ico"> - - - - - + WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" BorderThickness="0,0,0,0" Foreground="{x:Null}" AllowsTransparency="True" Icon="/Core.Common.Gui;component/Resources/Ringtoets.ico" SizeToContent="WidthAndHeight"> + + + + + + + + + + + Index: Core/Common/src/Core.Common.Gui/Forms/SplashScreen/SplashScreen.xaml.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -r8facffc48a20cd49759e32aea1ecc100047c68a2 --- Core/Common/src/Core.Common.Gui/Forms/SplashScreen/SplashScreen.xaml.cs (.../SplashScreen.xaml.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Core/Common/src/Core.Common.Gui/Forms/SplashScreen/SplashScreen.xaml.cs (.../SplashScreen.xaml.cs) (revision 8facffc48a20cd49759e32aea1ecc100047c68a2) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.Windows; using System.Windows.Media; @@ -32,11 +33,13 @@ private string progressText; private int progressValuePercent; private string licenseText; - private string companyText; private string copyrightText; private string versionText; private bool hasProgress; + private string supportPhoneNumber; + private string supportEmailAddress; + /// /// Initializes a new instance of the class with a progress /// bar from 0 to 100%. @@ -45,12 +48,11 @@ { InitializeComponent(); - progressBar.Maximum = 100; // classic percentage approach, there is no need for the splash screen to be more precise + ProgressBar.Maximum = 100; // classic percentage approach, there is no need for the splash screen to be more precise HasProgress = true; ProgressValuePercent = 0; ProgressText = ""; - CompanyText = ""; CopyrightText = ""; LicenseText = ""; VersionText = ""; @@ -105,22 +107,6 @@ } /// - /// Registred company to be shown. - /// - public string CompanyText - { - get - { - return companyText; - } - set - { - companyText = value; - InvalidateVisual(); - } - } - - /// /// Type of the license, plain text. /// public string LicenseText @@ -169,6 +155,38 @@ } /// + /// Text for support e-mail. + /// + public string SupportEmail + { + private get + { + return supportEmailAddress; + } + set + { + supportEmailAddress = value; + InvalidateVisual(); + } + } + + /// + /// Text for support phone number. + /// + public string SupportPhoneNumber + { + private get + { + return supportPhoneNumber; + } + set + { + supportPhoneNumber = value; + InvalidateVisual(); + } + } + + /// /// Shuts this instance down. /// public void Shutdown() @@ -181,47 +199,69 @@ { base.OnRender(drawingContext); - if (labelLicense.Content.ToString() != LicenseText) + if (LabelLicense.Content.ToString() != LicenseText) { - labelLicense.Content = LicenseText; + LabelLicense.Content = LicenseText; } - if (labelCompany.Content.ToString() != CompanyText) + if (LabelCopyright.Content.ToString() != CopyrightText) { - labelCompany.Content = CompanyText; + LabelCopyright.Content = CopyrightText; } - if (labelCopyright.Content.ToString() != CopyrightText) + if (LabelVersion.Content.ToString() != VersionText) { - labelCopyright.Content = CopyrightText; + LabelVersion.Content = VersionText; } - if (labelVersion.Content.ToString() != VersionText) - { - labelVersion.Content = VersionText; - } + SetSupportValues(); var progressVisibility = HasProgress ? Visibility.Visible : Visibility.Hidden; - - progressBar.Visibility = progressVisibility; - labelProgressBar.Visibility = progressVisibility; - labelProgressMessage.Visibility = progressVisibility; + ProgressBar.Visibility = progressVisibility; + LabelProgressBar.Visibility = progressVisibility; + LabelProgressMessage.Visibility = progressVisibility; + if (!HasProgress) { return; // no need to update progress related labels below } - if (progressBar.Value != ProgressValuePercent) + if (ProgressBar.Value != ProgressValuePercent) { - progressBar.Value = ProgressValuePercent; - labelProgressBar.Content = string.Format("{0} %", ProgressValuePercent); + ProgressBar.Value = ProgressValuePercent; + LabelProgressBar.Content = string.Format("{0} %", ProgressValuePercent); } - if (labelProgressMessage.Content.ToString() != ProgressText) + if (LabelProgressMessage.Content.ToString() != ProgressText) { - labelProgressMessage.Content = ProgressText; + LabelProgressMessage.Content = ProgressText; } } + + private void SetSupportValues() + { + var supportVisibility = !(String.IsNullOrWhiteSpace(SupportPhoneNumber) && String.IsNullOrWhiteSpace(SupportEmail)) ? Visibility.Visible : Visibility.Collapsed; + + LabelSupportTitle.Visibility = supportVisibility; + LabelSupportPhoneNumberTitle.Visibility = supportVisibility; + LabelSupportPhoneNumber.Visibility = supportVisibility; + LabelSupportEmailAddressTitle.Visibility = supportVisibility; + LabelSupportEmailAddress.Visibility = supportVisibility; + + if (supportVisibility != Visibility.Visible) + { + return; + } + + if (LabelSupportPhoneNumber.Content.ToString() != SupportPhoneNumber) + { + LabelSupportPhoneNumber.Content = SupportPhoneNumber; + } + if (LabelSupportEmailAddress.Content.ToString() != SupportEmail) + { + LabelSupportEmailAddress.Content = SupportEmail; + } + } } } \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs =================================================================== diff -u -r7e20649afed3f6e23febb57c28bfc32fa75fedc6 -r8facffc48a20cd49759e32aea1ecc100047c68a2 --- Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7e20649afed3f6e23febb57c28bfc32fa75fedc6) +++ Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8facffc48a20cd49759e32aea1ecc100047c68a2) @@ -2513,15 +2513,6 @@ } /// - /// Looks up a localized string similar to Bedrijf. - /// - public static string SplashScreen_Company { - get { - return ResourceManager.GetString("SplashScreen_Company", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Copyright. /// public static string SplashScreen_CopyRights { @@ -2558,6 +2549,33 @@ } /// + /// Looks up a localized string similar to Website. + /// + public static string SplashScreen_SupportEmail { + get { + return ResourceManager.GetString("SplashScreen_SupportEmail", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Telefoonnummer. + /// + public static string SplashScreen_SupportPhoneNumber { + get { + return ResourceManager.GetString("SplashScreen_SupportPhoneNumber", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Heeft u vragen of opmerkingen, neem dan contact op met Helpdesk Water.. + /// + public static string SplashScreen_SupportTitle { + get { + return ResourceManager.GetString("SplashScreen_SupportTitle", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Versie. /// public static string SplashScreen_Version { Index: Core/Common/src/Core.Common.Gui/Properties/Resources.resx =================================================================== diff -u -r7e20649afed3f6e23febb57c28bfc32fa75fedc6 -r8facffc48a20cd49759e32aea1ecc100047c68a2 --- Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision 7e20649afed3f6e23febb57c28bfc32fa75fedc6) +++ Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision 8facffc48a20cd49759e32aea1ecc100047c68a2) @@ -445,9 +445,6 @@ ..\Resources\fullscreen.PNG;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - Bedrijf - Annuleer alle activiteiten @@ -958,4 +955,13 @@ Kaart + + Website + + + Telefoonnummer + + + Heeft u vragen of opmerkingen, neem dan contact op met Helpdesk Water. + \ No newline at end of file Index: Core/Common/src/Core.Common.Gui/RingtoetsGui.cs =================================================================== diff -u -rd03f2b52982110a0f804adfefe73f86551c59e62 -r8facffc48a20cd49759e32aea1ecc100047c68a2 --- Core/Common/src/Core.Common.Gui/RingtoetsGui.cs (.../RingtoetsGui.cs) (revision d03f2b52982110a0f804adfefe73f86551c59e62) +++ Core/Common/src/Core.Common.Gui/RingtoetsGui.cs (.../RingtoetsGui.cs) (revision 8facffc48a20cd49759e32aea1ecc100047c68a2) @@ -28,6 +28,7 @@ using System.Diagnostics; using System.Linq; using System.Reflection; +using System.Windows; using Core.Common.Base.Data; using Core.Common.Base.Plugin; using Core.Common.Base.Storage; @@ -39,7 +40,6 @@ using Core.Common.Gui.Forms.MainWindow; using Core.Common.Gui.Forms.MessageWindow; using Core.Common.Gui.Forms.PropertyGridView; -using Core.Common.Gui.Forms.SplashScreen; using Core.Common.Gui.Forms.ViewManager; using Core.Common.Gui.Plugin; using Core.Common.Gui.Properties; @@ -48,12 +48,10 @@ using Core.Common.Utils.Events; using Core.Common.Utils.Extensions; using Core.Common.Utils.Reflection; - using log4net; using log4net.Appender; using log4net.Repository.Hierarchy; - -using Application = System.Windows.Application; +using SplashScreen = Core.Common.Gui.Forms.SplashScreen.SplashScreen; using WindowsApplication = System.Windows.Forms.Application; namespace Core.Common.Gui @@ -113,14 +111,6 @@ public IStoreProject Storage { get; private set; } - private IProjectExplorer ProjectExplorer - { - get - { - return ToolWindowViews.OfType().FirstOrDefault(); - } - } - public void Dispose() { Dispose(true); @@ -156,20 +146,6 @@ MessageWindowLogAppender.Instance.Enabled = true; } - private void InitializeProjectFromPath(string projectPath) - { - var setDefaultProject = string.IsNullOrWhiteSpace(projectPath); - if (!setDefaultProject) - { - setDefaultProject = !storageCommandHandler.OpenExistingProject(projectPath); - } - if (setDefaultProject) - { - log.Info(Resources.RingtoetsGui_Run_Creating_new_project); - Project = new Project(); - } - } - public void Exit() { if (isExiting) @@ -206,6 +182,15 @@ return Plugins.SelectMany(pluginGui => pluginGui.GetTreeNodeInfos()); } + #region Implementation: IContextMenuBuilderProvider + + public IContextMenuBuilder Get(object dataObject, TreeViewControl treeViewControl) + { + return new ContextMenuBuilder(applicationFeatureCommands, exportImportCommandHandler, ViewCommands, dataObject, treeViewControl); + } + + #endregion + protected virtual void Dispose(bool disposing) { if (disposing) @@ -295,7 +280,7 @@ var propertyCacheInfo = reflectTypeDescriptionProviderType.GetField("_propertyCache", BindingFlags.Static | BindingFlags.NonPublic); - var propertyCache = (Hashtable)propertyCacheInfo.GetValue(null); + var propertyCache = (Hashtable) propertyCacheInfo.GetValue(null); if (propertyCache != null) { propertyCache.Clear(); @@ -358,6 +343,28 @@ isAlreadyRunningInstanceOfIGui = false; } + private IProjectExplorer ProjectExplorer + { + get + { + return ToolWindowViews.OfType().FirstOrDefault(); + } + } + + private void InitializeProjectFromPath(string projectPath) + { + var setDefaultProject = string.IsNullOrWhiteSpace(projectPath); + if (!setDefaultProject) + { + setDefaultProject = !storageCommandHandler.OpenExistingProject(projectPath); + } + if (setDefaultProject) + { + log.Info(Resources.RingtoetsGui_Run_Creating_new_project); + Project = new Project(); + } + } + private void DeactivatePlugin(GuiPlugin plugin) { try @@ -401,7 +408,7 @@ private void ConfigureLogging() { // configure logging - var rootLogger = ((Hierarchy)LogManager.GetRepository()).Root; + var rootLogger = ((Hierarchy) LogManager.GetRepository()).Root; if (!rootLogger.Appenders.Cast().Any(a => a is MessageWindowLogAppender)) { @@ -412,7 +419,7 @@ private void RemoveLogging() { - var rootLogger = ((Hierarchy)LogManager.GetRepository()).Root; + var rootLogger = ((Hierarchy) LogManager.GetRepository()).Root; var messageWindowLogAppender = rootLogger.Appenders.Cast().OfType().FirstOrDefault(); if (messageWindowLogAppender != null) { @@ -459,7 +466,6 @@ VersionText = SettingsHelper.ApplicationVersion, CopyrightText = FixedSettings.Copyright, LicenseText = FixedSettings.LicenseDescription, - CompanyText = SettingsHelper.ApplicationCompany }; splashScreen.IsVisibleChanged += delegate @@ -702,8 +708,8 @@ StringCollection defaultViewDataTypes; if (UserSettings["defaultViews"] != null) { - defaultViews = (StringCollection)UserSettings["defaultViews"]; - defaultViewDataTypes = (StringCollection)UserSettings["defaultViewDataTypes"]; + defaultViews = (StringCollection) UserSettings["defaultViews"]; + defaultViewDataTypes = (StringCollection) UserSettings["defaultViewDataTypes"]; } else { @@ -745,15 +751,6 @@ Dispose(false); } - #region Implementation: IContextMenuBuilderProvider - - public IContextMenuBuilder Get(object dataObject, TreeViewControl treeViewControl) - { - return new ContextMenuBuilder(applicationFeatureCommands, exportImportCommandHandler, ViewCommands, dataObject, treeViewControl); - } - - #endregion - #region Implementation: IProjectOwner private Project project; @@ -1001,7 +998,7 @@ } private set { - mainWindow = (MainWindow)value; + mainWindow = (MainWindow) value; mainWindow.SetGui(this); } } Index: Core/Common/test/Core.Common.Gui.Test/Forms/SplashScreen/SplashScreenTest.cs =================================================================== diff -u -r1e9f415cb615bf84526faeecb51f9a70498f9ffc -r8facffc48a20cd49759e32aea1ecc100047c68a2 --- Core/Common/test/Core.Common.Gui.Test/Forms/SplashScreen/SplashScreenTest.cs (.../SplashScreenTest.cs) (revision 1e9f415cb615bf84526faeecb51f9a70498f9ffc) +++ Core/Common/test/Core.Common.Gui.Test/Forms/SplashScreen/SplashScreenTest.cs (.../SplashScreenTest.cs) (revision 8facffc48a20cd49759e32aea1ecc100047c68a2) @@ -1,9 +1,7 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Media; - using NUnit.Framework; - using Application = System.Windows.Forms.Application; namespace Core.Common.Gui.Test.Forms.SplashScreen @@ -13,59 +11,110 @@ { [Test] [RequiresSTA] + public void Shutdown_SlashShown_ShouldBeClosed() + { + // Setup + var screen = new Gui.Forms.SplashScreen.SplashScreen(); + var screenClosedCalled = false; + screen.Closed += (sender, args) => { screenClosedCalled = true; }; + screen.Show(); + + // Call + screen.Shutdown(); + + // Assert + Assert.IsFalse(screen.IsVisible); + Assert.IsTrue(screenClosedCalled); + } + + [Test] + [RequiresSTA] public void ViewProperties_SetNewValues_ShouldSetLabelTextOfUserInterfaceElements() { // Setup - var strCompany = "Cmp1"; - var strCopyright = "Copy1"; - var strLicense = "License1"; - var strVersion = "Version1"; - var strProgressText = "SomeProgress1"; + const string strCopyright = "Copy1"; + const string strLicense = "License1"; + const string strVersion = "Version1"; + const string strProgressText = "SomeProgress1"; + const string supportEmail = ""; + const string supportPhone = ""; // Call var screen = new Gui.Forms.SplashScreen.SplashScreen { - CompanyText = strCompany, CopyrightText = strCopyright, LicenseText = strLicense, VersionText = strVersion, - ProgressText = strProgressText + ProgressText = strProgressText, + SupportEmail = supportEmail, + SupportPhoneNumber = supportPhone }; screen.Show(); // Assert - Assert.AreEqual(strVersion, GetLabelText(screen, "labelVersion")); - Assert.AreEqual(strCompany, GetLabelText(screen, "labelCompany")); - Assert.AreEqual(strLicense, GetLabelText(screen, "labelLicense")); - Assert.AreEqual(strCopyright, GetLabelText(screen, "labelCopyright")); - Assert.AreEqual(strProgressText, GetLabelText(screen, "labelProgressMessage")); + Assert.AreEqual(strVersion, GetLabelText(screen, "LabelVersion")); + Assert.AreEqual(strLicense, GetLabelText(screen, "LabelLicense")); + Assert.AreEqual(strCopyright, GetLabelText(screen, "LabelCopyright")); + Assert.AreEqual(strProgressText, GetLabelText(screen, "LabelProgressMessage")); + Assert.AreEqual(supportEmail, GetLabelText(screen, "LabelSupportEmailAddress")); + Assert.AreEqual(supportPhone, GetLabelText(screen, "LabelSupportPhoneNumber")); + // Teardown screen.Close(); } [Test] + [TestCase(true)] + [TestCase(false)] [RequiresSTA] + public void ViewPropertiesVisibility_SupportValuesSet_SupportValuesShouldBeVisible(bool supportVisible) + { + // Setup + var supportEmail = supportVisible ? "" : string.Empty; + var supportPhone = supportVisible ? "" : string.Empty; + + // Call + var screen = new Gui.Forms.SplashScreen.SplashScreen + { + SupportPhoneNumber = supportPhone, + SupportEmail = supportEmail + }; + screen.Show(); + + // Assert + Assert.AreEqual(supportVisible, GetIsControlVisible(screen, "LabelSupportTitle")); + Assert.AreEqual(supportVisible, GetIsControlVisible(screen, "LabelSupportPhoneNumberTitle")); + Assert.AreEqual(supportVisible, GetIsControlVisible(screen, "LabelSupportPhoneNumber")); + Assert.AreEqual(supportVisible, GetIsControlVisible(screen, "LabelSupportEmailAddressTitle")); + Assert.AreEqual(supportVisible, GetIsControlVisible(screen, "LabelSupportEmailAddress")); + + // Teardown + screen.Close(); + } + + [Test] + [RequiresSTA] public void TestProgressBarVisible() { // Setup var screen = new Gui.Forms.SplashScreen.SplashScreen(); screen.Show(); Assert.IsTrue(screen.HasProgress, "Initially, the progress should be visible"); - Assert.IsTrue(GetIsControlVisible(screen, "progressBar")); - Assert.IsTrue(GetIsControlVisible(screen, "labelProgressMessage")); - Assert.IsTrue(GetIsControlVisible(screen, "labelProgressBar")); + Assert.IsTrue(GetIsControlVisible(screen, "ProgressBar")); + Assert.IsTrue(GetIsControlVisible(screen, "LabelProgressMessage")); + Assert.IsTrue(GetIsControlVisible(screen, "LabelProgressBar")); // Call screen.HasProgress = false; Application.DoEvents(); // creating space for lazy-updating to do its work // Assert Assert.IsFalse(screen.HasProgress, "HasProgress is changed to FALSE by now"); + Assert.IsFalse(GetIsControlVisible(screen, "ProgressBar")); + Assert.IsFalse(GetIsControlVisible(screen, "LabelProgressMessage")); + Assert.IsFalse(GetIsControlVisible(screen, "LabelProgressBar")); - Assert.IsFalse(GetIsControlVisible(screen, "progressBar")); - Assert.IsFalse(GetIsControlVisible(screen, "labelProgressMessage")); - Assert.IsFalse(GetIsControlVisible(screen, "labelProgressBar")); - + // Teardown screen.Close(); } @@ -75,7 +124,7 @@ FrameworkElement foundChild = null; for (var childIndex = 0; childIndex < childrenCount; childIndex++) { - var child = (FrameworkElement)VisualTreeHelper.GetChild(parent, childIndex); + var child = (FrameworkElement) VisualTreeHelper.GetChild(parent, childIndex); foundChild = child.Name == name ? child : FindControlRecursively(child, name); if (foundChild != null)