/// <summary> /// Save the settings /// </summary> private void Save() { EqualizerProfile profile = SettingsManager.CurrentEqualizerProfile; float[] levels = new float[] { (float)F32.Value / 10f, (float)F64.Value / 10f, (float)F125.Value / 10f, (float)F250.Value / 10f, (float)F500.Value / 10f, (float)F1K.Value / 10f, (float)F2K.Value / 10f, (float)F4K.Value / 10f, (float)F8K.Value / 10f, (float)F16K.Value / 10f, }; float echo = (float)Echo.Value; // create new profile if (profile.IsProtected) { List <string> occupied = new List <string>(); foreach (EqualizerProfile p in SettingsManager.EqualizerProfiles) { occupied.Add(p.Name); if (p.IsProtected) { occupied.Add(U.T("EqualizerProfile" + p.Name)); } } NameDialog dialog = new NameDialog(occupied); dialog.ShowDialog(); if (dialog.DialogResult == true) { profile = SettingsManager.CreateEqualizerLevel(U.CleanXMLString(dialog.ProfileName.Text), levels, echo); SettingsManager.EqualizerProfiles.Add(profile); Profiles.Items.Add(profile.Name); SettingsManager.CurrentEqualizerProfile = profile; } } // update profile else { profile.Levels = levels; profile.EchoLevel = echo; } Refresh(); }
/// <summary> /// Invoked when the user clicks "Rename" /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void Rename_Click(object sender, RoutedEventArgs e) { List <string> occupied = new List <string>(); foreach (EqualizerProfile p in SettingsManager.EqualizerProfiles) { occupied.Add(p.Name); if (p.IsProtected) { occupied.Add(U.T("EqualizerProfile" + p.Name)); } } EqualizerProfile profile = SettingsManager.CurrentEqualizerProfile; NameDialog dialog = new NameDialog(occupied, profile.Name); dialog.ShowDialog(); if (dialog.DialogResult == true) { string oldName = profile.Name; string newName = U.CleanXMLString(dialog.ProfileName.Text); for (int i = 0; i < Profiles.Items.Count; i++) { if (Profiles.Items[i] as string == oldName) { Profiles.Items[i] = newName; } } foreach (EqualizerProfile p in SettingsManager.EqualizerProfiles) { if (p.Name == oldName) { p.Name = newName; } } profile.Name = newName; SettingsManager.CurrentEqualizerProfile = profile; } }
/// <summary> /// Invoked when the user clicks "New" /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void New_Click(object sender, RoutedEventArgs e) { List <string> occupied = new List <string>(); foreach (EqualizerProfile p in SettingsManager.EqualizerProfiles) { occupied.Add(p.Name); if (p.IsProtected) { occupied.Add(U.T("EqualizerProfile" + p.Name)); } } NameDialog dialog = new NameDialog(occupied); dialog.ShowDialog(); if (dialog.DialogResult == true) { EqualizerProfile profile = SettingsManager.CreateEqualizerLevel(U.CleanXMLString(dialog.ProfileName.Text), new float[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0); SettingsManager.EqualizerProfiles.Add(profile); Profiles.Items.Add(profile.Name); AskToSave(); SettingsManager.CurrentEqualizerProfile = profile; } }
/// <summary> /// Save the settings /// </summary> private void Save() { EqualizerProfile profile = SettingsManager.CurrentEqualizerProfile; float[] levels = new float[] { (float)F32.Value / 10f, (float)F64.Value / 10f, (float)F125.Value / 10f, (float)F250.Value / 10f, (float)F500.Value / 10f, (float)F1K.Value / 10f, (float)F2K.Value / 10f, (float)F4K.Value / 10f, (float)F8K.Value / 10f, (float)F16K.Value / 10f, }; float echo = (float)Echo.Value; // create new profile if (profile.IsProtected) { List<string> occupied = new List<string>(); foreach (EqualizerProfile p in SettingsManager.EqualizerProfiles) { occupied.Add(p.Name); if (p.IsProtected) occupied.Add(U.T("EqualizerProfile" + p.Name)); } NameDialog dialog = new NameDialog(occupied); dialog.ShowDialog(); if (dialog.DialogResult == true) { profile = SettingsManager.CreateEqualizerLevel(U.CleanXMLString(dialog.ProfileName.Text), levels, echo); SettingsManager.EqualizerProfiles.Add(profile); Profiles.Items.Add(profile.Name); SettingsManager.CurrentEqualizerProfile = profile; } } // update profile else { profile.Levels = levels; profile.EchoLevel = echo; } Refresh(); }
/// <summary> /// Invoked when the user clicks "Rename" /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void Rename_Click(object sender, RoutedEventArgs e) { List<string> occupied = new List<string>(); foreach (EqualizerProfile p in SettingsManager.EqualizerProfiles) { occupied.Add(p.Name); if (p.IsProtected) occupied.Add(U.T("EqualizerProfile" + p.Name)); } EqualizerProfile profile = SettingsManager.CurrentEqualizerProfile; NameDialog dialog = new NameDialog(occupied, profile.Name); dialog.ShowDialog(); if (dialog.DialogResult == true) { string oldName = profile.Name; string newName = U.CleanXMLString(dialog.ProfileName.Text); for (int i = 0; i < Profiles.Items.Count; i++) if (Profiles.Items[i] as string == oldName) Profiles.Items[i] = newName; foreach (EqualizerProfile p in SettingsManager.EqualizerProfiles) if (p.Name == oldName) p.Name = newName; profile.Name = newName; SettingsManager.CurrentEqualizerProfile = profile; } }
/// <summary> /// Invoked when the user clicks "New" /// </summary> /// <param name="sender">The sender of the event</param> /// <param name="e">The event data</param> private void New_Click(object sender, RoutedEventArgs e) { List<string> occupied = new List<string>(); foreach (EqualizerProfile p in SettingsManager.EqualizerProfiles) { occupied.Add(p.Name); if (p.IsProtected) occupied.Add(U.T("EqualizerProfile" + p.Name)); } NameDialog dialog = new NameDialog(occupied); dialog.ShowDialog(); if (dialog.DialogResult == true) { EqualizerProfile profile = SettingsManager.CreateEqualizerLevel(U.CleanXMLString(dialog.ProfileName.Text), new float[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 0); SettingsManager.EqualizerProfiles.Add(profile); Profiles.Items.Add(profile.Name); AskToSave(); SettingsManager.CurrentEqualizerProfile = profile; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PrefRenameShortcutProfile_Clicked(object sender, RoutedEventArgs e) { KeyboardShortcutProfile profile = SettingsManager.GetCurrentShortcutProfile(); List<string> occupied = new List<string>(); foreach (KeyboardShortcutProfile p in SettingsManager.ShortcutProfiles) occupied.Add(p.Name); NameDialog dialog = new NameDialog(occupied, profile.Name); dialog.ShowDialog(); if (dialog.DialogResult == true) { foreach (ComboBoxItem item in PrefShortcutProfile.Items) if (profile.Name == (string)item.Content) item.Content = dialog.ProfileName.Text; profile.Name = U.CleanXMLString(dialog.ProfileName.Text); SettingsManager.CurrentShortcutProfile = dialog.ProfileName.Text; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PrefCreateShortcutProfile_Clicked(object sender, RoutedEventArgs e) { List<string> occupied = new List<string>(); foreach (KeyboardShortcutProfile p in SettingsManager.ShortcutProfiles) occupied.Add(p.Name); NameDialog dialog = new NameDialog(occupied); dialog.ShowDialog(); if (dialog.DialogResult == true) CreateShortcutProfile(U.CleanXMLString(dialog.ProfileName.Text)); }