Commit 628d122

mo <email@solidware.ca>
2011-03-14 02:17:54
move canadian tax information to help menu in separate dialog.
1 parent dbbc6e3
product/desktop.ui/bootstrappers/Bootstrapper.cs
@@ -80,6 +80,8 @@ namespace desktop.ui.bootstrappers
             builder.RegisterType<AddNewIncomeViewModel.AddIncomeCommand>();
 
             builder.RegisterType<TaxSummaryPresenter>();
+            
+            builder.RegisterType<DisplayCanadianTaxInformationViewModel>();
         }
 
         static void register_for_message_to_listen_for(ContainerBuilder builder)
product/desktop.ui/bootstrappers/ComposeShell.cs
@@ -1,3 +1,4 @@
+using System.Windows;
 using desktop.ui.presenters;
 using desktop.ui.views;
 
@@ -20,20 +21,25 @@ namespace desktop.ui.bootstrappers
 
             region_manager.region<MainMenu>(x =>
             {
-                x.add("_Family").add("_Add Member", () =>
-                {
-                    controller.launch_dialog<AddFamilyMemberPresenter, AddFamilyMemberDialog>();
-                });
-                x.add("_Income").add("_Add Income", () => { 
-                    controller.launch_dialog<AddNewIncomeViewModel, AddNewIncomeDialog>();
-                }) ;
+                x.add("_Family")
+                    .add("_Add Member", launch<AddFamilyMemberPresenter, AddFamilyMemberDialog>);
+                x.add("_Income")
+                    .add("_Add Income", launch<AddNewIncomeViewModel, AddNewIncomeDialog>);
                 //x.add("_Deductions").add("_Add RRSP", () => { }) ;
                 //x.add("_Credits").add("_Add Credit", () => { }) ;
                 //x.add("_Benefits").add("_Add Benefit", () => { }) ;
+                x.add("_Help")
+                    .add("_Taxes", launch<DisplayCanadianTaxInformationViewModel, DisplayCanadianTaxInformationDialog>);
             });
 
             controller.load_region<StatusBarPresenter, StatusBarRegion>();
             controller.load_region<SelectedFamilyMemberPresenter, SelectedFamilyMemberRegion>();
         }
+
+        void launch<Presenter, Dialog>() where Presenter : DialogPresenter
+            where Dialog : FrameworkElement, Dialog<Presenter>, new()
+        {
+            controller.launch_dialog<Presenter, Dialog>();
+        }
     }
 }
\ No newline at end of file
product/desktop.ui/presenters/DisplayCanadianTaxInformationViewModel.cs
@@ -0,0 +1,13 @@
+using System;
+
+namespace desktop.ui.presenters
+{
+    public class DisplayCanadianTaxInformationViewModel : DialogPresenter
+    {
+        public void present()
+        {
+        }
+
+        public Action close { get; set; }
+    }
+}
\ No newline at end of file
product/desktop.ui/presenters/TaxSummaryPresenter.cs
@@ -1,11 +1,14 @@
-using desktop.ui.eventing;
+using System;
+using desktop.ui.eventing;
+using desktop.ui.events;
 
 namespace desktop.ui.presenters
 {
     public class TaxSummaryPresenter : Observable<TaxSummaryPresenter>, TabPresenter,
-                                       EventSubscriber<AddIncomeCommandMessage>
+                                       EventSubscriber<AddIncomeCommandMessage>, EventSubscriber<SelectedFamilyMember>
     {
         UICommandBuilder builder;
+        Guid person_id;
 
         public TaxSummaryPresenter(UICommandBuilder builder)
         {
@@ -45,5 +48,10 @@ namespace desktop.ui.presenters
             }
             update(x => x.Taxes, x => x.TotalIncome);
         }
+
+        public void notify(SelectedFamilyMember message)
+        {
+            person_id = message.id;
+        }
     }
 }
\ No newline at end of file
product/desktop.ui/views/DisplayCanadianTaxInformationDialog.xaml
@@ -0,0 +1,8 @@
+<Window x:Class="desktop.ui.views.DisplayCanadianTaxInformationDialog"
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        Title="DisplayCanadianTaxInformationDialog">
+    <DockPanel>
+        <WebBrowser x:Name="browser"></WebBrowser>
+    </DockPanel>
+</Window>
product/desktop.ui/views/DisplayCanadianTaxInformationDialog.xaml.cs
@@ -0,0 +1,21 @@
+using System;
+using System.Windows;
+using desktop.ui.presenters;
+
+namespace desktop.ui.views
+{
+    public partial class DisplayCanadianTaxInformationDialog : Dialog<DisplayCanadianTaxInformationViewModel>
+    {
+        public DisplayCanadianTaxInformationDialog()
+        {
+            InitializeComponent();
+            browser.Navigate(new Uri("http://www.cra-arc.gc.ca/tx/ndvdls/fq/txrts-eng.html"));
+        }
+
+        public void open()
+        {
+            Owner = Application.Current.MainWindow;
+            ShowDialog();
+        }
+    }
+}
\ No newline at end of file
product/desktop.ui/views/TaxSummaryTab.xaml
@@ -13,7 +13,6 @@
     * 26% on the next $45,712 of taxable income (on the portion of taxable income between $83,088 and $128,800), +
     * 29% of taxable income over $128,800.
         </TextBlock>
