From 4f8c4c2e89cafed50b6c50f17b681ed3a9e3ea45 Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Fri, 21 May 2021 19:53:14 -0400 Subject: [PATCH] use CommandEventArgs.Command instead of assuming sender is a Command (it is not always, and should not ever be) --- Libraries/UniversalEditor.UserInterface/Engine.cs | 4 ++-- .../Audio/Synthesized/Views/PianoRoll/PianoRollView.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Libraries/UniversalEditor.UserInterface/Engine.cs b/Libraries/UniversalEditor.UserInterface/Engine.cs index 7bad71a0..091636e5 100644 --- a/Libraries/UniversalEditor.UserInterface/Engine.cs +++ b/Libraries/UniversalEditor.UserInterface/Engine.cs @@ -493,7 +493,7 @@ namespace UniversalEditor.UserInterface #region View Application.Instance.AttachCommandEventHandler("ViewFullScreen", delegate(object sender, EventArgs e) { - Command cmd = (sender as Command); + Command cmd = (e as CommandEventArgs).Command; LastWindow.FullScreen = !LastWindow.FullScreen; cmd.Checked = LastWindow.FullScreen; }); @@ -761,7 +761,7 @@ namespace UniversalEditor.UserInterface void cmdViewToolbarsToolbar_Executed(object sender, EventArgs e) { - Command cmd = (sender as Command); + Command cmd = (e as CommandEventArgs).Command; } diff --git a/Plugins.UserInterface/UniversalEditor.Plugins.Multimedia.UserInterface/Editors/Multimedia/Audio/Synthesized/Views/PianoRoll/PianoRollView.cs b/Plugins.UserInterface/UniversalEditor.Plugins.Multimedia.UserInterface/Editors/Multimedia/Audio/Synthesized/Views/PianoRoll/PianoRollView.cs index 85ca92ce..af8c4f21 100644 --- a/Plugins.UserInterface/UniversalEditor.Plugins.Multimedia.UserInterface/Editors/Multimedia/Audio/Synthesized/Views/PianoRoll/PianoRollView.cs +++ b/Plugins.UserInterface/UniversalEditor.Plugins.Multimedia.UserInterface/Editors/Multimedia/Audio/Synthesized/Views/PianoRoll/PianoRollView.cs @@ -226,7 +226,7 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.Views.PianoRoll private void ContextMenu_NoteFixedLength_Click(object sender, EventArgs e) { - Command cmd = (sender as Command); + Command cmd = (e as CommandEventArgs).Command; string sValue = cmd.ID.Substring("PianoRollEditor_ContextMenu_NoteFixedLength_".Length); int iValue = -1; @@ -253,7 +253,7 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.Views.PianoRoll } private void ContextMenu_Quantize_Click(object sender, EventArgs e) { - Command cmd = (sender as Command); + Command cmd = (e as CommandEventArgs).Command; string sValue = cmd.ID.Substring("PianoRollEditor_ContextMenu_Quantize_".Length); int iValue = 4; //-1; @@ -282,7 +282,7 @@ namespace UniversalEditor.Editors.Multimedia.Audio.Synthesized.Views.PianoRoll } private void ContextMenu_NoteLength_Click(object sender, EventArgs e) { - Command cmd = (sender as Command); + Command cmd = (e as CommandEventArgs).Command; string sValue = cmd.ID.Substring("PianoRollEditor_ContextMenu_NoteLength_".Length); int iValue = 4; //-1;