diff options
| author | mo <email@solidware.ca> | 2011-04-03 21:59:40 -0600 |
|---|---|---|
| committer | mo <email@solidware.ca> | 2011-04-03 21:59:40 -0600 |
| commit | c98a479e9101fc7f3d53f74a1933d9b5ea210910 (patch) | |
| tree | 8de8b839402fef384a31e03aa5dda2082c0d0451 | |
| parent | a0b5c11605baddef3b47e59b8f06eb756a8ac362 (diff) | |
wire up presenters into container, fix xaml, and we are now able to start updating charts for individual stocks.
| -rw-r--r-- | product/desktop.ui/WPFApplicationController.cs | 13 | ||||
| -rw-r--r-- | product/desktop.ui/bootstrappers/Bootstrapper.cs | 5 | ||||
| -rw-r--r-- | product/desktop.ui/presenters/AddNewStockSymbolPresenter.cs | 2 | ||||
| -rw-r--r-- | product/desktop.ui/presenters/SingleStockPresenter.cs | 2 | ||||
| -rw-r--r-- | product/desktop.ui/presenters/StockWatchPresenter.cs | 4 | ||||
| -rw-r--r-- | product/desktop.ui/views/SingleStockTab.xaml | 3 | ||||
| -rw-r--r-- | product/desktop.ui/views/StockWatch.xaml | 18 | ||||
| -rw-r--r-- | product/messages/StartWatchingSymbol.cs | 2 |
8 files changed, 31 insertions, 18 deletions
diff --git a/product/desktop.ui/WPFApplicationController.cs b/product/desktop.ui/WPFApplicationController.cs index 562653e..df8a668 100644 --- a/product/desktop.ui/WPFApplicationController.cs +++ b/product/desktop.ui/WPFApplicationController.cs @@ -23,17 +23,24 @@ namespace solidware.financials.windows.ui var presenter = open<Presenter>();
var view = new View();
view.bind_to(presenter);
- region_manager.region(new TabRegionConfiguration(presenter,view.downcast_to<FrameworkElement>()));
+ region_manager.region(new TabRegionConfiguration(presenter, view.downcast_to<FrameworkElement>()));
}
public void load_tab<Presenter, View>(Presenter presenter) where Presenter : TabPresenter where View : Tab<Presenter>, new()
{
- throw new NotImplementedException();
+ event_aggregator.subscribe(presenter);
+ presenter.present();
+ var view = new View();
+ view.bind_to(presenter);
+ region_manager.region(new TabRegionConfiguration(presenter, view.downcast_to<FrameworkElement>()));
}
public void load_region<TPresenter, Region>() where TPresenter : Presenter where Region : FrameworkElement, View<TPresenter>, new()
{
- configure_region<Region>(x => { x.DataContext = open<TPresenter>(); });
+ configure_region<Region>(x =>
+ {
+ x.DataContext = open<TPresenter>();
+ });
}
void configure_region<TRegion>(Action<TRegion> configure) where TRegion : UIElement
diff --git a/product/desktop.ui/bootstrappers/Bootstrapper.cs b/product/desktop.ui/bootstrappers/Bootstrapper.cs index 122d8ce..a352c61 100644 --- a/product/desktop.ui/bootstrappers/Bootstrapper.cs +++ b/product/desktop.ui/bootstrappers/Bootstrapper.cs @@ -108,6 +108,11 @@ namespace solidware.financials.windows.ui.bootstrappers builder.RegisterType<AddNewStockSymbolPresenter>();
builder.RegisterType<AddNewStockSymbolPresenter.AddCommand>();
+
+ builder.RegisterType<StockViewModel.MoreCommand>();
+
+ builder.RegisterType<SingleStockPresenter>();
+ builder.RegisterType<SingleStockPresenter.Factory>();
}
static void register_for_message_to_listen_for(ContainerBuilder builder)
diff --git a/product/desktop.ui/presenters/AddNewStockSymbolPresenter.cs b/product/desktop.ui/presenters/AddNewStockSymbolPresenter.cs index 5faa659..07706ca 100644 --- a/product/desktop.ui/presenters/AddNewStockSymbolPresenter.cs +++ b/product/desktop.ui/presenters/AddNewStockSymbolPresenter.cs @@ -35,7 +35,7 @@ namespace solidware.financials.windows.ui.presenters public override void run(AddNewStockSymbolPresenter presenter)
{
- bus.publish(new StartWatchingSymbol {Symbol = presenter.Symbol});
+ bus.publish(new StartWatchingSymbol {Symbol = presenter.Symbol.ToUpperInvariant()});
presenter.close();
}
}
diff --git a/product/desktop.ui/presenters/SingleStockPresenter.cs b/product/desktop.ui/presenters/SingleStockPresenter.cs index e146935..8db10a9 100644 --- a/product/desktop.ui/presenters/SingleStockPresenter.cs +++ b/product/desktop.ui/presenters/SingleStockPresenter.cs @@ -36,7 +36,7 @@ namespace solidware.financials.windows.ui.presenters {
public virtual SingleStockPresenter create_for(string symbol)
{
- throw new NotImplementedException();
+ return new SingleStockPresenter(symbol);
}
}
}
diff --git a/product/desktop.ui/presenters/StockWatchPresenter.cs b/product/desktop.ui/presenters/StockWatchPresenter.cs index 22d641d..d1e9a84 100644 --- a/product/desktop.ui/presenters/StockWatchPresenter.cs +++ b/product/desktop.ui/presenters/StockWatchPresenter.cs @@ -46,7 +46,9 @@ namespace solidware.financials.windows.ui.presenters public void notify(StartWatchingSymbol message)
{
- Stocks.Add(new StockViewModel(symbol: message.Symbol, builder: builder));
+ var presenter = new StockViewModel(symbol: message.Symbol, builder: builder);
+ presenter.present();
+ Stocks.Add(presenter);
}
public class AddSymbolCommand : UICommand<StockWatchPresenter>
diff --git a/product/desktop.ui/views/SingleStockTab.xaml b/product/desktop.ui/views/SingleStockTab.xaml index 4c1360b..74f378b 100644 --- a/product/desktop.ui/views/SingleStockTab.xaml +++ b/product/desktop.ui/views/SingleStockTab.xaml @@ -1,8 +1,7 @@ <UserControl x:Class="solidware.financials.windows.ui.views.SingleStockTab" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:Charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit" mc:Ignorable="d">
<DockPanel>
- <Label Content="{Binding Path=Header}"></Label>
<Charting:Chart>
- <Charting:LineSeries ItemsSource="{Binding Path=Chart}" IndependentValueBinding="{Binding Path=Key}" DependentValueBinding="{Binding Path=Value}"></Charting:LineSeries>
+ <Charting:LineSeries Title="{Binding Path=Header}" ItemsSource="{Binding Path=Chart}" IndependentValueBinding="{Binding Path=Key}" DependentValueBinding="{Binding Path=Value}"></Charting:LineSeries>
</Charting:Chart>
</DockPanel>
</UserControl>
\ No newline at end of file diff --git a/product/desktop.ui/views/StockWatch.xaml b/product/desktop.ui/views/StockWatch.xaml index b6efa60..679fd7a 100644 --- a/product/desktop.ui/views/StockWatch.xaml +++ b/product/desktop.ui/views/StockWatch.xaml @@ -1,16 +1,16 @@ <UserControl x:Class="solidware.financials.windows.ui.views.StockWatch" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300">
- <StackPanel>
- <DockPanel>
- <Button Command="{Binding Path=AddSymbol}" DockPanel.Dock="Left">Add Symbol</Button>
- <Button Command="{Binding Path=Refresh}" DockPanel.Dock="Right">Refresh</Button>
- </DockPanel>
+ <StackPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
+ <DockPanel>
+ <Button Command="{Binding Path=AddSymbol}" DockPanel.Dock="Left">Add Symbol</Button>
+ <Button Command="{Binding Path=Refresh}" DockPanel.Dock="Right">Refresh</Button>
+ </DockPanel>
<ListView ItemsSource="{Binding Path=Stocks}">
<ListView.ItemTemplate>
<DataTemplate>
- <DockPanel>
- <Label Content="{Binding Path=Symbol}" DockPanel.Dock="Left" Width="90" ></Label>
- <Label Content="{Binding Path=Price.Value}" DockPanel.Dock="Right" HorizontalAlignment="Right" HorizontalContentAlignment="Right"></Label>
- <Button Command="{Binding Path=AdditionalInformation}">...</Button>
+ <DockPanel HorizontalAlignment="Stretch">
+ <Label Content="{Binding Path=Symbol}" DockPanel.Dock="Left"></Label>
+ <Button Command="{Binding Path=AdditionalInformation}" DockPanel.Dock="Right">...</Button>
+ <Label Content="{Binding Path=Price.Value}" HorizontalAlignment="Right" HorizontalContentAlignment="Right" DockPanel.Dock="Right"></Label>
</DockPanel>
</DataTemplate>
</ListView.ItemTemplate>
diff --git a/product/messages/StartWatchingSymbol.cs b/product/messages/StartWatchingSymbol.cs index 69c4b40..6322d61 100644 --- a/product/messages/StartWatchingSymbol.cs +++ b/product/messages/StartWatchingSymbol.cs @@ -9,7 +9,7 @@ namespace solidware.financials.messages public override string ToString()
{
- return "I will start watching {0}".format(Symbol.ToUpperInvariant());
+ return "I will start watching {0}".format(Symbol);
}
}
}
\ No newline at end of file |
