Commit 25b10c4

mo <email@solidware.ca>
2011-03-28 02:18:21
tidy up the toast pop ups.
1 parent 49ecbba
product/desktop.ui/handlers/PublishEventHandler.cs
@@ -1,6 +1,4 @@
-using System.Windows.Controls.Primitives;
-using gorilla.utility;
-using Hardcodet.Wpf.TaskbarNotification;
+using gorilla.utility;
 using solidware.financials.infrastructure;
 using solidware.financials.infrastructure.eventing;
 using solidware.financials.windows.ui.views;
@@ -21,15 +19,10 @@ namespace solidware.financials.windows.ui.handlers
         public void handle(T item)
         {
             event_aggregator.publish(item);
-            region_manager.region<TaskbarIcon>(x =>
+            region_manager.region<TrayIcon>(x =>
             {
-                x.ShowCustomBalloon(new FancyBalloon {DataContext = new BalloonMessage {BalloonText = "Received {0}".format(typeof (T))}}, PopupAnimation.Slide, 4000);
+                x.Say("Received {0}".format(item));
             });
         }
     }
-
-    public class BalloonMessage
-    {
-        public string BalloonText { get; set; }
-    }
 }
\ No newline at end of file
product/desktop.ui/presenters/ButtonBarPresenter.cs
@@ -44,7 +44,9 @@ namespace solidware.financials.windows.ui.presenters
 
         public void notify(AddedNewFamilyMember message)
         {
-            family_members.Add(mapper.map_from<AddedNewFamilyMember, PersonDetails>(message));
+            var person = mapper.map_from<AddedNewFamilyMember, PersonDetails>(message);
+            if (null == selected_member) SelectedMember = person;
+            family_members.Add(person);
             update(x => x.family_members);
         }
     }
product/desktop.ui/presenters/ToastViewModel.cs
@@ -0,0 +1,7 @@
+namespace solidware.financials.windows.ui.presenters
+{
+    public class ToastViewModel
+    {
+        public string BalloonText { get; set; }
+    }
+}
\ No newline at end of file
product/desktop.ui/views/images/close.png → product/desktop.ui/views/icons/close.png
File renamed without changes
product/desktop.ui/views/images/info.png → product/desktop.ui/views/icons/info.png
File renamed without changes
product/desktop.ui/views/icons/UIIcon.cs
@@ -17,10 +17,10 @@ namespace solidware.financials.windows.ui.views.icons
         static public readonly UIIcon Running = new UIIcon("running.gif");
         static public readonly UIIcon Success = new UIIcon("success.png");
         static public readonly UIIcon Application = new UIIcon("mokhan.ico");
-        static public readonly UIIcon Close = new UIIcon("success.png");
-        static public readonly UIIcon Info = new UIIcon("success.png");
+        static public readonly UIIcon Close = new UIIcon("close.png");
+        static public readonly UIIcon Info = new UIIcon("info.png");
 
-        protected UIIcon(string path)
+        UIIcon(string path)
         {
             this.path = path;
         }
product/desktop.ui/views/Shell.xaml
@@ -1,6 +1,6 @@
 <Window x:Class="solidware.financials.windows.ui.views.Shell"
   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock" xmlns:views="clr-namespace:solidware.financials.windows.ui.views" xmlns:TaskbarNotification="clr-namespace:Hardcodet.Wpf.TaskbarNotification;assembly=Hardcodet.Wpf.TaskbarNotification" Title="MoMoney - (ALPHA)" MinWidth="1024" MinHeight="768" WindowStartupLocation="CenterScreen" WindowState="Maximized">
+  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock" xmlns:views="clr-namespace:solidware.financials.windows.ui.views" Title="MoMoney - (ALPHA)" MinWidth="1024" MinHeight="768" WindowStartupLocation="CenterScreen" WindowState="Maximized">
   <Grid>
     <Grid.RowDefinitions>
       <RowDefinition Height="24"/>
@@ -20,25 +20,42 @@
                     <TreeViewItem Header="January"></TreeViewItem>
                     <TreeViewItem Header="February"></TreeViewItem>
                     <TreeViewItem Header="March"></TreeViewItem>
+                    <TreeViewItem Header="April"></TreeViewItem>
+                    <TreeViewItem Header="May"></TreeViewItem>
+                    <TreeViewItem Header="June"></TreeViewItem>
+                    <TreeViewItem Header="July"></TreeViewItem>
+                    <TreeViewItem Header="August"></TreeViewItem>
+                    <TreeViewItem Header="September"></TreeViewItem>
+                    <TreeViewItem Header="October"></TreeViewItem>
+                    <TreeViewItem Header="November"></TreeViewItem>
+                    <TreeViewItem Header="December"></TreeViewItem>
                 </TreeViewItem>
                 <TreeViewItem Header="2010">
                     <TreeViewItem Header="January"></TreeViewItem>
                     <TreeViewItem Header="February"></TreeViewItem>
                     <TreeViewItem Header="March"></TreeViewItem>
