Ejemplo n.º 1
0
        private void LoadPresetButton_Click(object sender, RoutedEventArgs e)
        {
            string     Result = SelectPresetWindow.InstanceLoad(this, config.Presets);
            PresetItem Preset = GetPresetByName(Result);

            if (Preset != null)
            {
                Preset.SaveAs(config.Current);
                config.Current.MasterVolume = -1;
                config.Current.MasterVolume = Preset.MasterVolume;
            }
        }
Ejemplo n.º 2
0
        public static string InstanceSave(Window owner, ObservableCollection <PresetItem> list)
        {
            SelectPresetWindow Form = new SelectPresetWindow();

            Form.Owner = owner;
            Form.list  = list;
            Form.PresetList.DataContext = list;
            Form.isLoad = false;
            Form.NameBox.Focus();
            Form.NameBox.SelectAll();
            Form.ShowDialog();
            return(Form.Result);
        }
Ejemplo n.º 3
0
        public static string InstanceLoad(Window owner, ObservableCollection <PresetItem> list)
        {
            SelectPresetWindow Form = new SelectPresetWindow();

            Form.Owner = owner;
            Form.PresetList.DataContext = list;
            Form.list               = list;
            Form.isLoad             = true;
            Form.Title              = "Load Preset...";
            Form.NameBox.Visibility = Visibility.Hidden;
            Form.PresetList.Margin  = new Thickness(Form.PresetList.Margin.Left, 0, Form.PresetList.Margin.Right, Form.PresetList.Margin.Bottom);
            Form.ShowDialog();
            return(Form.Result);
        }
Ejemplo n.º 4
0
        private void SavePresetButton_Click(object sender, RoutedEventArgs e)
        {
            string Result = SelectPresetWindow.InstanceSave(this, config.Presets);

            if (!string.IsNullOrEmpty(Result))
            {
                PresetItem Preset = GetPresetByName(Result);
                if (Preset == null)
                {
                    Preset = new PresetItem();
                    config.Presets.Add(Preset);
                }
                config.Current.SaveAs(Preset);
                Preset.Name = Result;
                config.Save();
            }
        }