summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--product/desktop.ui/handlers/PublishEventHandler.cs8
-rw-r--r--product/desktop.ui/presenters/StockWatchPresenter.cs7
-rw-r--r--product/desktop.ui/presenters/UIThread.cs16
-rw-r--r--product/desktop.ui/solidware.financials.csproj5
-rw-r--r--product/desktop.ui/views/Shell.xaml2
-rw-r--r--product/desktop.ui/views/Shell.xaml.cs1
-rw-r--r--product/desktop.ui/views/TrayIcon.cs3
-rw-r--r--product/desktop.ui/views/icons/UIIcon.cs2
-rw-r--r--product/desktop.ui/views/icons/down.pngbin0 -> 477 bytes
-rw-r--r--product/desktop.ui/views/icons/up.pngbin0 -> 477 bytes
-rw-r--r--product/messages/AddIncomeCommandMessage.cs6
-rw-r--r--product/messages/AddedNewFamilyMember.cs9
-rw-r--r--product/messages/Announcement.cs14
-rw-r--r--product/messages/CurrentStockPrice.cs8
-rw-r--r--product/messages/StartWatchingSymbol.cs8
-rw-r--r--product/messages/messages.csproj1
16 files changed, 74 insertions, 16 deletions
diff --git a/product/desktop.ui/handlers/PublishEventHandler.cs b/product/desktop.ui/handlers/PublishEventHandler.cs
index df14859..dfaee7a 100644
--- a/product/desktop.ui/handlers/PublishEventHandler.cs
+++ b/product/desktop.ui/handlers/PublishEventHandler.cs
@@ -1,11 +1,11 @@
-using gorilla.utility;
-using solidware.financials.infrastructure;
+using solidware.financials.infrastructure;
using solidware.financials.infrastructure.eventing;
+using solidware.financials.messages;
using solidware.financials.windows.ui.views;
namespace solidware.financials.windows.ui.handlers
{
- public class PublishEventHandler<T> : Handles<T> where T : Event
+ public class PublishEventHandler<T> : Handles<T> where T : Announcement
{
EventAggregator event_aggregator;
RegionManager region_manager;
@@ -21,7 +21,7 @@ namespace solidware.financials.windows.ui.handlers
event_aggregator.publish(item);
region_manager.region<TrayIcon>(x =>
{
- x.Say("{0}".format(item));
+ item.AnnounceUsing(x);
});
}
}
diff --git a/product/desktop.ui/presenters/StockWatchPresenter.cs b/product/desktop.ui/presenters/StockWatchPresenter.cs
index d1e9a84..6b5c7ef 100644
--- a/product/desktop.ui/presenters/StockWatchPresenter.cs
+++ b/product/desktop.ui/presenters/StockWatchPresenter.cs
@@ -29,14 +29,17 @@ namespace solidware.financials.windows.ui.presenters
public void present()
{
- timer.start_notifying(this, new TimeSpan(0, 1, 0));
+ timer.start_notifying(this, new TimeSpan(0, 0, 20));
AddSymbol = builder.build<AddSymbolCommand>(this);
Refresh = builder.build<RefreshStockPricesCommand>(this);
}
public void notify()
{
- Refresh.Execute(this);
+ UIThread.Run(() =>
+ {
+ Refresh.Execute(this);
+ });
}
public void notify(CurrentStockPrice message)
diff --git a/product/desktop.ui/presenters/UIThread.cs b/product/desktop.ui/presenters/UIThread.cs
new file mode 100644
index 0000000..0216df4
--- /dev/null
+++ b/product/desktop.ui/presenters/UIThread.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Windows;
+
+namespace solidware.financials.windows.ui.presenters
+{
+ static public class UIThread
+ {
+ static public void Run(Action action)
+ {
+ if (Application.Current != null)
+ Application.Current.Dispatcher.BeginInvoke(action);
+ else
+ action();
+ }
+ }
+} \ No newline at end of file
diff --git a/product/desktop.ui/solidware.financials.csproj b/product/desktop.ui/solidware.financials.csproj
index 23936cb..29f0cc6 100644
--- a/product/desktop.ui/solidware.financials.csproj
+++ b/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="presenters\UIThread.cs" />
<Compile Include="presenters\validation\AnonymousRule.cs" />
<Compile Include="presenters\validation\Error.cs" />
<Compile Include="presenters\validation\INotification.cs" />
@@ -396,6 +397,10 @@
<ItemGroup>
<EmbeddedResource Include="views\icons\mokhan.ico" />
</ItemGroup>
+ <ItemGroup>
+ <EmbeddedResource Include="views\icons\down.png" />
+ <EmbeddedResource Include="views\icons\up.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/product/desktop.ui/views/Shell.xaml b/product/desktop.ui/views/Shell.xaml
index c265ff3..272aaf6 100644
--- a/product/desktop.ui/views/Shell.xaml
+++ b/product/desktop.ui/views/Shell.xaml
@@ -1,4 +1,4 @@
-<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:controls="clr-namespace:solidware.financials.windows.ui.views.controls" Title="Family Finances - (ALPHA)" MinWidth="1024" MinHeight="768" WindowStartupLocation="CenterScreen" WindowState="Maximized">
+<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:controls="clr-namespace:solidware.financials.windows.ui.views.controls" Title="Family Finances - (ALPHA)" MinWidth="1024" MinHeight="768" WindowStartupLocation="CenterScreen" WindowState="Maximized" ShowInTaskbar="False">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="24" />
diff --git a/product/desktop.ui/views/Shell.xaml.cs b/product/desktop.ui/views/Shell.xaml.cs
index 0f5b5c5..ccef418 100644
--- a/product/desktop.ui/views/Shell.xaml.cs
+++ b/product/desktop.ui/views/Shell.xaml.cs
@@ -34,7 +34,6 @@ namespace solidware.financials.windows.ui.views
Loaded += (o, e) =>
{
TaskBarIcon.Icon = UIIcon.Application.AsIcon();
- TaskBarIcon.Say("Welcome");
};
}
diff --git a/product/desktop.ui/views/TrayIcon.cs b/product/desktop.ui/views/TrayIcon.cs
index e50156b..6827aaa 100644
--- a/product/desktop.ui/views/TrayIcon.cs
+++ b/product/desktop.ui/views/TrayIcon.cs
@@ -1,10 +1,11 @@
using System.Windows.Controls.Primitives;
using Hardcodet.Wpf.TaskbarNotification;
+using solidware.financials.messages;
using solidware.financials.windows.ui.presenters;
namespace solidware.financials.windows.ui.views
{
- public class TrayIcon : TaskbarIcon
+ public class TrayIcon : TaskbarIcon, Announcer
{
public virtual void Say(string message)
{
diff --git a/product/desktop.ui/views/icons/UIIcon.cs b/product/desktop.ui/views/icons/UIIcon.cs
index e762ac6..b23985d 100644
--- a/product/desktop.ui/views/icons/UIIcon.cs
+++ b/product/desktop.ui/views/icons/UIIcon.cs
@@ -19,6 +19,8 @@ namespace solidware.financials.windows.ui.views.icons
static public readonly UIIcon Application = new UIIcon("mokhan.ico");
static public readonly UIIcon Close = new UIIcon("close.png");
static public readonly UIIcon Info = new UIIcon("info.png");
+ static public readonly UIIcon Up = new UIIcon("up.png");
+ static public readonly UIIcon Down = new UIIcon("down.png");
UIIcon(string path)
{
diff --git a/product/desktop.ui/views/icons/down.png b/product/desktop.ui/views/icons/down.png
new file mode 100644
index 0000000..72d83b0
--- /dev/null
+++ b/product/desktop.ui/views/icons/down.png
Binary files differ
diff --git a/product/desktop.ui/views/icons/up.png b/product/desktop.ui/views/icons/up.png
new file mode 100644
index 0000000..6ae1fbf
--- /dev/null
+++ b/product/desktop.ui/views/icons/up.png
Binary files differ
diff --git a/product/messages/AddIncomeCommandMessage.cs b/product/messages/AddIncomeCommandMessage.cs
index 85e20bb..5adb991 100644
--- a/product/messages/AddIncomeCommandMessage.cs
+++ b/product/messages/AddIncomeCommandMessage.cs
@@ -11,7 +11,7 @@ namespace solidware.financials.messages
public DateTime Date { get; set; }
}
- public class IncomeMessage : ValueType<IncomeMessage>, Event
+ public class IncomeMessage : ValueType<IncomeMessage>, Announcement
{
public Guid PersonId { get; set; }
public decimal Amount { get; set; }
@@ -21,5 +21,9 @@ namespace solidware.financials.messages
{
return "You got paid {0:C}!".format(Amount);
}
+
+ public void AnnounceUsing(Announcer announcer)
+ {
+ }
}
} \ No newline at end of file
diff --git a/product/messages/AddedNewFamilyMember.cs b/product/messages/AddedNewFamilyMember.cs
index 201a914..880920c 100644
--- a/product/messages/AddedNewFamilyMember.cs
+++ b/product/messages/AddedNewFamilyMember.cs
@@ -1,11 +1,11 @@
using System;
using gorilla.utility;
-using solidware.financials.infrastructure.eventing;
namespace solidware.financials.messages
{
- public class AddedNewFamilyMember : Event
+ public class AddedNewFamilyMember : Announcement
{
+ public AddedNewFamilyMember() {}
public Guid id { get; set; }
public string first_name { get; set; }
public string last_name { get; set; }
@@ -14,5 +14,10 @@ namespace solidware.financials.messages
{
return "Welcome to the family {0} {1}".format(first_name, last_name);
}
+
+ public void AnnounceUsing(Announcer announcer)
+ {
+ //announcer.Say(ToString());
+ }
}
} \ No newline at end of file
diff --git a/product/messages/Announcement.cs b/product/messages/Announcement.cs
new file mode 100644
index 0000000..292b7bf
--- /dev/null
+++ b/product/messages/Announcement.cs
@@ -0,0 +1,14 @@
+using solidware.financials.infrastructure.eventing;
+
+namespace solidware.financials.messages
+{
+ public interface Announcement : Event
+ {
+ void AnnounceUsing(Announcer announcer);
+ }
+
+ public interface Announcer
+ {
+ void Say(string message);
+ }
+} \ No newline at end of file
diff --git a/product/messages/CurrentStockPrice.cs b/product/messages/CurrentStockPrice.cs
index 1f95e4d..99dad42 100644
--- a/product/messages/CurrentStockPrice.cs
+++ b/product/messages/CurrentStockPrice.cs
@@ -1,10 +1,9 @@
using System.Text;
using gorilla.utility;
-using solidware.financials.infrastructure.eventing;
namespace solidware.financials.messages
{
- public class CurrentStockPrice : ValueType<CurrentStockPrice>, Event
+ public class CurrentStockPrice : ValueType<CurrentStockPrice>, Announcement
{
public string Symbol { get; set; }
public decimal Price { get; set; }
@@ -23,5 +22,10 @@ namespace solidware.financials.messages
//builder.AppendLine("O:{0:C} H:{1:C} L:{2:C}".format(Open, High, Low));
return builder.ToString();
}
+
+ public void AnnounceUsing(Announcer announcer)
+ {
+ announcer.Say(ToString());
+ }
}
} \ No newline at end of file
diff --git a/product/messages/StartWatchingSymbol.cs b/product/messages/StartWatchingSymbol.cs
index 6322d61..7e9ae6c 100644
--- a/product/messages/StartWatchingSymbol.cs
+++ b/product/messages/StartWatchingSymbol.cs
@@ -1,9 +1,8 @@
using gorilla.utility;
-using solidware.financials.infrastructure.eventing;
namespace solidware.financials.messages
{
- public class StartWatchingSymbol : ValueType<StartWatchingSymbol>, Event
+ public class StartWatchingSymbol : ValueType<StartWatchingSymbol>, Announcement
{
public string Symbol { get; set; }
@@ -11,5 +10,10 @@ namespace solidware.financials.messages
{
return "I will start watching {0}".format(Symbol);
}
+
+ public void AnnounceUsing(Announcer announcer)
+ {
+ announcer.Say(ToString());
+ }
}
} \ No newline at end of file
diff --git a/product/messages/messages.csproj b/product/messages/messages.csproj
index 7d08e75..b784e63 100644
--- a/product/messages/messages.csproj
+++ b/product/messages/messages.csproj
@@ -46,6 +46,7 @@
<ItemGroup>
<Compile Include="AddedNewFamilyMember.cs" />
<Compile Include="AddIncomeCommandMessage.cs" />
+ <Compile Include="Announcement.cs" />
<Compile Include="CurrentStockPrice.cs" />
<Compile Include="FamilyMemberToAdd.cs" />
<Compile Include="FindAllFamily.cs" />