+                    <TreeViewItem Header="April"></TreeViewItem>
+                    <TreeViewItem Header="May"></TreeViewItem>
+                    <TreeViewItem Header="June"></TreeViewItem>
+                    <TreeViewItem Header="July"></TreeViewItem>
+                    <TreeViewItem Header="August"></TreeViewItem>
+                    <TreeViewItem Header="September"></TreeViewItem>
+                    <TreeViewItem Header="October"></TreeViewItem>
+                    <TreeViewItem Header="November"></TreeViewItem>
+                    <TreeViewItem Header="December"></TreeViewItem>
                 </TreeViewItem>
             </TreeView>
             </ad:DockableContent>
-            <ad:DockableContent x:Name="toolsContent" Title="Tools">
+            <ad:DockableContent x:Name="stocksContent" Title="Stocks">
               <ListBox>
-                <ListBoxItem Content="Tool1"/>
-                <ListBoxItem Content="Tool2"/>
-                <ListBoxItem Content="Tool3"/>
+                <ListBoxItem Content="ARX.TO"/>
+                <ListBoxItem Content="TD.TO"/>
               </ListBox>
             </ad:DockableContent>
           </ad:DockablePane>
           <ad:DocumentPane Name="Tabs"></ad:DocumentPane>
         </ad:ResizingPanel>
-        <ad:DockablePane ad:ResizingPanel.ResizeHeight="100">
+        <!--<ad:DockablePane ad:ResizingPanel.ResizeHeight="100">
           <ad:DockableContent Title="Errors" x:Name="errorsContent">
             <ListView>
               <ListView.View>
@@ -56,10 +73,10 @@
           <ad:DockableContent Title="Output" x:Name="output">
             <TextBox IsReadOnly="True" AcceptsReturn="True"/>
           </ad:DockableContent>
-        </ad:DockablePane>
+        </ad:DockablePane>-->
       </ad:ResizingPanel>
     </ad:DockingManager>
     <views:StatusBarRegion x:Name="StatusBar" Grid.Row="3"></views:StatusBarRegion>
-    <TaskbarNotification:TaskbarIcon Name="TaskBarIcon" />
+    <views:TrayIcon x:Name="TaskBarIcon" />
     </Grid>
 </Window>
product/desktop.ui/views/Shell.xaml.cs
@@ -2,9 +2,7 @@
 using System.Collections.Generic;
 using System.IO;
 using System.Windows;
-using System.Windows.Controls.Primitives;
 using gorilla.utility;
-using solidware.financials.windows.ui.handlers;
 using solidware.financials.windows.ui.views.icons;
 
 namespace solidware.financials.windows.ui.views
@@ -34,7 +32,7 @@ namespace solidware.financials.windows.ui.views
             Loaded += (o, e) =>
             {
                 TaskBarIcon.Icon = UIIcon.Application.AsIcon();
-                TaskBarIcon.ShowCustomBalloon(new FancyBalloon { DataContext = new BalloonMessage { BalloonText = "Welcome"} }, PopupAnimation.Slide, 4000);
+                TaskBarIcon.Say("Welcome");
             };
         }
 
product/desktop.ui/views/FancyBalloon.xaml → product/desktop.ui/views/Toast.xaml
@@ -1,8 +1,7 @@
-<UserControl x:Class="solidware.financials.windows.ui.views.FancyBalloon"
+<UserControl x:Class="solidware.financials.windows.ui.views.Toast"
              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:tb="clr-namespace:Hardcodet.Wpf.TaskbarNotification;assembly=Hardcodet.Wpf.TaskbarNotification" 
-             Height="120" Width="240">
+             xmlns:tb="clr-namespace:Hardcodet.Wpf.TaskbarNotification;assembly=Hardcodet.Wpf.TaskbarNotification" xmlns:views="clr-namespace:solidware.financials.windows.ui.views" Height="120" Width="240">
 	<UserControl.Resources>
 		<Storyboard x:Key="FadeIn">
 			<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="grid" Storyboard.TargetProperty="(UIElement.Opacity)">
@@ -38,7 +37,7 @@
 		</Storyboard>
 	</UserControl.Resources>
 	<UserControl.Triggers>
-		<EventTrigger RoutedEvent="tb:TaskbarIcon.BalloonShowing">
+		<EventTrigger RoutedEvent="views:TrayIcon.BalloonShowing">
 			<BeginStoryboard Storyboard="{StaticResource FadeIn}" x:Name="FadeIn_BeginStoryboard"/>
 		</EventTrigger>
 		<EventTrigger RoutedEvent="Mouse.MouseEnter" SourceName="closeImage">
@@ -51,7 +50,7 @@
 			<StopStoryboard BeginStoryboardName="FadeIn_BeginStoryboard"/>
 			<BeginStoryboard x:Name="FadeBack_BeginStoryboard1" Storyboard="{StaticResource FadeBack}"/>
 		</EventTrigger>
