Commit 4f4a7a9

mo <email@solidware.ca>
2011-04-03 03:00:44
start building add new stock symbol dialog, and hooked up StopEssentialServices on shutdown.
1 parent 690a454
product/desktop.ui/bootstrappers/Bootstrapper.cs
@@ -17,6 +17,7 @@ using solidware.financials.windows.ui.presenters;
 using solidware.financials.windows.ui.presenters.specifications;
 using solidware.financials.windows.ui.views;
 using utility;
+using Timer = gorilla.infrastructure.threading.Timer;
 
 namespace solidware.financials.windows.ui.bootstrappers
 {
@@ -45,8 +46,12 @@ namespace solidware.financials.windows.ui.bootstrappers
             register_for_message_to_listen_for(builder);
             server_registration(builder);
 
-            shell_window.Closed += (o, e) => Resolve.the<CommandProcessor>().stop();
-            shell_window.Closed += (o, e) => Resolve.the<IEnumerable<NeedsShutdown>>();
+            builder.RegisterType<StopEssentialServices>().As<NeedsShutdown>();
+
+            shell_window.Closed += (o, e) =>
+            {
+                Resolve.the<IEnumerable<NeedsShutdown>>().each(x => x.run());
+            };
 
             Resolve.initialize_with(new AutofacDependencyRegistry(builder));
             Resolve.the<IEnumerable<NeedStartup>>().each(x => x.run());
@@ -74,6 +79,8 @@ namespace solidware.financials.windows.ui.bootstrappers
             //builder.Register<SynchronousCommandProcessor>().As<CommandProcessor>().SingleInstance();
             builder.RegisterType<WPFCommandBuilder>().As<UICommandBuilder>();
             builder.RegisterType<InMemoryApplicationState>().As<ApplicationState>().SingleInstance();
+
+            builder.RegisterType<IntervalTimer>().As<Timer>().SingleInstance();
         }
 
         static void register_presenters(ContainerBuilder builder)
@@ -96,6 +103,11 @@ namespace solidware.financials.windows.ui.bootstrappers
             builder.RegisterType<DisplayCanadianTaxInformationViewModel>();
 
             builder.RegisterType<StockWatchPresenter>();
+            builder.RegisterType<StockWatchPresenter.AddSymbolCommand>();
+            builder.RegisterType<StockWatchPresenter.RefreshStockPricesCommand>();
+
+            builder.RegisterType<AddNewStockSymbolPresenter>();
+            builder.RegisterType<AddNewStockSymbolPresenter.AddCommand>();
         }
 
         static void register_for_message_to_listen_for(ContainerBuilder builder)
@@ -122,7 +134,7 @@ namespace solidware.financials.windows.ui.bootstrappers
                 });
             });
 
-            var interceptor = new UnitOfWorkInterceptor(new DB40UnitOfWorkFactory(new DB4OConnectionFactory(), Lazy.load<Context>()) );
+            var interceptor = new UnitOfWorkInterceptor(new DB40UnitOfWorkFactory(new DB4OConnectionFactory(), Lazy.load<Context>()));
             builder.RegisterProxy<Handles<FamilyMemberToAdd>, AddNewFamilyMemberHandler>(interceptor);
             builder.RegisterProxy<Handles<FindAllFamily>, FindAllFamilyHandler>(interceptor);
             builder.RegisterProxy<Handles<FindAllIncome>, FindAllIncomeHandler>(interceptor);
product/desktop.ui/bootstrappers/StopEssentialServices.cs
@@ -0,0 +1,22 @@
+using gorilla.infrastructure.container;
+using gorilla.infrastructure.threading;
+using utility;
+
+namespace solidware.financials.windows.ui.bootstrappers
+{
+    public class StopEssentialServices : NeedsShutdown
+    {
+        DependencyRegistry registry;
+
+        public StopEssentialServices(DependencyRegistry registry)
+        {
+            this.registry = registry;
+        }
+
+        public void run()
+        {
+            registry.get_a<CommandProcessor>().stop();
+            registry.get_a<Timer>().Dispose();
+        }
+    }
+}
\ No newline at end of file
product/desktop.ui/views/dialogs/AddNewStockSymbolDialog.xaml
@@ -1,8 +1,12 @@
-<Window x:Class="solidware.financials.windows.ui.views.dialogs.AddNewStockSymbolDialog"
-        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-        Title="AddNewStockSymbolDialog" Height="300" Width="300">
-    <Grid>
-        
-    </Grid>
-</Window>
+<ui:WPFDialog x:Class="solidware.financials.windows.ui.views.dialogs.AddNewStockSymbolDialog" xmlns:ui="clr-namespace:solidware.financials.windows.ui" x:TypeArguments="presenters:AddNewStockSymbolPresenter" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:presenters="clr-namespace:solidware.financials.windows.ui.presenters" Title="AddNewStockSymbolDialog" Height="300" Width="300">
+    <StackPanel>
+        <DockPanel>
+            <Label Width="120px">Symbol:</Label>
+            <TextBox Text="{Binding Path=Symbol, UpdateSourceTrigger=PropertyChanged}"></TextBox>
+        </DockPanel>
+        <DockPanel LastChildFill="False" HorizontalAlignment="Right">
+            <Button IsDefault="True" Command="{Binding Path=Add}">_Add</Button>
+            <Button IsCancel="True" Command="{Binding Path=Cancel}">_Cancel</Button>
+        </DockPanel>
+    </StackPanel>
+</ui:WPFDialog>
\ No newline at end of file
product/desktop.ui/views/dialogs/AddNewStockSymbolDialog.xaml.cs
@@ -1,18 +1,10 @@
-using System;
-using solidware.financials.windows.ui.presenters;
-
-namespace solidware.financials.windows.ui.views.dialogs
+namespace solidware.financials.windows.ui.views.dialogs
 {
-    public partial class AddNewStockSymbolDialog : Dialog<AddNewStockSymbolPresenter>
+    public partial class AddNewStockSymbolDialog
     {
         public AddNewStockSymbolDialog()
         {
             InitializeComponent();
         }
-
-        public void open(AddNewStockSymbolPresenter presenter)
-        {
-            throw new NotImplementedException();
-        }
     }
 }
\ No newline at end of file
product/desktop.ui/solidware.financials.csproj
@@ -114,6 +114,7 @@
     <Compile Include="bootstrappers\ComposeShell.cs" />
     <Compile Include="bootstrappers\ConfigureMappings.cs" />
     <Compile Include="bootstrappers\DefaultMapper.cs" />
+    <Compile Include="bootstrappers\StopEssentialServices.cs" />
     <Compile Include="bootstrappers\WireUpSubscribers.cs" />
     <Compile Include="CancelCommand.cs" />
     <Compile Include="Dialog.cs" />
thirdparty/commons/gorilla.infrastructure.dll
Binary file
thirdparty/commons/gorilla.utility.dll
Binary file