public MainWindow() { InitializeComponent(); _assets = new ObservableCollection <Security>(); _options = new ObservableCollection <Security>(); Assets.ItemsSource = _assets; Options.ItemsSource = _options; _model = new OptionDeskModel(); Desk.Model = _model; _putBidSmile = SmileChart.CreateSmile("Put (B)", Colors.DarkRed); _putAskSmile = SmileChart.CreateSmile("Put (A)", Colors.Red); _putLastSmile = SmileChart.CreateSmile("Put (L)", Colors.OrangeRed); _callBidSmile = SmileChart.CreateSmile("Call (B)", Colors.GreenYellow); _callAskSmile = SmileChart.CreateSmile("Call (A)", Colors.DarkGreen); _callLastSmile = SmileChart.CreateSmile("Call (L)", Colors.DarkOliveGreen); var timer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(5) }; timer.Tick += (sender, args) => { if (!_isDirty) { return; } _isDirty = false; try { RefreshSmile(); RefreshChart(); } catch (Exception excp) { excp.LogError(); } }; timer.Start(); Level1FieldsCtrl.SetItemsSource(new[] { Level1Fields.ImpliedVolatility, Level1Fields.Delta, Level1Fields.Gamma, Level1Fields.Vega, Level1Fields.Theta, Level1Fields.Rho, }); Level1FieldsCtrl.SetSelected(_model.EvaluateFields.ToArray()); Instance = this; var loaded = false; Loaded += (sender, args) => { if (loaded) { return; } loaded = true; DrawTestData(); InitConnector(); }; }
private void Level1FieldsCtrl_OnEditValueChanged(object sender, EditValueChangedEventArgs e) { _model.EvaluateFields.Clear(); _model.EvaluateFields.AddRange(Level1FieldsCtrl.GetSelecteds <Level1Fields>() ?? Enumerable.Empty <Level1Fields>()); }