-		<EventTrigger RoutedEvent="tb:TaskbarIcon.BalloonClosing">
+		<EventTrigger RoutedEvent="views:TrayIcon.BalloonClosing">
 			<BeginStoryboard Storyboard="{StaticResource FadeOut}" x:Name="FadeOut_BeginStoryboard"/>
 		</EventTrigger>
 	</UserControl.Triggers>
product/desktop.ui/views/FancyBalloon.xaml.cs → product/desktop.ui/views/Toast.xaml.cs
@@ -2,21 +2,20 @@
 using System.Windows;
 using System.Windows.Controls.Primitives;
 using System.Windows.Input;
-using Hardcodet.Wpf.TaskbarNotification;
 using solidware.financials.windows.ui.views.icons;
 
 namespace solidware.financials.windows.ui.views
 {
-    public partial class FancyBalloon
+    public partial class Toast
     {
         bool isClosing;
 
-        public FancyBalloon()
+        public Toast()
         {
             InitializeComponent();
             closeImage.apply_icon(UIIcon.Close);
             infoImage.apply_icon(UIIcon.Info);
-            TaskbarIcon.AddBalloonClosingHandler(this, OnBalloonClosing);
+            TrayIcon.AddBalloonClosingHandler(this, OnBalloonClosing);
         }
 
         void OnBalloonClosing(object sender, RoutedEventArgs e)
@@ -27,13 +26,13 @@ namespace solidware.financials.windows.ui.views
 
         void imgClose_MouseDown(object sender, MouseButtonEventArgs e)
         {
-            TaskbarIcon.GetParentTaskbarIcon(this).CloseBalloon();
+            TrayIcon.GetParentTaskbarIcon(this).CloseBalloon();
         }
 
         void grid_MouseEnter(object sender, MouseEventArgs e)
         {
             if (isClosing) return;
-            TaskbarIcon.GetParentTaskbarIcon(this).ResetBalloonCloseTimer();
+            TrayIcon.GetParentTaskbarIcon(this).ResetBalloonCloseTimer();
         }
 
         void OnFadeOutCompleted(object sender, EventArgs e)
product/desktop.ui/views/TrayIcon.cs
@@ -0,0 +1,14 @@
+using System.Windows.Controls.Primitives;
+using Hardcodet.Wpf.TaskbarNotification;
+using solidware.financials.windows.ui.presenters;
+
+namespace solidware.financials.windows.ui.views
+{
+    public class TrayIcon : TaskbarIcon
+    {
+        public virtual void Say(string message)
+        {
+            ShowCustomBalloon(new Toast {DataContext = new ToastViewModel {BalloonText = message}}, PopupAnimation.Slide, 4000);
+        }
+    }
+}
\ No newline at end of file
product/desktop.ui/solidware.financials.csproj
@@ -137,6 +137,7 @@
     <Compile Include="presenters\ButtonBarPresenter.cs" />
     <Compile Include="presenters\TaxSummaryPresenter.cs" />
     <Compile Include="presenters\StatusBarPresenter.cs" />
+    <Compile Include="presenters\ToastViewModel.cs" />
     <Compile Include="presenters\WpfBindingExtensinos.cs" />
     <Compile Include="presenters\WpfCommandBuilder.cs" />
     <Compile Include="Program.cs" />
@@ -180,9 +181,10 @@
     <Compile Include="views\TaxSummaryTab.xaml.cs">
       <DependentUpon>TaxSummaryTab.xaml</DependentUpon>
     </Compile>
-    <Compile Include="views\FancyBalloon.xaml.cs">
-      <DependentUpon>FancyBalloon.xaml</DependentUpon>
+    <Compile Include="views\Toast.xaml.cs">
+      <DependentUpon>Toast.xaml</DependentUpon>
     </Compile>
+    <Compile Include="views\TrayIcon.cs" />
     <Compile Include="views\WPFExtensions.cs" />
     <Compile Include="WPFDialog.cs" />
     <Compile Include="WPFApplication.cs" />
@@ -255,7 +257,7 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
-    <Page Include="views\FancyBalloon.xaml">
+    <Page Include="views\Toast.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
@@ -338,8 +340,8 @@
     <EmbeddedResource Include="views\icons\success.png" />
   </ItemGroup>
   <ItemGroup>
-    <Resource Include="views\images\close.png" />
-    <Resource Include="views\images\info.png" />
+    <EmbeddedResource Include="views\icons\close.png" />
+    <EmbeddedResource Include="views\icons\info.png" />
   </ItemGroup>
   <ItemGroup>
     <EmbeddedResource Include="views\icons\mokhan.ico" />
product/service/orm/DB4OConnectionFactory.cs
@@ -1,7 +1,6 @@
 using System;
 using System.IO;
 using Db4objects.Db4o;
-using Db4objects.Db4o.Config;
 
 namespace solidware.financials.service.orm
 {