-        <WebBrowser x:Name="browser"></WebBrowser>
         <Label>Total Income:</Label>
         <Label Content="{Binding Path=TotalIncome}"></Label>
         
product/desktop.ui/views/TaxSummaryTab.xaml.cs
@@ -1,5 +1,4 @@
-using System;
-using desktop.ui.presenters;
+using desktop.ui.presenters;
 
 namespace desktop.ui.views
 {
@@ -8,7 +7,6 @@ namespace desktop.ui.views
         public TaxSummaryTab()
         {
             InitializeComponent();
-            browser.Navigate(new Uri("http://www.cra-arc.gc.ca/tx/ndvdls/fq/txrts-eng.html"));
         }
     }
 }
\ No newline at end of file
product/desktop.ui/ApplicationController.cs
@@ -2,10 +2,17 @@ using System.Windows;
 
 namespace desktop.ui
 {
-    public interface ApplicationController
+    public interface ApplicationController : DialogLauncher
+    {
+        void add_tab<Presenter, Tab>() where Presenter : TabPresenter
+            where Tab : FrameworkElement, Tab<Presenter>, new();
+
+        void load_region<Presenter, Region>() where Presenter : ui.Presenter
+            where Region : FrameworkElement, View<Presenter>, new();
+    }
+
+    public interface DialogLauncher
     {
-        void add_tab<Presenter, Tab>() where Presenter : TabPresenter where Tab : FrameworkElement, Tab<Presenter>, new();
         void launch_dialog<Presenter, Dialog>() where Presenter : DialogPresenter where Dialog : FrameworkElement, Dialog<Presenter>, new();
-        void load_region<Presenter, Region>() where Presenter : ui.Presenter where Region : FrameworkElement, View<Presenter>, new();
     }
 }
\ No newline at end of file
product/desktop.ui/desktop.ui.csproj
@@ -88,6 +88,7 @@
     <Compile Include="PresenterFactory.cs" />
     <Compile Include="presenters\AddFamilyMemberPresenter.cs" />
     <Compile Include="presenters\AddNewIncomeViewModel.cs" />
+    <Compile Include="presenters\DisplayCanadianTaxInformationViewModel.cs" />
     <Compile Include="presenters\PersonDetails.cs" />
     <Compile Include="presenters\SelectedFamilyMemberPresenter.cs" />
     <Compile Include="presenters\TaxSummaryPresenter.cs" />
@@ -109,6 +110,9 @@
     <Compile Include="views\AddNewIncomeDialog.xaml.cs">
       <DependentUpon>AddNewIncomeDialog.xaml</DependentUpon>
     </Compile>
+    <Compile Include="views\DisplayCanadianTaxInformationDialog.xaml.cs">
+      <DependentUpon>DisplayCanadianTaxInformationDialog.xaml</DependentUpon>
+    </Compile>
     <Compile Include="views\ErrorWindow.xaml.cs">
       <DependentUpon>ErrorWindow.xaml</DependentUpon>
     </Compile>
@@ -165,6 +169,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="views\DisplayCanadianTaxInformationDialog.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="views\ErrorWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
support/default.build
@@ -33,13 +33,9 @@
   </target>
 
   <target name="_publish.installer" depends="compile">
-    <echo message="url: ${publish.url}" />
-    <echo message="name: ${product.name}" />
-    <echo message="key file: ${key.file}" />
     <property name="project.file" value="${base.dir}\product\desktop.ui\desktop.ui.csproj" />
     <property name="support.url" value="http://solidware.ca/" />
     <property name="command.line" value='${project.file} /t:publish /m /p:UpdateEnabled=true /p:UpdateRequired=true /p:MinimumRequiredVersion=${version.number} /p:PublisherName="${publisher.name}" /p:ProductName="${product.name}" /p:PublishUrl=${publish.url} /p:InstallUrl=${publish.url} /p:UpdateUrl=${update.url} /p:Install=True /p:ApplicationVersion=${major}.${minor}.${build}.* /p:ApplicationRevision=${revision} /p:UpdateInterval=1 /p:UpdateIntervalUnits=Minutes /p:UpdateUrlEnabled=True /p:IsWebBootstrapper=True /p:InstallFrom=Web /p:PublishDir=${publish.dir} /p:ManifestKeyFile="${key.file}" /p:ManifestCertificateThumbprint="${key.file.thumbprint}" /p:SupportUrl=${support.url}' />
-    <echo message="${msbuild.exe} ${command.line}" />
     <exec program="${msbuild.exe}" commandline="${command.line}" />
   </target>
   
@@ -61,7 +57,7 @@
 
   <target name="prod.installer" depends="load.prod.properties">
     <echo message="prod.installer" />
-    <property name="publish.url" value="http://solidware.ca/downloads/apps/" />
+    <property name="publish.url" value="http://mokhan.ca/downloads/apps/momoney/" />
     <property name="update.url" value="${publish.url}" />
     <property name="publish.dir" value="${tmp.dir}\public\" />
     <property name="product.name" value="More Money" />