public void RegisterPreset(Preset preset) { ToolStripMenuItem menuItem = new ToolStripMenuItem(preset.Name); menuItem.Click += OnPresetClicked; PresetMenu.DropDownItems.Add(menuItem); RegisteredPresets.Add(preset); }
public void ApplyPreset(Preset preset) { if (preset.GetType().Equals(typeof(DynamicPreset))) { DynamicPreset dynamicPreset = (DynamicPreset)preset; PitchStatic.Checked = false; Pitch.Enabled = false; PitchDynamic.Checked = true; PitchMin.Enabled = true; PitchMax.Enabled = true; PitchMin.Value = (decimal)dynamicPreset.PitchRange.Minimum; PitchMax.Value = (decimal)dynamicPreset.PitchRange.Maximum; TempoStatic.Checked = false; Tempo.Enabled = false; TempoDynamic.Checked = true; TempoMin.Enabled = true; TempoMax.Enabled = true; TempoMin.Value = (decimal)dynamicPreset.TempoRange.Minimum; TempoMax.Value = (decimal)dynamicPreset.TempoRange.Maximum; } else if (preset.GetType().Equals(typeof(StaticPreset))) { StaticPreset staticPreset = (StaticPreset)preset; PitchStatic.Checked = true; PitchDynamic.Checked = false; Pitch.Enabled = true; PitchMin.Enabled = false; PitchMax.Enabled = false; Pitch.Value = (decimal)staticPreset.Pitch; TempoStatic.Checked = true; TempoDynamic.Checked = false; Tempo.Enabled = true; TempoMin.Enabled = false; TempoMax.Enabled = false; Tempo.Value = (decimal)staticPreset.Tempo; } }