// Creates LedMatrix wrapper private LedMatrix CreateItem( // Fields of LedMatrix table Guid LedMatrixId, LedMatrixType MatrixType, LedMatrixCellShape CellShape, int Rows, int Columns, int Colors, string Note // Fields of Circuit table ) { TableSnapshot <CircuitData> tableCircuit = (TableSnapshot <CircuitData>) this.CircuitProject.Table("Circuit"); CircuitData dataCircuit = new CircuitData() { CircuitId = LedMatrixId }; RowId rowIdCircuit = tableCircuit.Insert(ref dataCircuit); LedMatrixData dataLedMatrix = new LedMatrixData() { LedMatrixId = LedMatrixId, MatrixType = MatrixType, CellShape = CellShape, Rows = Rows, Columns = Columns, Colors = Colors, Note = Note, }; return(this.Create(this.Table.Insert(ref dataLedMatrix), rowIdCircuit)); }
private void ButtonOkClick(object sender, RoutedEventArgs e) { try { LedMatrixType ledMatrixType = this.MatrixType.Value; LedMatrixCellShape ledMatrixCellShape = (LedMatrixCellShape)this.CellShape; string note = this.Note.Trim(); if (ledMatrixType != this.LedMatrix.MatrixType || ledMatrixCellShape != this.LedMatrix.CellShape || this.Rows != this.LedMatrix.Rows || this.Columns != this.LedMatrix.Columns || this.Colors != this.LedMatrix.Colors || note != this.LedMatrix.Note ) { this.LedMatrix.CircuitProject.InTransaction(() => { this.LedMatrix.MatrixType = ledMatrixType; this.LedMatrix.CellShape = ledMatrixCellShape; this.LedMatrix.Rows = this.Rows; this.LedMatrix.Columns = this.Columns; this.LedMatrix.Colors = this.Colors; this.LedMatrix.Note = note; this.LedMatrix.UpdatePins(); }); } this.Close(); } catch (Exception exception) { App.Mainframe.ReportException(exception); } }
public LedMatrix Create(LedMatrixType ledMatrixType, int rows, int columns) { LedMatrix ledMatrix = this.CreateItem(Guid.NewGuid(), ledMatrixType, LedMatrixData.CellShapeField.Field.DefaultValue, rows, columns, LedMatrixData.ColorsField.Field.DefaultValue, LedMatrixData.NoteField.Field.DefaultValue ); ledMatrix.UpdatePins(); return(ledMatrix); }
public static EnumDescriptor <LedMatrixType> LedMatrixTypeDescriptor(LedMatrixType ledMatrixType) { Tracer.Assert(EnumHelper.IsValid(ledMatrixType)); return(LedMatrixDescriptor.MatrixTypes.First(d => d.Value == ledMatrixType)); }