private void OnTrailingSettingsFormAccepted(object sender, EventArgs e) { TrailingSettinsForm form = (TrailingSettinsForm)sender; if (form.Mode == EditingMode.Add) { form.Settings.Date = DateTime.UtcNow; Ticker.Trailings.Add(form.Settings); form.Settings.Start(); Ticker.Save(); this.gcTrailings.RefreshDataSource(); } else { form.Settings.Change(); } if (ChartControl != null) { if (form.Settings.ShowOnChart) { ChartControl.AddIndicator(form.Settings); } else { ChartControl.RemoveIndicator(form.Settings); } } }
private void btEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { TradingSettings settings = (TradingSettings)this.gvTrailings.GetRow(this.gvTrailings.FocusedRowHandle); TrailingSettinsForm form = CreateSettingsForm(settings); form.Mode = EditingMode.Edit; form.Accepted += OnTrailingSettingsFormAccepted; form.Show(); }
private void btAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { TradingSettings settings = CreateNewSettings(); TrailingSettinsForm form = new TrailingSettinsForm(); form.Mode = EditingMode.Add; form.Settings = settings; form.Accepted += OnTrailingSettingsFormAccepted; form.Show(); }
protected TrailingSettinsForm CreateSettingsForm(TradingSettings settings) { TrailingSettinsForm form = new TrailingSettinsForm(); form.Ticker = Ticker; form.Settings = settings; form.Owner = FindForm(); form.CollectionControl = this; form.Mode = EditingMode.Edit; return(form); }