Commit 6e5a8df
Changed files (9)
product
product/desktop.ui/bootstrappers/Bootstrapper.cs
@@ -64,6 +64,7 @@ namespace solidware.financials.windows.ui.bootstrappers
{
SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext());
builder.RegisterType<WPFApplicationController>().As<ApplicationController>().SingleInstance();
+ builder.RegisterType<WPFDialogLauncher>().As<DialogLauncher>().SingleInstance();
builder.RegisterType<WPFPresenterFactory>().As<PresenterFactory>().SingleInstance();
builder.RegisterType<SynchronizedEventAggregator>().As<EventAggregator>().SingleInstance();
//builder.Register(x => AsyncOperationManager.SynchronizationContext);
product/desktop.ui/bootstrappers/ComposeShell.cs
@@ -8,10 +8,12 @@ namespace solidware.financials.windows.ui.bootstrappers
{
RegionManager region_manager;
ApplicationController controller;
+ DialogLauncher launcher;
- public ComposeShell(RegionManager region_manager, ApplicationController controller)
+ public ComposeShell(RegionManager region_manager, ApplicationController controller, DialogLauncher launcher)
{
this.region_manager = region_manager;
+ this.launcher = launcher;
this.controller = controller;
}
@@ -39,7 +41,7 @@ namespace solidware.financials.windows.ui.bootstrappers
void launch<Presenter, Dialog>() where Presenter : DialogPresenter
where Dialog : FrameworkElement, Dialog<Presenter>, new()
{
- controller.launch<Presenter, Dialog>();
+ launcher.launch<Presenter, Dialog>();
}
}
}
\ No newline at end of file
product/desktop.ui/views/Shell.xaml.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Windows;
using gorilla.utility;
@@ -20,6 +21,11 @@ namespace solidware.financials.windows.ui.views
{Tabs.GetType(), Tabs},
{SelectedFamilyMember.GetType(), SelectedFamilyMember},
};
+ DockManager.Loaded += (o, e) =>
+ {
+ if(File.Exists(settings_file)) DockManager.RestoreLayout(settings_file);
+ };
+ this.Closing += (o, e) => DockManager.SaveLayout(settings_file);
}
public void region<Region>(Action<Region> configure) where Region : UIElement
@@ -35,5 +41,6 @@ namespace solidware.financials.windows.ui.views
}
readonly IDictionary<Type, UIElement> regions;
+ string settings_file = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), @"mokhan.ca\momoney\default.ui.settings");
}
}
\ No newline at end of file
product/desktop.ui/views/StatusBarRegion.xaml
@@ -1,6 +1,6 @@
<UserControl x:Class="solidware.financials.windows.ui.views.StatusBarRegion"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Background="Blue" HorizontalContentAlignment="Right">
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" HorizontalContentAlignment="Right">
<StatusBar>
<StatusBar.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
product/desktop.ui/ApplicationController.cs
@@ -2,7 +2,7 @@ using System.Windows;
namespace solidware.financials.windows.ui
{
- public interface ApplicationController : DialogLauncher
+ public interface ApplicationController
{
void add_tab<Presenter, Tab>() where Presenter : TabPresenter
where Tab : FrameworkElement, Tab<Presenter>, new();
product/desktop.ui/solidware.financials.csproj
@@ -181,6 +181,7 @@
<Compile Include="WPFApplication.cs" />
<Compile Include="WPFApplicationController.cs" />
<Compile Include="RegionManager.cs" />
+ <Compile Include="WPFDialogLauncher.cs" />
<Compile Include="WPFPresenterFactory.cs" />
</ItemGroup>
<ItemGroup>
product/desktop.ui/WPFApplicationController.cs
@@ -1,6 +1,5 @@
using System;
using System.Windows;
-using System.Windows.Controls;
using AvalonDock;
using solidware.financials.infrastructure.eventing;
@@ -24,11 +23,6 @@ namespace solidware.financials.windows.ui
where View : FrameworkElement, Tab<Presenter>, new()
{
var presenter = open<Presenter>();
- //configure_region<TabControl>(x => x.Items.Add(new TabItem
- //{
- // Header = presenter.Header,
- // Content = new View {DataContext = presenter}
- //}));
configure_region<DocumentPane>(x => x.Items.Add(new DocumentContent
{
Title = presenter.Header,
@@ -36,12 +30,6 @@ namespace solidware.financials.windows.ui
}));
}
- public void launch<Presenter, Dialog>() where Presenter : DialogPresenter
- where Dialog : FrameworkElement, Dialog<Presenter>, new()
- {
- new Dialog().open(factory.create<Presenter>());
- }
-
public void load_region<TPresenter, Region>() where TPresenter : Presenter
where Region : FrameworkElement, View<TPresenter>, new()
{
product/desktop.ui/WPFDialogLauncher.cs
@@ -0,0 +1,19 @@
+using System.Windows;
+
+namespace solidware.financials.windows.ui
+{
+ public class WPFDialogLauncher : DialogLauncher
+ {
+ PresenterFactory factory;
+
+ public WPFDialogLauncher(PresenterFactory factory)
+ {
+ this.factory = factory;
+ }
+
+ public void launch<Presenter, Dialog>() where Presenter : DialogPresenter where Dialog : FrameworkElement, Dialog<Presenter>, new()
+ {
+ new Dialog().open(factory.create<Presenter>());
+ }
+ }
+}
\ No newline at end of file
product/desktop.ui/WPFPresenterFactory.cs
@@ -11,9 +11,9 @@ namespace solidware.financials.windows.ui
this.container = container;
}
- public T create<T>() where T : Presenter
+ public TPresenter create<TPresenter>() where TPresenter : Presenter
{
- return container.get_a<T>();
+ return container.get_a<TPresenter>();
}
}
}
\ No newline at end of file