private void OnChannelMessageReceived(object sender, ChannelMessageEventArgs e) { string logMessage = null; Note n = (Note)(e.Message.Data1 % 12); int octave = e.Message.Data1 / 12; switch (e.Message.Command) { case ChannelCommand.NoteOn: MidiState.Current.SetValue(e.Message.MidiChannel, n, octave, e.Message.Data2); NoteChanged?.Invoke(e.Message.MidiChannel, n, octave, e.Message.Data2); break; case ChannelCommand.NoteOff: MidiState.Current.SetValue(e.Message.MidiChannel, n, octave, 0); NoteChanged?.Invoke(e.Message.MidiChannel, n, octave, e.Message.Data2); break; case ChannelCommand.ChannelPressure: Console.ForegroundColor = ConsoleColor.DarkBlue; logMessage = $"Aftertouch> {e.Message.Data1}, CH#{e.Message.MidiChannel})."; ChannelPressureChanged?.Invoke(e.Message.MidiChannel, e.Message.Data1); break; default: Console.ForegroundColor = ConsoleColor.DarkGray; logMessage = $"CH#{e.Message.MidiChannel} Command: {e.Message.Command}, Data1: {e.Message.Data1}, Data2: {e.Message.Data2})."; break; } if (logMessage != null) { Console.WriteLine(logMessage); } }
private void OnMemoEditEditValueChanged(object sender, EventArgs e) { if (!_allowToSave) { return; } var newText = memoEdit.EditValue?.ToString(); if (CalendarNote.Note.SimpleText != newText) { CalendarNote.Note = !String.IsNullOrEmpty(newText) ? new TextItem(newText, false) : null; } NoteChanged?.Invoke(this, new EventArgs()); }
public void OnNoteChanged() { NoteChanged?.Invoke(this, null); }
void OnNoteChanged(int position, string text) { NoteChanged?.Invoke(this, new NotesArgs(position, text)); }
private void Note_PropertyChanged(object sender, PropertyChangedEventArgs e) { var note = sender as NoteModelBase; NoteChanged?.Invoke(this, new NoteChangedEventArgs(note, e.PropertyName)); }
private void OnNoteChanged(string noteID) { NoteChanged?.Invoke(this, new NoteChangedEventArgs(noteID)); }
internal virtual void OnNoteChanged(NoteUIModel note) => NoteChanged?.Invoke(note);