private void CmdDecoderAdd_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (tabDecoder.SelectedTabPage == tabDecoderAcc) { AccessoryDecoderEditorView form = new AccessoryDecoderEditorView(4); if (form.ShowDialog(this) == DialogResult.OK) { this.ListAccessoryDecoders(); } } else { FeedbackEncoderEditorView form = new FeedbackEncoderEditorView(); if (form.ShowDialog(this) == DialogResult.OK) { this.ListFeedbackEncoders(); } } }
private void CmdDecoderEdit_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (tabDecoder.SelectedTabPage == tabDecoderAcc) { if (!(this.GetSelectedResource() is AccessoryDecoder accDecoder)) { return; } AccessoryDecoderEditorView form = new AccessoryDecoderEditorView(accDecoder); if (form.ShowDialog(this) == DialogResult.OK) { this.ListAccessoryDecoders(); } } else { if (!(this.GetSelectedResource() is FeedbackEncoder fbEncoder)) { return; } FeedbackEncoderEditorView form = new FeedbackEncoderEditorView(fbEncoder); if (form.ShowDialog(this) == DialogResult.OK) { this.ListFeedbackEncoders(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }