private void DeleteScreening(object sender, EventArgs e) { if (xtraTabControl.SelectedTabPage.IsNotNull()) { ScreeningCtrl control = xtraTabControl.SelectedTabPage.Controls[0].CastToType <ScreeningCtrl>(); if (control.IsNotNull()) { Probe probe = gridView.GetFocusedRow() as Probe; GridView view = null; if (probe.IsNotNull()) { view = gridView.GetDetailView(gridView.FocusedRowHandle, 0) as GridView; if (view.IsNotNull()) { view.FocusedRowChanged -= new DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventHandler(this.gridViewScreening_FocusedRowChanged); } } this.xtraTabControl.SelectedPageChanged -= new DevExpress.XtraTab.TabPageChangedEventHandler(this.xtraTabControl_SelectedPageChanged); this.InvokeActionMethod("Worksheet", "DeleteScreening", new { id = control.Id, SessionId = SessionId }); this.xtraTabControl.SelectedPageChanged += new DevExpress.XtraTab.TabPageChangedEventHandler(this.xtraTabControl_SelectedPageChanged); if (view.IsNotNull()) { view.FocusedRowChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventHandler(this.gridViewScreening_FocusedRowChanged); } InvokeScreeningChanged(); } } }
public void ScreeningAdded(Screening model) { ScreeningCtrl screening = new ScreeningCtrl(model, SessionId); screening.Dock = DockStyle.Fill; XtraTabPage tabpage = new XtraTabPage(); tabpage.Text = "Screenig" + model.Id; tabpage.Controls.Add(screening); xtraTabControl.TabPages.Add(tabpage); xtraTabControl.SelectedTabPage = tabpage; btnDeleteScreening.Enabled = model.Worksheet.Screenings.Count() > 0; }
private void InvokeScreeningChanged() { long id = -1; if (xtraTabControl.SelectedTabPage.IsNotNull()) { ScreeningCtrl control = xtraTabControl.SelectedTabPage.Controls[0].CastToType <ScreeningCtrl>(); if (control.IsNotNull()) { id = control.Id; } } this.InvokeActionMethod("Worksheet", "ScreeningChanged", new { screeningId = id, SessionId = SessionId }); }
public void ScreeningDeleted(Worksheet model) { if (xtraTabControl.SelectedTabPage.IsNotNull()) { XtraTabPage tp = xtraTabControl.SelectedTabPage; ScreeningCtrl control = tp.Controls[0].CastToType <ScreeningCtrl>(); if (control.IsNotNull()) { control.Remove(); xtraTabControl.TabPages.Remove(tp); tp.Dispose(); } } btnDeleteScreening.Enabled = model.Screenings.Count() > 0; }
public void ScreeningChanged(Screening screening) { foreach (XtraTabPage tp in xtraTabControl.TabPages) { ScreeningCtrl control = tp.Controls[0].CastToType <ScreeningCtrl>(); if (control.IsNotNull() && control.Id == screening.Id) { if (xtraTabControl.SelectedTabPage != tp) { this.xtraTabControl.SelectedPageChanged -= new DevExpress.XtraTab.TabPageChangedEventHandler(this.xtraTabControl_SelectedPageChanged); xtraTabControl.SelectedTabPage = tp; this.xtraTabControl.SelectedPageChanged += new DevExpress.XtraTab.TabPageChangedEventHandler(this.xtraTabControl_SelectedPageChanged); } break; } } Probe probe = gridView.GetFocusedRow() as Probe; if (probe.IsNotNull()) { GridView view = gridView.GetDetailView(gridView.FocusedRowHandle, 0) as GridView; if (view.IsNotNull()) { for (int i = 0; i < view.RowCount; i++) { Screening s = view.GetRow(i) as Screening; if (s.IsNotNull() && s.Id == screening.Id) { if (view.FocusedRowHandle != i) { view.FocusedRowChanged -= new DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventHandler(this.gridViewScreening_FocusedRowChanged); view.FocusedRowHandle = i; view.FocusedRowChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventHandler(this.gridViewScreening_FocusedRowChanged); } break; } } } } }
public void ProbeChenged(List <Screening> Screenings) { this.xtraTabControl.SelectedPageChanged -= new DevExpress.XtraTab.TabPageChangedEventHandler(this.xtraTabControl_SelectedPageChanged); for (int i = xtraTabControl.TabPages.Count - 1; i >= 0; i--) { XtraTabPage tp = xtraTabControl.TabPages[i]; ScreeningCtrl control = tp.Controls[0].CastToType <ScreeningCtrl>(); if (control.IsNotNull()) { control.Remove(); xtraTabControl.TabPages.Remove(tp); tp.Dispose(); } } btnDeleteScreening.Enabled = false; foreach (Screening screening in Screenings) { ScreeningAdded(screening); } InvokeScreeningChanged(); this.xtraTabControl.SelectedPageChanged += new DevExpress.XtraTab.TabPageChangedEventHandler(this.xtraTabControl_SelectedPageChanged); }