public SetValueCustomForm(AttributeNote attributeNote) { InitializeComponent(); buttonOK.Click += (s, e) => { attributeNote.NoteValue = (float)numericUpDown1.Value.MyRound(); Close(); }; buttonCancel.Click += (s, e) => { Close(); }; if (attributeNote is BPM) { numericUpDown1.Minimum = (decimal)Define.NoteValue.BPMMIN; numericUpDown1.Maximum = (decimal)Define.NoteValue.BPMMAX; SetLabelText(0); } else if (attributeNote is HighSpeed) { numericUpDown1.Minimum = (decimal)Define.NoteValue.HSMIN; numericUpDown1.Maximum = (decimal)Define.NoteValue.HSMAX; SetLabelText(1); } numericUpDown1.Value = (decimal)attributeNote.NoteValue; }
public ChangeNoteValueOperation(AttributeNote note, float valueBefore, float valueAfter) { Invoke += () => { note.NoteValue = valueAfter; }; Undo += () => { note.NoteValue = valueBefore; }; }