main
1using System;
2using System.Collections.Generic;
3using System.Collections.ObjectModel;
4using gorilla.utility;
5using solidware.financials.infrastructure.eventing;
6using solidware.financials.messages;
7
8namespace solidware.financials.windows.ui.presenters
9{
10 public class SingleStockPresenter : TabPresenter, EventSubscriber<CurrentStockPrice>
11 {
12 string symbol_to_watch;
13
14 public SingleStockPresenter(string symbol_to_watch)
15 {
16 this.symbol_to_watch = symbol_to_watch;
17 Chart = new ObservableCollection<KeyValuePair<DateTime, decimal>>();
18 }
19
20 public ICollection<KeyValuePair<DateTime, decimal>> Chart { get; set; }
21
22 public string Header
23 {
24 get { return symbol_to_watch; }
25 }
26
27 public void present() {}
28
29 public void notify(CurrentStockPrice message)
30 {
31 if (symbol_to_watch.Equals(message.Symbol))
32 Chart.Add(new KeyValuePair<DateTime, decimal>(Clock.now(), message.Price));
33 }
34
35 public class Factory
36 {
37 public virtual SingleStockPresenter create_for(string symbol)
38 {
39 return new SingleStockPresenter(symbol);
40 }
41 }
42 }
43}