private void CmdCancel_Click(object sender, EventArgs e) { this.SelectedOutput = null; this.DialogResult = DialogResult.Cancel; this.Close(); }
private void AccessoryConnectionsReport_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { // Accessory decoders report data bindings int moduleId = NumericUtils.ToInteger(lblModuleId.Text); System.Collections.Generic.ICollection <AccessoryDecoderOutput> data = AccessoryDecoderOutput.FindByModule(moduleId); AccessoryConnectionsReport.DataSource = data; // Hide the accessory decodres section when no data is present AccessoryConnectionGroupHeader.Visible = (data.Count > 0); AccessoryConnectionsDetail.Visible = (data.Count > 0); }
private void TvwOutputs_Click(object sender, EventArgs e) { if (tvwOutputs.Selection.Count <= 0) { this.SelectedOutput = null; } else if (tvwOutputs.Selection[0].Tag is AccessoryDecoderOutput selected) { this.SelectedOutput = selected; } cmdOK.Enabled = (this.SelectedOutput != null); }
private void CmdOk_Click(object sender, EventArgs e) { if (!this.MapViewToModel()) { return; } try { // Save the decoder AccessoryDecoder.Save(this.Decoder); // Save the decoder outputs if (this.Decoder.IsNew) { foreach (AccessoryDecoderOutput output in this.Decoder.Outputs) { AccessoryDecoderOutput.Save(output); } } // Add the decoder into the project if (!OTCContext.Project.AccessoryDecoders.Contains(this.Decoder)) { OTCContext.Project.AccessoryDecoders.Add(this.Decoder); } this.DialogResult = DialogResult.OK; this.Close(); } catch (Exception ex) { Cursor.Current = Cursors.Default; MessageBox.Show(ex.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { Cursor.Current = Cursors.Default; } }
private void MapModelToView(AccessoryDecoderOutput output) { this.Output = output; spnParameter1.EditValue = 0; spnParameter1.EditValue = 0; spnParameter1.EditValue = 0; cmdDisconnect.Enabled = (this.Output.AccessoryConnection != null); spnAddress.Properties.Mask.EditMask = "4D"; spnAddress.Properties.MaxValue = OTCContext.Project.DigitalSystem.AccessoryAddressRange.Maximum; spnAddress.EditValue = this.Output.Address; this.SetOutputMode(this.Output.Mode); spnParameter1.EditValue = this.Output.DurationA; spnParameter2.EditValue = this.Output.DurationB; spnParameter3.EditValue = this.Output.ServoSpeed; if (this.Output.AccessoryConnection != null) { lblConnectionElement.Text = this.Output.AccessoryConnection.Element.DisplayName; lblConnectionInputElement.Text = this.Output.AccessoryConnection.ElementPinIndex.ToString(); } }
private void MapModelToView() { grdAddress.BeginUpdate(); grdAddressView.OptionsBehavior.AutoPopulateColumns = false; grdAddress.DataSource = null; if (grdAddressView.Columns.Count <= 0) { grdAddressView.Columns.Clear(); grdAddressView.OptionsBehavior.AutoPopulateColumns = false; grdAddressView.Columns.Add(new GridColumn() { Caption = "ID", Visible = false, FieldName = "ID" }); grdAddressView.Columns.Add(new GridColumn() { Caption = "Address", Visible = true, FieldName = "Address" }); grdAddressView.Columns.Add(new GridColumn() { Caption = "Output", Visible = true, FieldName = "Index", Width = 30 }); grdAddressView.Columns.Add(new GridColumn() { Caption = "Decoder", Visible = true, FieldName = "AccessoryDecoder.Name", Width = 30 }); //grdAddressView.Columns["Outputs"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; //grdAddressView.Columns["Outputs"].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; //grdAddressView.Columns["ConnectionsCount"].AppearanceCell.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; //grdAddressView.Columns["ConnectionsCount"].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center; } grdAddress.DataSource = AccessoryDecoderOutput.FindAll(); grdAddress.EndUpdate(); }
public AccessoryDecoderOutputEditorView(AccessoryDecoderOutput output) { InitializeComponent(); MapModelToView(output); }