Index: Application/Ringtoets/src/Application.Ringtoets/App.xaml.cs
===================================================================
diff -u -rd182ae6d1a6590c4b52b17fd1f59c5b7c3780b48 -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Application/Ringtoets/src/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision d182ae6d1a6590c4b52b17fd1f59c5b7c3780b48)
+++ Application/Ringtoets/src/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -119,8 +119,8 @@
LicenseFilePath = "..\\Licentie.rtf",
ManualFilePath = "Ringtoets_Manual.pdf"
};
-
- gui = new RingtoetsGui(applicationCore, settings)
+ var mainWindow = new MainWindow(null);
+ gui = new RingtoetsGui(mainWindow, applicationCore, settings)
{
Plugins =
{
@@ -137,9 +137,6 @@
Storage = new StorageSqLite()
};
- var mainWindow = new MainWindow(gui);
- gui.MainWindow = mainWindow;
-
RunRingtoets();
mainWindow.Show();
Index: Core/Common/src/Core.Common.Gui/ApplicationFeatureCommandHandler.cs
===================================================================
diff -u -re96306bc32984aa50c6d1162167214024ddcf59a -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/src/Core.Common.Gui/ApplicationFeatureCommandHandler.cs (.../ApplicationFeatureCommandHandler.cs) (revision e96306bc32984aa50c6d1162167214024ddcf59a)
+++ Core/Common/src/Core.Common.Gui/ApplicationFeatureCommandHandler.cs (.../ApplicationFeatureCommandHandler.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -4,8 +4,8 @@
using System.Windows.Forms;
using Core.Common.Gui.Forms.MainWindow;
+using Core.Common.Gui.Forms.PropertyGridView;
using Core.Common.Gui.Properties;
-using Core.Common.Utils;
using log4net;
using log4net.Appender;
@@ -16,27 +16,31 @@
///
public class ApplicationFeatureCommandHandler : IApplicationFeatureCommands
{
- private readonly IGui gui;
+ private readonly IPropertyResolver propertyResolver;
+ private readonly IMainWindow mainWindow;
+ private readonly IApplicationSelection applicationSelection;
- public ApplicationFeatureCommandHandler(IGui gui)
+ public ApplicationFeatureCommandHandler(IPropertyResolver propertyResolver, IMainWindow mainWindow, IApplicationSelection applicationSelection)
{
- this.gui = gui;
+ this.propertyResolver = propertyResolver;
+ this.mainWindow = mainWindow;
+ this.applicationSelection = applicationSelection;
}
///
- /// Makes the properties window visible and updates the to the
+ /// Makes the properties window visible and updates the to the
/// given .
///
/// The object for which to show its properties.
public void ShowPropertiesFor(object obj)
{
- ((MainWindow)gui.MainWindow).InitPropertiesWindowAndActivate();
- gui.Selection = obj;
+ ((MainWindow)mainWindow).InitPropertiesWindowAndActivate();
+ applicationSelection.Selection = obj;
}
public bool CanShowPropertiesFor(object obj)
{
- return gui.PropertyResolver.GetObjectProperties(obj) != null;
+ return propertyResolver.GetObjectProperties(obj) != null;
}
public void OpenLogFileExternal()
Index: Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj
===================================================================
diff -u -r98939d3757e99732f74f6345b5eb58c90e30a4d4 -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4)
+++ Core/Common/src/Core.Common.Gui/Core.Common.Gui.csproj (.../Core.Common.Gui.csproj) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -243,7 +243,6 @@
-
Index: Core/Common/src/Core.Common.Gui/ExportImportCommandHandler.cs
===================================================================
diff -u -r3340c93e5fd1ccd9b38c1c88cecbf06f0e3e02d6 -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/src/Core.Common.Gui/ExportImportCommandHandler.cs (.../ExportImportCommandHandler.cs) (revision 3340c93e5fd1ccd9b38c1c88cecbf06f0e3e02d6)
+++ Core/Common/src/Core.Common.Gui/ExportImportCommandHandler.cs (.../ExportImportCommandHandler.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -1,7 +1,9 @@
using System;
using System.Linq;
+using System.Windows.Forms;
using Core.Common.Base.IO;
+using Core.Common.Base.Plugin;
using Core.Common.Gui.Properties;
using log4net;
@@ -15,24 +17,32 @@
{
private static readonly ILog log = LogManager.GetLogger(typeof(ExportImportCommandHandler));
- private readonly IGui gui;
+ private readonly ApplicationCore applicationCore;
+
+ private readonly IDocumentViewController documentViewController;
+
private readonly GuiImportHandler importHandler;
private readonly GuiExportHandler exportHandler;
///
/// Initializes a new instance of the class.
///
- /// The GUI.
- public ExportImportCommandHandler(IGui gui)
+ ///
+ ///
+ ///
+ public ExportImportCommandHandler(IWin32Window dialogParent, ApplicationCore applicationCore, IDocumentViewController documentViewController)
{
- this.gui = gui;
- importHandler = CreateGuiImportHandler(this.gui);
- exportHandler = CreateGuiExportHandler(this.gui);
+ this.applicationCore = applicationCore;
+ this.documentViewController = documentViewController;
+ importHandler = new GuiImportHandler(dialogParent, this.applicationCore);
+ exportHandler = new GuiExportHandler(dialogParent,
+ o => this.applicationCore.GetSupportedFileExporters(o),
+ o => this.documentViewController.DocumentViewsResolver.CreateViewForData(o));
}
public bool CanImportOn(object obj)
{
- return gui.ApplicationCore.GetSupportedFileImporters(obj).Any();
+ return applicationCore.GetSupportedFileImporters(obj).Any();
}
public void ImportOn(object target, IFileImporter importer = null)
@@ -56,7 +66,7 @@
public bool CanExportFrom(object obj)
{
- return gui.ApplicationCore.GetSupportedFileExporters(obj).Any();
+ return applicationCore.GetSupportedFileExporters(obj).Any();
}
public void ExportFrom(object data, IFileExporter exporter = null)
@@ -70,15 +80,5 @@
exportHandler.GetExporterDialog(exporter, data);
}
}
-
- private static GuiImportHandler CreateGuiImportHandler(IGui gui)
- {
- return new GuiImportHandler(gui);
- }
-
- private static GuiExportHandler CreateGuiExportHandler(IGui gui)
- {
- return new GuiExportHandler(gui.MainWindow, o => gui.ApplicationCore.GetSupportedFileExporters(o), o => gui.DocumentViewsResolver.CreateViewForData(o));
- }
}
}
\ No newline at end of file
Index: Core/Common/src/Core.Common.Gui/Forms/IRibbonCommandHandler.cs
===================================================================
diff -u -r42ca97fdb85a553c6aac3bfdfe57c7be4af90821 -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/src/Core.Common.Gui/Forms/IRibbonCommandHandler.cs (.../IRibbonCommandHandler.cs) (revision 42ca97fdb85a553c6aac3bfdfe57c7be4af90821)
+++ Core/Common/src/Core.Common.Gui/Forms/IRibbonCommandHandler.cs (.../IRibbonCommandHandler.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -10,7 +10,7 @@
public interface IRibbonCommandHandler
{
///
- /// Call this action in the implementation when command needs to be handled in the graphical user interface.
+ /// Returns all commands provided by this command handler.
///
IEnumerable Commands { get; }
Index: Core/Common/src/Core.Common.Gui/Forms/MainWindow/IMainWindow.cs
===================================================================
diff -u -rc182637ac2a2d3edf48d2c204259898e84e365b5 -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/src/Core.Common.Gui/Forms/MainWindow/IMainWindow.cs (.../IMainWindow.cs) (revision c182637ac2a2d3edf48d2c204259898e84e365b5)
+++ Core/Common/src/Core.Common.Gui/Forms/MainWindow/IMainWindow.cs (.../IMainWindow.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -9,11 +9,6 @@
public interface IMainWindow : IWin32Window
{
///
- /// Project explorer tool window. See also .
- ///
- IProjectExplorer ProjectExplorer { get; }
-
- ///
/// Property grid tool window. See also .
///
IPropertyGrid PropertyGrid { get; }
Index: Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs
===================================================================
diff -u -rf9058d5293ecb785069c5b6b4c554dc6800ee771 -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision f9058d5293ecb785069c5b6b4c554dc6800ee771)
+++ Core/Common/src/Core.Common.Gui/Forms/MainWindow/MainWindow.xaml.cs (.../MainWindow.xaml.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -33,26 +33,29 @@
using Xceed.Wpf.AvalonDock.Themes;
using Button = Fluent.Button;
using Cursors = System.Windows.Input.Cursors;
-using IWin32Window = System.Windows.Forms.IWin32Window;
using WindowsFormApplication = System.Windows.Forms.Application;
namespace Core.Common.Gui.Forms.MainWindow
{
///
/// Main windows of Ringtoets
///
- public partial class MainWindow : IMainWindow, IDisposable, IWin32Window, ISynchronizeInvoke
+ public partial class MainWindow : IMainWindow, IDisposable, ISynchronizeInvoke
{
private const string dockingLayoutFileName = "WindowLayout_normal.xml";
private static readonly ILog log = LogManager.GetLogger(typeof(MainWindow));
- private static Form synchronizationForm;
-
///
/// Remember last active contextual tab per view.
///
private readonly IDictionary lastActiveContextTabNamePerViewType = new Dictionary();
+ private IToolViewController toolViewController;
+ private IDocumentViewController documentViewController;
+ private ICommandsOwner commands;
+ private ISettingsOwner settings;
+ private IApplicationSelection applicationSelection;
+
private bool resetDefaultLayout;
private MessageWindow.MessageWindow messageWindow;
@@ -71,6 +74,8 @@
///
private string lastNonContextualTab;
+ private IGui gui;
+
public MainWindow(IGui gui)
{
Gui = gui;
@@ -81,8 +86,24 @@
log.Info(Properties.Resources.MainWindow_MainWindow_Main_window_created_);
}
- public IGui Gui { get; set; }
+ public IGui Gui
+ {
+ get
+ {
+ return gui;
+ }
+ set
+ {
+ gui = value;
+ toolViewController = gui;
+ documentViewController = gui;
+ settings = gui;
+ commands = gui;
+ applicationSelection = gui;
+ }
+ }
+
public bool IsWindowDisposed { get; private set; }
public bool Enabled
@@ -155,14 +176,6 @@
}
}
- public IProjectExplorer ProjectExplorer
- {
- get
- {
- return Gui.ToolWindowViews.OfType().FirstOrDefault();
- }
- }
-
public IPropertyGrid PropertyGrid
{
get
@@ -189,22 +202,28 @@
public void SubscribeToGui()
{
- if (Gui != null)
+ if (toolViewController != null && toolViewController.ToolWindowViews != null)
{
- Gui.ToolWindowViews.CollectionChanged += ToolWindowViews_CollectionChanged;
- Gui.DocumentViews.ActiveViewChanged += DocumentViewsOnActiveViewChanged;
- Gui.DocumentViews.ActiveViewChanging += DocumentViewsOnActiveViewChanging;
+ toolViewController.ToolWindowViews.CollectionChanged += ToolWindowViews_CollectionChanged;
}
+ if (documentViewController != null && documentViewController.DocumentViews != null)
+ {
+ documentViewController.DocumentViews.ActiveViewChanged += DocumentViewsOnActiveViewChanged;
+ documentViewController.DocumentViews.ActiveViewChanging += DocumentViewsOnActiveViewChanging;
+ }
}
public void UnsubscribeFromGui()
{
- if (Gui != null)
+ if (toolViewController != null && toolViewController.ToolWindowViews != null)
{
- Gui.ToolWindowViews.CollectionChanged -= ToolWindowViews_CollectionChanged;
- Gui.DocumentViews.ActiveViewChanged -= DocumentViewsOnActiveViewChanged;
- Gui.DocumentViews.ActiveViewChanging -= DocumentViewsOnActiveViewChanging;
+ toolViewController.ToolWindowViews.CollectionChanged -= ToolWindowViews_CollectionChanged;
}
+ if (documentViewController != null && documentViewController.DocumentViews != null)
+ {
+ documentViewController.DocumentViews.ActiveViewChanged -= DocumentViewsOnActiveViewChanged;
+ documentViewController.DocumentViews.ActiveViewChanging -= DocumentViewsOnActiveViewChanging;
+ }
}
public void LoadLayout()
@@ -233,21 +252,21 @@
{
if ((propertyGrid == null) || (propertyGrid.IsDisposed))
{
- propertyGrid = new PropertyGridView.PropertyGridView(Gui, Gui);
+ propertyGrid = new PropertyGridView.PropertyGridView(applicationSelection, Gui.PropertyResolver);
}
propertyGrid.Text = Properties.Resources.Properties_Title;
- propertyGrid.Data = propertyGrid.GetObjectProperties(Gui.Selection);
+ propertyGrid.Data = propertyGrid.GetObjectProperties(applicationSelection.Selection);
- Gui.ToolWindowViews.Add(propertyGrid, ViewLocation.Right | ViewLocation.Bottom);
+ toolViewController.ToolWindowViews.Add(propertyGrid, ViewLocation.Right | ViewLocation.Bottom);
- Gui.ToolWindowViews.ActiveView = null;
- Gui.ToolWindowViews.ActiveView = Gui.MainWindow.PropertyGrid;
+ toolViewController.ToolWindowViews.ActiveView = null;
+ toolViewController.ToolWindowViews.ActiveView = propertyGrid;
}
public void ShowStartPage(bool checkUseSettings = true)
{
- if (!checkUseSettings || Convert.ToBoolean(Gui.UserSettings["showStartPage"], CultureInfo.InvariantCulture))
+ if (!checkUseSettings || Convert.ToBoolean(settings.UserSettings["showStartPage"], CultureInfo.InvariantCulture))
{
log.Info(Properties.Resources.MainWindow_ShowStartPage_Adding_welcome_page_);
OpenStartPage();
@@ -338,19 +357,22 @@
// I pulled this code from some internet sources combined with the reflector to remove a well-known leak
var handlers = typeof(SystemEvents).GetField("_handlers", BindingFlags.Static | BindingFlags.NonPublic)
.GetValue(null);
- var upcHandler = typeof(SystemEvents).GetField("OnUserPreferenceChangedEvent", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null);
- var eventLockObject = typeof(SystemEvents).GetField("eventLockObject", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null);
-
- lock (eventLockObject)
+ if (handlers != null)
{
- var upcHandlerList = (IList) ((IDictionary) handlers)[upcHandler];
- for (int i = upcHandlerList.Count - 1; i >= 0; i--)
+ var upcHandler = typeof(SystemEvents).GetField("OnUserPreferenceChangedEvent", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null);
+ var eventLockObject = typeof(SystemEvents).GetField("eventLockObject", BindingFlags.NonPublic | BindingFlags.Static).GetValue(null);
+
+ lock (eventLockObject)
{
- var target = (Delegate) upcHandlerList[i].GetType().GetField("_delegate", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(upcHandlerList[i]);
- upcHandlerList.RemoveAt(i);
+ var upcHandlerList = (IList)((IDictionary)handlers)[upcHandler];
+ for (int i = upcHandlerList.Count - 1; i >= 0; i--)
+ {
+ var target = (Delegate)upcHandlerList[i].GetType().GetField("_delegate", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(upcHandlerList[i]);
+ upcHandlerList.RemoveAt(i);
+ }
}
}
-
+
ribbonCommandHandlers = null;
windowInteropHelper = null;
@@ -528,7 +550,7 @@
{
try
{
- Gui.StorageCommands.OpenExistingProject(path);
+ commands.StorageCommands.OpenExistingProject(path);
RecentProjectsTabControl.Items.Remove(newItem);
RecentProjectsTabControl.Items.Insert(1, newItem);
}
@@ -581,10 +603,10 @@
private void ValidateMainWindowRibbonItems()
{
- if (Gui.ToolWindowViews != null)
+ if (toolViewController.ToolWindowViews != null)
{
- ButtonShowMessages.IsChecked = Gui.ToolWindowViews.Contains(MessageWindow);
- ButtonShowProperties.IsChecked = Gui.ToolWindowViews.Contains(PropertyGrid);
+ ButtonShowMessages.IsChecked = toolViewController.ToolWindowViews.Contains(MessageWindow);
+ ButtonShowProperties.IsChecked = toolViewController.ToolWindowViews.Contains(PropertyGrid);
}
}
@@ -598,29 +620,29 @@
};
}
- if (Gui == null || Gui.ToolWindowViews == null)
+ if (toolViewController.ToolWindowViews == null)
{
return;
}
- if (Gui.ToolWindowViews.Contains(messageWindow))
+ if (toolViewController.ToolWindowViews.Contains(messageWindow))
{
- Gui.ToolWindowViews.ActiveView = messageWindow;
+ toolViewController.ToolWindowViews.ActiveView = messageWindow;
return;
}
- Gui.ToolWindowViews.Add(messageWindow, ViewLocation.Bottom);
+ toolViewController.ToolWindowViews.Add(messageWindow, ViewLocation.Bottom);
}
private void OnFileSaveClicked(object sender, RoutedEventArgs e)
{
- var saveProject = Gui.StorageCommands.SaveProject();
+ var saveProject = commands.StorageCommands.SaveProject();
OnAfterProjectSaveOrOpen(saveProject);
}
private void OnFileSaveAsClicked(object sender, RoutedEventArgs e)
{
- var saveProject = Gui.StorageCommands.SaveProjectAs();
+ var saveProject = commands.StorageCommands.SaveProjectAs();
OnAfterProjectSaveOrOpen(saveProject);
}
@@ -641,14 +663,14 @@
private void OnFileOpenClicked(object sender, RoutedEventArgs e)
{
- var succesful = Gui.StorageCommands.OpenExistingProject();
+ var succesful = commands.StorageCommands.OpenExistingProject();
OnAfterProjectSaveOrOpen(succesful);
}
private void OnFileNewClicked(object sender, RoutedEventArgs e)
{
// Original code:
- Gui.StorageCommands.CreateNewProject();
+ commands.StorageCommands.CreateNewProject();
ValidateItems();
}
@@ -799,11 +821,11 @@
{
AddRecentlyOpenedProjectsToFileMenu();
- SetColorTheme((ColorTheme) Gui.UserSettings["colorTheme"]);
+ SetColorTheme((ColorTheme) settings.UserSettings["colorTheme"]);
- FileManualButton.IsEnabled = File.Exists(Gui.FixedSettings.ManualFilePath);
+ FileManualButton.IsEnabled = File.Exists(settings.FixedSettings.ManualFilePath);
- LicenseButton.IsEnabled = File.Exists(Gui.FixedSettings.LicenseFilePath);
+ LicenseButton.IsEnabled = File.Exists(settings.FixedSettings.LicenseFilePath);
FeedbackButton.IsEnabled = false;
ButtonQuickAccessOpenProject.IsEnabled = ButtonMenuFileOpenProject.IsEnabled;
@@ -921,27 +943,15 @@
}
}
}
-
- foreach (var ribbonExtension in ribbonCommandHandlers)
- {
- foreach (var command in ribbonExtension.Commands)
- {
- var guiCommand = command as IGuiCommand;
- if (guiCommand != null)
- {
- guiCommand.Gui = Gui;
- }
- }
- }
}
private void OnFileOptionsClicked(object sender, RoutedEventArgs e)
{
- using (var optionsDialog = new OptionsDialog(this, Gui.UserSettings))
+ using (var optionsDialog = new OptionsDialog(this, settings.UserSettings))
{
if (optionsDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
- SetColorTheme((ColorTheme) Gui.UserSettings["colorTheme"]);
+ SetColorTheme((ColorTheme) settings.UserSettings["colorTheme"]);
}
}
}
@@ -973,16 +983,16 @@
DockingManager.Theme = new GenericTheme();
}
- Gui.UserSettings["colorTheme"] = colorTheme;
+ settings.UserSettings["colorTheme"] = colorTheme;
}
private void ButtonShowProperties_Click(object sender, RoutedEventArgs e)
{
- var active = Gui.ToolWindowViews.Contains(PropertyGrid);
+ var active = toolViewController.ToolWindowViews.Contains(PropertyGrid);
if (active)
{
- Gui.ToolWindowViews.Remove(PropertyGrid);
+ toolViewController.ToolWindowViews.Remove(PropertyGrid);
ButtonShowProperties.IsChecked = false;
}
else
@@ -994,11 +1004,11 @@
private void ButtonShowMessages_Click(object sender, RoutedEventArgs e)
{
- var active = Gui.ToolWindowViews.Contains(MessageWindow);
+ var active = toolViewController.ToolWindowViews.Contains(MessageWindow);
if (active)
{
- Gui.ToolWindowViews.Remove(MessageWindow);
+ toolViewController.ToolWindowViews.Remove(MessageWindow);
ButtonShowMessages.IsChecked = false;
}
else
@@ -1017,33 +1027,33 @@
{
var licensePageName = Properties.Resources.MainWindow_LicenseView_Name;
- foreach (var view in Gui.DocumentViews.OfType())
+ foreach (var view in documentViewController.DocumentViews.OfType())
{
if (view.Text == licensePageName)
{
- Gui.DocumentViews.ActiveView = view;
+ documentViewController.DocumentViews.ActiveView = view;
return;
}
}
- Gui.DocumentViewsResolver.OpenViewForData(new RichTextFile
+ documentViewController.DocumentViewsResolver.OpenViewForData(new RichTextFile
{
Name = licensePageName,
- FilePath = Gui.FixedSettings.LicenseFilePath
+ FilePath = settings.FixedSettings.LicenseFilePath
});
}
private void OnFileHelpSubmitFeedback_Clicked(object sender, RoutedEventArgs e) {}
private void OnFileHelpShowLog_Clicked(object sender, RoutedEventArgs e)
{
- Gui.ApplicationCommands.OpenLogFileExternal();
+ commands.ApplicationCommands.OpenLogFileExternal();
}
private void OnFileManual_Clicked(object sender, RoutedEventArgs e)
{
- var manualFileName = Gui.FixedSettings.ManualFilePath;
+ var manualFileName = settings.FixedSettings.ManualFilePath;
if (File.Exists(manualFileName))
{
@@ -1053,16 +1063,16 @@
private void OpenStartPage()
{
- var welcomePageName = (string) Gui.UserSettings["startPageName"];
- var welcomePageUrl = Gui.FixedSettings.StartPageUrl;
+ var welcomePageName = (string) settings.UserSettings["startPageName"];
+ var welcomePageUrl = settings.FixedSettings.StartPageUrl;
if (string.IsNullOrEmpty(welcomePageUrl))
{
welcomePageUrl = "about:blank";
}
var url = new WebLink(welcomePageName, new Uri(welcomePageUrl));
- Gui.ViewCommands.OpenView(url);
+ commands.ViewCommands.OpenView(url);
}
private void CloseContent(LayoutContent c)
@@ -1072,12 +1082,12 @@
private void CloseDocumentTab(object sender, ExecutedRoutedEventArgs e)
{
- Gui.DocumentViews.Remove(Gui.DocumentViews.ActiveView);
+ documentViewController.DocumentViews.Remove(documentViewController.DocumentViews.ActiveView);
}
private void CanCloseDocumentTab(object sender, CanExecuteRoutedEventArgs e)
{
- e.CanExecute = Gui.DocumentViews.Any();
+ e.CanExecute = documentViewController.DocumentViews.Any();
}
private void ButtonResetUILayout_Click(object sender, RoutedEventArgs e)
@@ -1091,8 +1101,8 @@
{
HasProgress = false,
VersionText = SettingsHelper.ApplicationVersion,
- CopyrightText = Gui.FixedSettings.Copyright,
- LicenseText = Gui.FixedSettings.LicenseDescription,
+ CopyrightText = settings.FixedSettings.Copyright,
+ LicenseText = settings.FixedSettings.LicenseDescription,
CompanyText = SettingsHelper.ApplicationCompany,
AllowsTransparency = false,
WindowStyle = WindowStyle.SingleBorderWindow,
Index: Core/Common/src/Core.Common.Gui/Forms/PropertyGridView/PropertyGridView.cs
===================================================================
diff -u -rf9058d5293ecb785069c5b6b4c554dc6800ee771 -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/src/Core.Common.Gui/Forms/PropertyGridView/PropertyGridView.cs (.../PropertyGridView.cs) (revision f9058d5293ecb785069c5b6b4c554dc6800ee771)
+++ Core/Common/src/Core.Common.Gui/Forms/PropertyGridView/PropertyGridView.cs (.../PropertyGridView.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -5,7 +5,6 @@
using System.Security.Permissions;
using System.Windows.Forms;
using Core.Common.Base;
-using Core.Common.Controls;
using Core.Common.Gui.Properties;
namespace Core.Common.Gui.Forms.PropertyGridView
@@ -18,21 +17,22 @@
private delegate void ArgumentlessDelegate();
private readonly IApplicationSelection applicationSelection;
- private readonly IGui gui;
+ private readonly IPropertyResolver propertyResolver;
+
private IObservable observable;
- public PropertyGridView(IGui gui, IApplicationSelection applicationSelection)
+ public PropertyGridView(IApplicationSelection applicationSelection, IPropertyResolver propertyResolver)
{
HideTabsButton();
FixDescriptionArea();
TranslateToolTips();
PropertySort = PropertySort.Categorized;
- this.applicationSelection = applicationSelection;
- this.gui = gui;
+ this.propertyResolver = propertyResolver;
- gui.SelectionChanged += GuiSelectionChanged;
+ this.applicationSelection = applicationSelection;
+ this.applicationSelection.SelectionChanged += GuiSelectionChanged;
}
///
@@ -57,7 +57,7 @@
///
protected override void OnPropertySortChanged(EventArgs e)
{
- // Needed for maintaining property order (no support for both categorized and alphabethical sorting)
+ // Needed for maintaining property order (no support for both categorized and alphabetical sorting)
if (PropertySort == PropertySort.CategorizedAlphabetical)
{
PropertySort = PropertySort.Categorized;
@@ -128,7 +128,7 @@
///
public object GetObjectProperties(object sourceData)
{
- return gui != null ? gui.PropertyResolver.GetObjectProperties(sourceData) : null;
+ return propertyResolver.GetObjectProperties(sourceData);
}
#endregion
Index: Core/Common/src/Core.Common.Gui/Forms/ViewManager/ViewList.cs
===================================================================
diff -u -r468ee58c212f14704baa1992fe906da456448ff5 -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/src/Core.Common.Gui/Forms/ViewManager/ViewList.cs (.../ViewList.cs) (revision 468ee58c212f14704baa1992fe906da456448ff5)
+++ Core/Common/src/Core.Common.Gui/Forms/ViewManager/ViewList.cs (.../ViewList.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -61,8 +61,6 @@
}
}
- public IGui Gui { get; set; }
-
public Action UpdateViewNameAction { get; set; }
public IView ActiveView
@@ -139,8 +137,6 @@
dockingManager.ViewActivated -= DockingManagerViewActivated;
dockingManager.Dispose();
-
- Gui = null;
}
public void Add(IView view, ViewLocation viewLocation)
Index: Core/Common/src/Core.Common.Gui/GuiExportHandler.cs
===================================================================
diff -u -r42ca97fdb85a553c6aac3bfdfe57c7be4af90821 -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/src/Core.Common.Gui/GuiExportHandler.cs (.../GuiExportHandler.cs) (revision 42ca97fdb85a553c6aac3bfdfe57c7be4af90821)
+++ Core/Common/src/Core.Common.Gui/GuiExportHandler.cs (.../GuiExportHandler.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -4,7 +4,6 @@
using System.Linq;
using System.Windows.Forms;
using Core.Common.Base.IO;
-using Core.Common.Controls;
using Core.Common.Controls.Views;
using Core.Common.Gui.Forms;
using Core.Common.Gui.Properties;
@@ -17,12 +16,12 @@
private static readonly ILog log = LogManager.GetLogger(typeof(GuiExportHandler));
private static readonly Bitmap brickImage = Resources.brick;
- private readonly IWin32Window owner;
+ private readonly IWin32Window dialogParent;
// TODO: refactor it, remove Funcs - too complicated design, initialize exporters in a different way
- public GuiExportHandler(IWin32Window owner, Func
public class GuiImportHandler
{
- private static readonly ILog Log = LogManager.GetLogger(typeof(GuiImportHandler));
+ private static readonly ILog log = LogManager.GetLogger(typeof(GuiImportHandler));
- private readonly IGui gui;
+ private readonly IWin32Window dialogParent;
+ private readonly ApplicationCore applicationCore;
- public GuiImportHandler(IGui gui)
+ public GuiImportHandler(IWin32Window dialogParent, ApplicationCore applicationCore)
{
- this.gui = gui;
+ this.dialogParent = dialogParent;
+ this.applicationCore = applicationCore;
}
public void ImportUsingImporter(IFileImporter importer, object target)
@@ -35,14 +38,14 @@
public IFileImporter GetSupportedImporterForTargetType(object target)
{
- var selectImporterDialog = new SelectItemDialog(gui.MainWindow);
+ var selectImporterDialog = new SelectItemDialog(dialogParent);
- var importers = gui.ApplicationCore.GetSupportedFileImporters(target);
+ var importers = applicationCore.GetSupportedFileImporters(target);
//if there is only one available exporter use that.
if (!importers.Any())
{
MessageBox.Show(Resources.GuiImportHandler_GetSupportedImporterForTargetType_No_importer_available_for_this_item, Resources.GuiImportHandler_GetSupportedImporterForTargetType_Error);
- Log.ErrorFormat(Resources.GuiImportHandler_GetSupportedImporterForTargetType_No_importer_available_for_this_item_0_, target);
+ log.ErrorFormat(Resources.GuiImportHandler_GetSupportedImporterForTargetType_No_importer_available_for_this_item_0_, target);
return null;
}
@@ -97,14 +100,14 @@
RestoreDirectory = true
};
- if (dialog.ShowDialog(gui.MainWindow) != DialogResult.OK)
+ if (dialog.ShowDialog(dialogParent) != DialogResult.OK)
{
return;
}
- Log.Info(Resources.GuiImportHandler_GetImportedItemsUsingFileOpenDialog_Start_importing_data);
+ log.Info(Resources.GuiImportHandler_GetImportedItemsUsingFileOpenDialog_Start_importing_data);
- ActivityProgressDialogRunner.Run(gui.MainWindow, dialog.FileNames.Select(f => new FileImportActivity(importer, target, f)));
+ ActivityProgressDialogRunner.Run(dialogParent, dialog.FileNames.Select(f => new FileImportActivity(importer, target, f)));
}
}
}
\ No newline at end of file
Index: Core/Common/src/Core.Common.Gui/IApplicationFeatureCommands.cs
===================================================================
diff -u -re96306bc32984aa50c6d1162167214024ddcf59a -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/src/Core.Common.Gui/IApplicationFeatureCommands.cs (.../IApplicationFeatureCommands.cs) (revision e96306bc32984aa50c6d1162167214024ddcf59a)
+++ Core/Common/src/Core.Common.Gui/IApplicationFeatureCommands.cs (.../IApplicationFeatureCommands.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -12,7 +12,7 @@
void ShowPropertiesFor(object obj);
///
- /// Indicates if there is a property view object for the current .
+ /// Indicates if there is a property view object for some object.
///
///
/// true if a property view is defined, false otherwise.
Index: Core/Common/src/Core.Common.Gui/ICommandsOwner.cs
===================================================================
diff -u -r98939d3757e99732f74f6345b5eb58c90e30a4d4 -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/src/Core.Common.Gui/ICommandsOwner.cs (.../ICommandsOwner.cs) (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4)
+++ Core/Common/src/Core.Common.Gui/ICommandsOwner.cs (.../ICommandsOwner.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -17,10 +17,5 @@
IProjectCommands ProjectCommands { get; }
IViewCommands ViewCommands { get; }
-
- ///
- /// Gets commands.
- ///
- IList Commands { get; }
}
}
\ No newline at end of file
Fisheye: Tag 47ab419402c31a8a2e103b37bf9c05250a2eaa0b refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Gui/IGuiCommand.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Core/Common/src/Core.Common.Gui/IProjectOwner.cs
===================================================================
diff -u -r98939d3757e99732f74f6345b5eb58c90e30a4d4 -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/src/Core.Common.Gui/IProjectOwner.cs (.../IProjectOwner.cs) (revision 98939d3757e99732f74f6345b5eb58c90e30a4d4)
+++ Core/Common/src/Core.Common.Gui/IProjectOwner.cs (.../IProjectOwner.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -20,12 +20,12 @@
event Action ProjectClosing;
///
- /// Gets or sets the project of the .
+ /// Gets or sets the project of the application.
///
Project Project { get; set; }
///
- /// Gets or sets the project path of the .
+ /// Gets or sets the project path of the application.
///
string ProjectFilePath { get; set; }
}
Index: Core/Common/src/Core.Common.Gui/ProjectCommandsHandler.cs
===================================================================
diff -u -r5fe206a748a55c603c85ee3a1865886b73d8544a -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/src/Core.Common.Gui/ProjectCommandsHandler.cs (.../ProjectCommandsHandler.cs) (revision 5fe206a748a55c603c85ee3a1865886b73d8544a)
+++ Core/Common/src/Core.Common.Gui/ProjectCommandsHandler.cs (.../ProjectCommandsHandler.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -17,15 +17,30 @@
public class ProjectCommandsHandler : IProjectCommands
{
private static readonly ILog log = LogManager.GetLogger(typeof(ProjectCommandsHandler));
- private readonly IGui gui;
+ private readonly IProjectOwner projectOwner;
+ private readonly IWin32Window dialogOwner;
+ private readonly ApplicationCore applicationCore;
+ private readonly IApplicationSelection applicationSelection;
+ private readonly IDocumentViewController documentViewController;
+
///
/// Initializes a new instance of the class.
///
- /// The GUI.
- public ProjectCommandsHandler(IGui gui)
+ ///
+ ///
+ ///
+ ///
+ ///
+ public ProjectCommandsHandler(IProjectOwner projectOwner, IWin32Window dialogParent,
+ ApplicationCore applicationCore, IApplicationSelection applicationSelection,
+ IDocumentViewController documentViewController)
{
- this.gui = gui;
+ this.projectOwner = projectOwner;
+ dialogOwner = dialogParent;
+ this.applicationCore = applicationCore;
+ this.applicationSelection = applicationSelection;
+ this.documentViewController = documentViewController;
}
public object AddNewChildItem(object parent, IEnumerable childItemValueTypes)
@@ -42,12 +57,12 @@
public void AddNewItem(object parent)
{
- if (gui.Project == null)
+ if (projectOwner.Project == null)
{
log.Error(Resources.GuiCommandHandler_AddNewItem_There_needs_to_be_a_project_to_add_an_item);
}
- using (var selectDataDialog = CreateSelectionDialogWithItems(gui.ApplicationCore.GetSupportedDataItemInfos(parent).ToList()))
+ using (var selectDataDialog = CreateSelectionDialogWithItems(applicationCore.GetSupportedDataItemInfos(parent).ToList()))
{
if (selectDataDialog.ShowDialog() == DialogResult.OK)
{
@@ -56,27 +71,27 @@
{
AddItemToProject(newItem);
- gui.Selection = newItem;
- gui.DocumentViewsResolver.OpenViewForData(gui.Selection);
+ applicationSelection.Selection = newItem;
+ documentViewController.DocumentViewsResolver.OpenViewForData(applicationSelection.Selection);
}
}
}
}
public void AddItemToProject(object newItem)
{
- gui.Project.Items.Add(newItem);
- gui.Project.NotifyObservers();
+ projectOwner.Project.Items.Add(newItem);
+ projectOwner.Project.NotifyObservers();
}
private IEnumerable GetSupportedDataItemInfosByValueTypes(object parent, IEnumerable valueTypes)
{
- return gui.ApplicationCore.GetSupportedDataItemInfos(parent).Where(dii => valueTypes.Contains(dii.ValueType));
+ return applicationCore.GetSupportedDataItemInfos(parent).Where(dii => valueTypes.Contains(dii.ValueType));
}
- private SelectItemDialog CreateSelectionDialogWithItems(IList dataItemInfos)
+ private SelectItemDialog CreateSelectionDialogWithItems(IEnumerable dataItemInfos)
{
- var selectDataDialog = new SelectItemDialog(gui.MainWindow);
+ var selectDataDialog = new SelectItemDialog(dialogOwner);
foreach (var dataItemInfo in dataItemInfos)
{
Index: Core/Common/src/Core.Common.Gui/RingtoetsGui.cs
===================================================================
diff -u -rf9058d5293ecb785069c5b6b4c554dc6800ee771 -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/src/Core.Common.Gui/RingtoetsGui.cs (.../RingtoetsGui.cs) (revision f9058d5293ecb785069c5b6b4c554dc6800ee771)
+++ Core/Common/src/Core.Common.Gui/RingtoetsGui.cs (.../RingtoetsGui.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -15,6 +15,7 @@
using Core.Common.Controls.TreeView;
using Core.Common.Controls.Views;
using Core.Common.Gui.ContextMenu;
+using Core.Common.Gui.Forms;
using Core.Common.Gui.Forms.MainWindow;
using Core.Common.Gui.Forms.MessageWindow;
using Core.Common.Gui.Forms.PropertyGridView;
@@ -50,7 +51,7 @@
private bool runFinished;
private bool isExiting;
- public RingtoetsGui(ApplicationCore applicationCore = null, GuiCoreSettings fixedSettings = null)
+ public RingtoetsGui(IMainWindow mainWindow, ApplicationCore applicationCore = null, GuiCoreSettings fixedSettings = null)
{
// error detection code, make sure we use only a single instance of RingtoetsGui at a time
if (isAlreadyRunningInstanceOfIGui)
@@ -59,24 +60,25 @@
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);
}
+ MainWindow = mainWindow;
ApplicationCore = applicationCore ?? new ApplicationCore();
FixedSettings = fixedSettings ?? new GuiCoreSettings();
isAlreadyRunningInstanceOfIGui = true;
instanceCreationStackTrace = new StackTrace().ToString();
- ViewPropertyEditor.Gui = this;
Plugins = new List();
UserSettings = Settings.Default;
- appFeatureApplicationCommands = new ApplicationFeatureCommandHandler(this);
viewCommandHandler = new ViewCommandHandler(this);
- storageCommandHandler = new StorageCommandHandler(viewCommandHandler, this);
- exportImportCommandHandler = new ExportImportCommandHandler(this);
- projectCommandsHandler = new ProjectCommandsHandler(this);
+ storageCommandHandler = new StorageCommandHandler(Storage, this, this, this, this, viewCommandHandler);
+ appFeatureApplicationCommands = new ApplicationFeatureCommandHandler(PropertyResolver, MainWindow, this);
+ exportImportCommandHandler = new ExportImportCommandHandler(MainWindow, ApplicationCore, this);
+ projectCommandsHandler = new ProjectCommandsHandler(this, MainWindow, ApplicationCore, this, this);
WindowsApplication.EnableVisualStyles();
+ ViewPropertyEditor.ViewCommands = ViewCommands;
ProjectOpened += ApplicationProjectOpened;
}
@@ -87,6 +89,14 @@
public IStoreProject Storage { get; set; }
+ private IProjectExplorer ProjectExplorer
+ {
+ get
+ {
+ return ToolWindowViews.OfType().FirstOrDefault();
+ }
+ }
+
public void Dispose()
{
Dispose(true);
@@ -344,12 +354,12 @@
// Sets the tooltip for given view, assuming that ProjectExplorer is not null.
private void SetToolTipForView(IView view)
{
- if (mainWindow == null || mainWindow.ProjectExplorer == null)
+ if (mainWindow == null || ProjectExplorer == null)
{
return;
}
- var node = mainWindow.ProjectExplorer.TreeView.GetNodeByTag(view.Data);
+ var node = ProjectExplorer.TreeView.GetNodeByTag(view.Data);
if (node != null)
{
DocumentViews.SetTooltip(view, node.FullPath);
@@ -468,9 +478,9 @@
ToolWindowViews.ActiveView = mainWindow.MessageWindow;
}
- if (ToolWindowViews.Contains(mainWindow.ProjectExplorer))
+ if (ToolWindowViews.Contains(ProjectExplorer))
{
- ToolWindowViews.ActiveView = mainWindow.ProjectExplorer;
+ ToolWindowViews.ActiveView = ProjectExplorer;
}
mainWindow.ValidateItems();
@@ -511,7 +521,7 @@
return;
}
- if (mainWindow.ProjectExplorer != null)
+ if (ProjectExplorer != null)
{
SetToolTipForView(e.View);
}
@@ -534,7 +544,6 @@
{
IgnoreActivation = true,
UpdateViewNameAction = v => UpdateViewName(v),
- Gui = this
};
documentViewManager.EnableTabContextMenus();
@@ -562,7 +571,6 @@
toolWindowViews = new ViewList(toolWindowViewsDockingManager, ViewLocation.Left)
{
IgnoreActivation = true,
- Gui = this
};
toolWindowViews.CollectionChanged += ToolWindowViewsOnCollectionChanged;
@@ -816,21 +824,12 @@
#region Implementation: ICommandsOwner
- private readonly IList commands = new List();
private readonly ApplicationFeatureCommandHandler appFeatureApplicationCommands;
private readonly ViewCommandHandler viewCommandHandler;
private readonly ProjectCommandsHandler projectCommandsHandler;
private readonly ExportImportCommandHandler exportImportCommandHandler;
private StorageCommandHandler storageCommandHandler;
- public IList Commands
- {
- get
- {
- return commands;
- }
- }
-
public IApplicationFeatureCommands ApplicationCommands
{
get
@@ -990,7 +989,7 @@
{
return mainWindow;
}
- set
+ private set
{
mainWindow = (MainWindow)value;
mainWindow.Gui = this;
Index: Core/Common/src/Core.Common.Gui/StorageCommandHandler.cs
===================================================================
diff -u -rd31b2f10fb6c47a32d6eb62e56d635b6c97f658c -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/src/Core.Common.Gui/StorageCommandHandler.cs (.../StorageCommandHandler.cs) (revision d31b2f10fb6c47a32d6eb62e56d635b6c97f658c)
+++ Core/Common/src/Core.Common.Gui/StorageCommandHandler.cs (.../StorageCommandHandler.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -19,25 +19,39 @@
private static readonly ILog log = LogManager.GetLogger(typeof(StorageCommandHandler));
private readonly IViewCommands viewCommands;
- private readonly IGui gui;
+ private readonly IMainWindowController mainWindowController;
+ private readonly IProjectOwner projectOwner;
+ private readonly IStoreProject projectPersistor;
+ private readonly IApplicationSelection applicationSelection;
+ private readonly IToolViewController toolViewController;
///
/// Initializes a new instance of the class.
///
+ /// Class responsible to storing and loading the application project.
+ /// The class owning the application project.
+ /// Class managing the application selection.
+ /// Controller for UI.
+ /// Controller for Tool Windows.
/// The view command handler.
- /// The GUI.
- public StorageCommandHandler(IViewCommands viewCommands, IGui gui)
+ public StorageCommandHandler(IStoreProject projectStorage, IProjectOwner projectOwner,
+ IApplicationSelection applicationSelection, IMainWindowController mainWindowController,
+ IToolViewController toolViewController, IViewCommands viewCommands)
{
this.viewCommands = viewCommands;
- this.gui = gui;
+ this.mainWindowController = mainWindowController;
+ this.projectOwner = projectOwner;
+ projectPersistor = projectStorage;
+ this.applicationSelection = applicationSelection;
+ this.toolViewController = toolViewController;
- this.gui.ProjectOpened += ApplicationProjectOpened;
- this.gui.ProjectClosing += ApplicationProjectClosing;
+ this.projectOwner.ProjectOpened += ApplicationProjectOpened;
+ this.projectOwner.ProjectClosing += ApplicationProjectClosing;
}
public void UpdateObserver()
{
- gui.RefreshGui();
+ mainWindowController.RefreshGui();
}
///
@@ -48,11 +62,11 @@
CloseProject();
log.Info(Resources.Project_new_opening);
- gui.Project = new Project();
- gui.ProjectFilePath = "";
+ projectOwner.Project = new Project();
+ projectOwner.ProjectFilePath = "";
log.Info(Resources.Project_new_successfully_opened);
- gui.RefreshGui();
+ mainWindowController.RefreshGui();
}
///
@@ -68,7 +82,7 @@
RestoreDirectory = true
};
- if (openFileDialog.ShowDialog(gui.MainWindow) != DialogResult.Cancel)
+ if (openFileDialog.ShowDialog(mainWindowController.MainWindow) != DialogResult.Cancel)
{
return OpenExistingProject(openFileDialog.FileName);
}
@@ -85,11 +99,10 @@
{
log.Info(Resources.Project_existing_opening_project);
- var storage = gui.Storage;
Project loadedProject;
try
{
- loadedProject = storage.LoadProject(filePath);
+ loadedProject = projectPersistor.LoadProject(filePath);
}
catch (StorageException e)
{
@@ -107,11 +120,11 @@
// Project loaded successfully, close current project
CloseProject();
- gui.ProjectFilePath = filePath;
- gui.Project = loadedProject;
- gui.Project.Name = Path.GetFileNameWithoutExtension(filePath);
- gui.Project.NotifyObservers();
- gui.RefreshGui();
+ projectOwner.ProjectFilePath = filePath;
+ projectOwner.Project = loadedProject;
+ projectOwner.Project.Name = Path.GetFileNameWithoutExtension(filePath);
+ projectOwner.Project.NotifyObservers();
+ mainWindowController.RefreshGui();
log.Info(Resources.Project_existing_successfully_opened);
return true;
}
@@ -121,19 +134,19 @@
///
public void CloseProject()
{
- if (gui.Project == null)
+ if (projectOwner.Project == null)
{
return;
}
// remove views before closing project.
- viewCommands.RemoveAllViewsForItem(gui.Project);
+ viewCommands.RemoveAllViewsForItem(projectOwner.Project);
- gui.Project = null;
- gui.Selection = null;
- gui.ProjectFilePath = "";
+ projectOwner.Project = null;
+ projectOwner.ProjectFilePath = "";
+ applicationSelection.Selection = null;
- gui.RefreshGui();
+ mainWindowController.RefreshGui();
}
///
@@ -142,7 +155,7 @@
/// Returns true if the save was successful, false otherwise.
public bool SaveProjectAs()
{
- var project = gui.Project;
+ var project = projectOwner.Project;
if (project == null)
{
return false;
@@ -154,42 +167,40 @@
return false;
}
- var storage = gui.Storage;
- if (!TrySaveProjectAs(storage, filePath))
+ if (!TrySaveProjectAs(projectPersistor, filePath))
{
return false;
}
// Save was successful, store location
- gui.ProjectFilePath = filePath;
+ projectOwner.ProjectFilePath = filePath;
project.Name = Path.GetFileNameWithoutExtension(filePath);
project.NotifyObservers();
- gui.RefreshGui();
+ mainWindowController.RefreshGui();
log.Info(String.Format(Resources.Project_saving_project_saved_0, project.Name));
return true;
}
///
/// Saves the current to the defined storage file.
///
- /// Returns if the save was succesful.
+ /// Returns if the save was successful.
public bool SaveProject()
{
- var project = gui.Project;
+ var project = projectOwner.Project;
if (project == null)
{
return false;
}
- var filePath = gui.ProjectFilePath;
+ var filePath = projectOwner.ProjectFilePath;
// If filepath is not set, go to SaveAs
if (string.IsNullOrWhiteSpace(filePath))
{
return SaveProjectAs();
}
- var storage = gui.Storage;
- if (!TrySaveProject(storage, filePath))
+ if (!TrySaveProject(projectPersistor, filePath))
{
return false;
}
@@ -200,8 +211,8 @@
public void Dispose()
{
- gui.ProjectOpened -= ApplicationProjectOpened;
- gui.ProjectClosing -= ApplicationProjectClosing;
+ projectOwner.ProjectOpened -= ApplicationProjectOpened;
+ projectOwner.ProjectClosing -= ApplicationProjectClosing;
}
///
@@ -232,7 +243,7 @@
{
try
{
- storage.SaveProjectAs(filePath, gui.Project);
+ storage.SaveProjectAs(filePath, projectOwner.Project);
return true;
}
catch (StorageException e)
@@ -247,7 +258,7 @@
{
try
{
- storage.SaveProject(filePath, gui.Project);
+ storage.SaveProject(filePath, projectOwner.Project);
return true;
}
catch (StorageException e)
@@ -261,14 +272,11 @@
private void ApplicationProjectClosing(Project project)
{
// clean all views
- if (gui.DocumentViews != null)
- {
- viewCommands.RemoveAllViewsForItem(project);
- }
+ viewCommands.RemoveAllViewsForItem(project);
- if (gui.ToolWindowViews != null)
+ if (toolViewController.ToolWindowViews != null)
{
- foreach (IView view in gui.ToolWindowViews)
+ foreach (IView view in toolViewController.ToolWindowViews)
{
view.Data = null;
}
@@ -279,20 +287,20 @@
private void ApplicationProjectOpened(Project project)
{
- gui.Selection = project;
+ applicationSelection.Selection = project;
project.Attach(this);
}
private void AddProjectToMruList()
{
var mruList = (StringCollection) Settings.Default["mruList"];
- if (mruList.Contains(gui.ProjectFilePath))
+ if (mruList.Contains(projectOwner.ProjectFilePath))
{
- mruList.Remove(gui.ProjectFilePath);
+ mruList.Remove(projectOwner.ProjectFilePath);
}
- mruList.Insert(0, gui.ProjectFilePath);
+ mruList.Insert(0, projectOwner.ProjectFilePath);
}
}
}
\ No newline at end of file
Index: Core/Common/src/Core.Common.Gui/ViewPropertyEditor.cs
===================================================================
diff -u -r7993dddd622b104506d59a43fd9add82d6ce48ae -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/src/Core.Common.Gui/ViewPropertyEditor.cs (.../ViewPropertyEditor.cs) (revision 7993dddd622b104506d59a43fd9add82d6ce48ae)
+++ Core/Common/src/Core.Common.Gui/ViewPropertyEditor.cs (.../ViewPropertyEditor.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -27,7 +27,7 @@
///
public class ViewPropertyEditor : UITypeEditor
{
- public static IGui Gui { get; set; } //static: injected in RingtoetsGui
+ public static IViewCommands ViewCommands { get; set; } //static: injected in RingtoetsGui
public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
{
@@ -36,7 +36,7 @@
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
- Gui.ViewCommands.OpenView(value);
+ ViewCommands.OpenView(value);
return value;
}
}
Index: Core/Common/test/Core.Common.Gui.Test/ApplicationFeatureCommandHandlerTest.cs
===================================================================
diff -u -re96306bc32984aa50c6d1162167214024ddcf59a -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/test/Core.Common.Gui.Test/ApplicationFeatureCommandHandlerTest.cs (.../ApplicationFeatureCommandHandlerTest.cs) (revision e96306bc32984aa50c6d1162167214024ddcf59a)
+++ Core/Common/test/Core.Common.Gui.Test/ApplicationFeatureCommandHandlerTest.cs (.../ApplicationFeatureCommandHandlerTest.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -1,4 +1,5 @@
-using Core.Common.Gui.Forms.PropertyGridView;
+using Core.Common.Gui.Forms.MainWindow;
+using Core.Common.Gui.Forms.PropertyGridView;
using NUnit.Framework;
using Rhino.Mocks;
@@ -18,16 +19,18 @@
public void CanShowPropertiesFor_PropertiesForObjectDefined_True()
{
// Setup
- var gui = mocks.DynamicMock();
- var propertyResolverMock = mocks.StrictMock();
var anObject = new AnObject();
+ var propertyResolverMock = mocks.StrictMock();
propertyResolverMock.Expect(pr => pr.GetObjectProperties(anObject)).Return(new object());
- gui.Expect(g => g.PropertyResolver).Return(propertyResolverMock);
+ var mainWindow = mocks.Stub();
+
+ var applicationSelection = mocks.Stub();
+
mocks.ReplayAll();
- var commandHandler = new ApplicationFeatureCommandHandler(gui);
+ var commandHandler = new ApplicationFeatureCommandHandler(propertyResolverMock, mainWindow, applicationSelection);
// Call
var canShowProperties = commandHandler.CanShowPropertiesFor(anObject);
@@ -51,7 +54,7 @@
mocks.ReplayAll();
- var commandHandler = new ApplicationFeatureCommandHandler(gui);
+ var commandHandler = new ApplicationFeatureCommandHandler(gui.PropertyResolver, gui.MainWindow, gui);
// Call
var canShowProperties = commandHandler.CanShowPropertiesFor(aSubObject);
Index: Core/Common/test/Core.Common.Gui.Test/StorageCommandHandlerTest.cs
===================================================================
diff -u -r9078a958e72b7ffe61f066c0ba0356bc7266716c -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/test/Core.Common.Gui.Test/StorageCommandHandlerTest.cs (.../StorageCommandHandlerTest.cs) (revision 9078a958e72b7ffe61f066c0ba0356bc7266716c)
+++ Core/Common/test/Core.Common.Gui.Test/StorageCommandHandlerTest.cs (.../StorageCommandHandlerTest.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -1,4 +1,6 @@
using Core.Common.Base.Data;
+using Core.Common.Base.Storage;
+
using NUnit.Framework;
using Rhino.Mocks;
@@ -21,23 +23,25 @@
// SetUp
IViewCommands viewCommands = mocks.StrictMock();
- IGui guiMock = mocks.StrictMock();
- guiMock.Stub(g => g.ProjectOpened += null).IgnoreArguments();
- guiMock.Stub(g => g.ProjectClosing += null).IgnoreArguments();
- guiMock.Expect(x => x.Project).PropertyBehavior();
- guiMock.Expect(x => x.ProjectFilePath).PropertyBehavior();
- guiMock.Stub(x => x.RefreshGui());
+ var projectStorage = mocks.Stub();
+ var projectOwner = mocks.Stub();
+ projectOwner.Stub(g => g.ProjectOpened += null).IgnoreArguments();
+ projectOwner.Stub(g => g.ProjectClosing += null).IgnoreArguments();
+ var applicationSelection = mocks.Stub();
+ var mainWindowController = mocks.Stub();
+ var toolViewController = mocks.Stub();
mocks.ReplayAll();
- StorageCommandHandler storageCommandHandler = new StorageCommandHandler(viewCommands, guiMock);
+ var storageCommandHandler = new StorageCommandHandler(projectStorage, projectOwner, applicationSelection,
+ mainWindowController, toolViewController, viewCommands);
// Call
storageCommandHandler.CreateNewProject();
// Assert
- Assert.IsInstanceOf(guiMock.Project);
- Assert.AreEqual("", guiMock.ProjectFilePath);
+ Assert.IsInstanceOf(projectOwner.Project);
+ Assert.AreEqual("", projectOwner.ProjectFilePath);
mocks.VerifyAll();
}
@@ -53,30 +57,30 @@
projectMock.Name = "test";
projectMock.StorageId = 1234L;
- IGui guiMock = mocks.StrictMock();
- guiMock.Stub(g => g.ProjectOpened += null).IgnoreArguments();
- guiMock.Stub(g => g.ProjectClosing += null).IgnoreArguments();
- guiMock.Expect(x => x.Project).PropertyBehavior();
- guiMock.Expect(x => x.ProjectFilePath).PropertyBehavior();
- guiMock.Expect(x => x.Selection).PropertyBehavior();
- guiMock.Stub(x => x.RefreshGui());
+ var projectStorage = mocks.Stub();
+ var projectOwner = mocks.Stub();
+ projectOwner.Project = projectMock;
+ projectOwner.ProjectFilePath = savedProjectPath;
+ projectOwner.Stub(g => g.ProjectOpened += null).IgnoreArguments();
+ projectOwner.Stub(g => g.ProjectClosing += null).IgnoreArguments();
+ var applicationSelection = mocks.Stub();
+ var mainWindowController = mocks.Stub();
+ var toolViewController = mocks.Stub();
- guiMock.Project = projectMock;
- guiMock.ProjectFilePath = savedProjectPath;
-
mocks.ReplayAll();
- StorageCommandHandler storageCommandHandler = new StorageCommandHandler(viewCommands, guiMock);
+ var storageCommandHandler = new StorageCommandHandler(projectStorage, projectOwner, applicationSelection,
+ mainWindowController, toolViewController, viewCommands);
// Call
storageCommandHandler.CreateNewProject();
// Assert
- Assert.IsInstanceOf(guiMock.Project);
- Assert.AreNotEqual(projectMock, guiMock.Project);
- Assert.AreNotEqual(projectMock.StorageId, guiMock.Project.StorageId);
- Assert.AreNotEqual(savedProjectPath, guiMock.ProjectFilePath);
- Assert.AreEqual("", guiMock.ProjectFilePath);
+ Assert.IsInstanceOf(projectOwner.Project);
+ Assert.AreNotEqual(projectMock, projectOwner.Project);
+ Assert.AreNotEqual(projectMock.StorageId, projectOwner.Project.StorageId);
+ Assert.AreNotEqual(savedProjectPath, projectOwner.ProjectFilePath);
+ Assert.AreEqual("", projectOwner.ProjectFilePath);
mocks.VerifyAll();
}
@@ -90,29 +94,29 @@
Project projectMock = mocks.StrictMock();
- IGui guiMock = mocks.StrictMock();
- guiMock.Stub(g => g.ProjectOpened += null).IgnoreArguments();
- guiMock.Stub(g => g.ProjectClosing += null).IgnoreArguments();
- guiMock.Expect(x => x.Project).PropertyBehavior();
- guiMock.Expect(x => x.ProjectFilePath).PropertyBehavior();
- guiMock.Expect(x => x.Selection).PropertyBehavior();
- guiMock.Stub(x => x.RefreshGui());
+ var projectStorage = mocks.Stub();
+ var projectOwner = mocks.Stub();
+ projectOwner.Project = projectMock;
+ projectOwner.ProjectFilePath = savedProjectPath;
+ projectOwner.Stub(g => g.ProjectOpened += null).IgnoreArguments();
+ projectOwner.Stub(g => g.ProjectClosing += null).IgnoreArguments();
+ var applicationSelection = mocks.Stub();
+ applicationSelection.Selection = projectMock;
+ var mainWindowController = mocks.Stub();
+ var toolViewController = mocks.Stub();
- guiMock.Project = projectMock;
- guiMock.Selection = projectMock;
- guiMock.ProjectFilePath = savedProjectPath;
-
mocks.ReplayAll();
- StorageCommandHandler storageCommandHandler = new StorageCommandHandler(viewCommands, guiMock);
+ var storageCommandHandler = new StorageCommandHandler(projectStorage, projectOwner, applicationSelection,
+ mainWindowController, toolViewController, viewCommands);
// Call
storageCommandHandler.CloseProject();
// Assert
- Assert.IsNull(guiMock.Project);
- Assert.IsNull(guiMock.Selection);
- Assert.AreEqual("", guiMock.ProjectFilePath);
+ Assert.IsNull(projectOwner.Project);
+ Assert.IsNull(applicationSelection.Selection);
+ Assert.AreEqual("", projectOwner.ProjectFilePath);
mocks.VerifyAll();
}
@@ -124,20 +128,20 @@
Project projectMock = mocks.StrictMock();
- IGui guiMock = mocks.StrictMock();
- guiMock.Stub(g => g.ProjectOpened += null).IgnoreArguments();
- guiMock.Stub(g => g.ProjectClosing += null).IgnoreArguments();
- guiMock.Expect(x => x.Project).PropertyBehavior();
- guiMock.Expect(x => x.ProjectFilePath).PropertyBehavior();
- guiMock.Expect(x => x.Selection).PropertyBehavior();
- guiMock.Stub(x => x.RefreshGui());
+ var projectStorage = mocks.Stub();
+ var projectOwner = mocks.Stub();
+ projectOwner.Project = projectMock;
+ projectOwner.Stub(g => g.ProjectOpened += null).IgnoreArguments();
+ projectOwner.Stub(g => g.ProjectClosing += null).IgnoreArguments();
+ var applicationSelection = mocks.Stub();
+ applicationSelection.Selection = projectMock;
+ var mainWindowController = mocks.Stub();
+ var toolViewController = mocks.Stub();
- guiMock.Project = projectMock;
- guiMock.Selection = guiMock.Project;
-
mocks.ReplayAll();
- StorageCommandHandler storageCommandHandler = new StorageCommandHandler(viewCommands, guiMock);
+ var storageCommandHandler = new StorageCommandHandler(projectStorage, projectOwner, applicationSelection,
+ mainWindowController, toolViewController, viewCommands);
TestDelegate closeProject = () => storageCommandHandler.CloseProject();
Assert.DoesNotThrow(closeProject);
Index: Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/GuiImportHandlerTest.cs
===================================================================
diff -u -r13d085cce60350733df7e62c9ccba0525d9fd279 -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/GuiImportHandlerTest.cs (.../GuiImportHandlerTest.cs) (revision 13d085cce60350733df7e62c9ccba0525d9fd279)
+++ Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/GuiImportHandlerTest.cs (.../GuiImportHandlerTest.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -11,24 +11,17 @@
[TestFixture]
public class GuiImportHandlerTest : NUnitFormTest
{
- private MockRepository mocks;
- private IGui gui;
-
- [SetUp]
- public void SetUp()
- {
- mocks = new MockRepository();
- gui = mocks.Stub();
- }
-
[Test]
public void NoImporterAvailableGivesMessageBox()
{
- var mainWindow = mocks.Stub();
var applicationCore = new ApplicationCore();
- gui.Stub(g => g.ApplicationCore).Return(applicationCore);
- gui.Stub(g => g.MainWindow).Return(mainWindow);
+
+ var mocks = new MockRepository();
+ var mainWindow = mocks.Stub();
+ var mainWindowController = mocks.Stub();
+ mainWindowController.Stub(g => g.MainWindow).Return(mainWindow);
+
mocks.ReplayAll();
DialogBoxHandler = (name, wnd) =>
@@ -39,7 +32,7 @@
messageBox.ClickOk();
};
- var importHandler = new GuiImportHandler(gui);
+ var importHandler = new GuiImportHandler(mainWindowController.MainWindow, applicationCore);
var item = importHandler.GetSupportedImporterForTargetType(typeof(Int64));
Index: Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/RingtoetsGuiIntegrationTest.cs
===================================================================
diff -u -r9078a958e72b7ffe61f066c0ba0356bc7266716c -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/RingtoetsGuiIntegrationTest.cs (.../RingtoetsGuiIntegrationTest.cs) (revision 9078a958e72b7ffe61f066c0ba0356bc7266716c)
+++ Core/Common/test/Core.Common.Integration.Test/Ringtoets/Application.Ringtoets/RingtoetsGuiIntegrationTest.cs (.../RingtoetsGuiIntegrationTest.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -22,9 +22,8 @@
[RequiresSTA]
public void StartGuiWithToolboxDoesNotCrash()
{
- using (var gui = new RingtoetsGui())
+ using (var gui = new RingtoetsGui(new MainWindow(null)))
{
- gui.MainWindow = new MainWindow(gui);
var applicationCore = gui.ApplicationCore;
applicationCore.AddPlugin(new RingtoetsApplicationPlugin());
@@ -45,9 +44,8 @@
public void GuiSelectionIsSetToProjectAfterStartWithProjectExplorer()
{
// initialize
- using (var gui = new RingtoetsGui())
+ using (var gui = new RingtoetsGui(new MainWindow(null)))
{
- gui.MainWindow = new MainWindow(gui);
gui.Plugins.Add(new ProjectExplorerGuiPlugin());
gui.Run();
@@ -61,9 +59,8 @@
{
//testing testhelper + visible changed event of mainwindow.
//could be tested separately but the combination is vital to many tests. That's why this test is here.
- using (var gui = new RingtoetsGui())
+ using (var gui = new RingtoetsGui(new MainWindow(null)))
{
- gui.MainWindow = new MainWindow(gui);
gui.Run();
int callCount = 0;
WpfTestHelper.ShowModal((Control) gui.MainWindow, () => callCount++);
@@ -75,9 +72,8 @@
[RequiresSTA]
public void SelectingProjectNodeSetsSelectedItemToProject()
{
- using (var gui = new RingtoetsGui())
+ using (var gui = new RingtoetsGui(new MainWindow(null)))
{
- gui.MainWindow = new MainWindow(gui);
gui.Plugins.Add(new ProjectExplorerGuiPlugin());
gui.Run();
@@ -92,9 +88,8 @@
private static void StartWithCommonPlugins()
{
- using (var gui = new RingtoetsGui())
+ using (var gui = new RingtoetsGui(new MainWindow(null)))
{
- gui.MainWindow = new MainWindow(gui);
var applicationCore = gui.ApplicationCore;
applicationCore.AddPlugin(new RingtoetsApplicationPlugin());
Index: Core/Common/test/Core.Common.Test/Gui/RingtoetsGuiTests.cs
===================================================================
diff -u -r5933051dfa1dbc40dbf7552852e6ca85ae7b0811 -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Common/test/Core.Common.Test/Gui/RingtoetsGuiTests.cs (.../RingtoetsGuiTests.cs) (revision 5933051dfa1dbc40dbf7552852e6ca85ae7b0811)
+++ Core/Common/test/Core.Common.Test/Gui/RingtoetsGuiTests.cs (.../RingtoetsGuiTests.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -1,7 +1,7 @@
+using System;
using System.Linq;
using Core.Common.Base.Plugin;
-using Core.Common.Controls.Views;
using Core.Common.Gui;
using Core.Common.Gui.Forms.MainWindow;
using Core.Common.Test.TestObjects;
@@ -14,17 +14,16 @@
public class RingtoetsGuiTests
{
[Test]
+ [STAThread]
public void DisposingGuiDisposesApplication()
{
// Setup
var mocks = new MockRepository();
var applicationCore = mocks.Stub();
-
applicationCore.Expect(ac => ac.Dispose());
-
mocks.ReplayAll();
- var gui = new RingtoetsGui(applicationCore);
+ var gui = new RingtoetsGui(new MainWindow(null), applicationCore);
// Call
gui.Dispose();
@@ -34,19 +33,21 @@
}
[Test]
+ [STAThread]
public void CheckViewPropertyEditorIsInitialized()
{
- using (new RingtoetsGui())
+ using (new RingtoetsGui(new MainWindow(null)))
{
- Assert.NotNull(ViewPropertyEditor.Gui);
+ Assert.NotNull(ViewPropertyEditor.ViewCommands);
}
}
[Test]
+ [STAThread]
public void GetAllDataWithViewDefinitionsRecursively_DataHasNoViewDefinitions_ReturnEmpty()
{
// Setup
- using (var ringtoetsGui = new RingtoetsGui())
+ using (var ringtoetsGui = new RingtoetsGui(new MainWindow(null)))
{
var rootData = new object();
@@ -59,12 +60,14 @@
}
[Test]
+ [STAThread]
public void GetAllDataWithViewDefinitionsRecursively_MultiplePluginsHaveViewDefinitionsForRoot_ReturnRootObject()
{
// Setup
var rootData = new object();
var mocks = new MockRepository();
+
var plugin1 = mocks.StrictMock();
plugin1.Expect(p => p.GetChildDataWithViewDefinitions(rootData)).Return(new[]
{
@@ -81,7 +84,7 @@
plugin2.Stub(p => p.Deactivate());
mocks.ReplayAll();
- using (var ringtoetsGui = new RingtoetsGui())
+ using (var ringtoetsGui = new RingtoetsGui(new MainWindow(null)))
{
ringtoetsGui.Plugins.Add(plugin1);
ringtoetsGui.Plugins.Add(plugin2);
@@ -100,13 +103,15 @@
}
[Test]
+ [STAThread]
public void GetAllDataWithViewDefinitionsRecursively_MultiplePluginsHaveViewDefinitionsForRootAndChild_ReturnRootAndChild()
{
// Setup
object rootData = 1;
object rootChild = 2;
var mocks = new MockRepository();
+
var plugin1 = mocks.StrictMock();
plugin1.Expect(p => p.GetChildDataWithViewDefinitions(rootData)).Return(new[]
{
@@ -131,7 +136,7 @@
plugin2.Stub(p => p.Deactivate());
mocks.ReplayAll();
- using (var ringtoetsGui = new RingtoetsGui())
+ using (var ringtoetsGui = new RingtoetsGui(new MainWindow(null)))
{
ringtoetsGui.Plugins.Add(plugin1);
ringtoetsGui.Plugins.Add(plugin2);
@@ -154,9 +159,8 @@
public void ActiveViewChanged_LastDocumentViewClosed_EventFired()
{
// Setup
- using (var gui = new RingtoetsGui())
+ using (var gui = new RingtoetsGui(new MainWindow(null)))
{
- gui.MainWindow = new MainWindow(gui);
gui.Run();
var view = new TestView();
Index: Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs
===================================================================
diff -u -r74cd1965818ae9b23da6cad8776b7da2868be4a7 -r47ab419402c31a8a2e103b37bf9c05250a2eaa0b
--- Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs (.../OxyPlotGuiPluginTest.cs) (revision 74cd1965818ae9b23da6cad8776b7da2868be4a7)
+++ Core/Plugins/test/Core.Plugins.OxyPlot.Test/OxyPlotGuiPluginTest.cs (.../OxyPlotGuiPluginTest.cs) (revision 47ab419402c31a8a2e103b37bf9c05250a2eaa0b)
@@ -1,13 +1,11 @@
using System;
-using System.Collections.Generic;
using System.Linq;
using System.Windows;
using Core.Common.Controls.Views;
using Core.Common.Gui;
using Core.Common.Gui.Forms.MainWindow;
using Core.Common.Gui.Forms.ViewManager;
using Core.Components.Charting.Data;
-using Core.Components.Charting.TestUtil;
using Core.Components.OxyPlot.Forms;
using Core.Plugins.OxyPlot.Forms;
using Core.Plugins.OxyPlot.Legend;
@@ -130,10 +128,9 @@
public void GivenConfiguredGui_WhenOpenToolView_UpdateComponentsWithDataFromActiveView(bool isChartViewActive)
{
// Given
- using (var gui = new RingtoetsGui())
+ using (var gui = new RingtoetsGui(new MainWindow(null)))
{
var plugin = new OxyPlotGuiPlugin();
- gui.MainWindow = new MainWindow(gui);
var mocks = new MockRepository();
IView viewMock = isChartViewActive ? (IView)new TestChartView() : new TestView();
var baseChart = new BaseChart
@@ -169,10 +166,9 @@
public void GivenConfiguredGui_WhenActiveViewChangesToViewWithChart_ThenRibbonSetVisibility(bool visible)
{
// Given
- using (var gui = new RingtoetsGui())
+ using (var gui = new RingtoetsGui(new MainWindow(null)))
{
var plugin = new OxyPlotGuiPlugin();
- gui.MainWindow = new MainWindow(gui);
var mocks = new MockRepository();
var testChartView = new TestChartView();
var chart = new BaseChart();