示例#1
0
        /// <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();
        }
示例#2
0
        /// <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;
            }
        }
示例#3
0
        /// <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;
            }
        }
示例#4
0
        /// <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();
        }
示例#5
0
        /// <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;
            }
        }
示例#6
0
 /// <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;
     }
 }
示例#7
0
 /// <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;
     }
 }
示例#8
0
 /// <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));
 }