Ejemplo n.º 1
0
        public void Initialize(SaveSettings save)
        {
            SWindowOpacity.Value = save.WindowOpacity * 10;
            TBWindowOpacity.Text = save.WindowOpacity.ToString();
            SSpeed.Value         = save.Speed;
            TBSpeed.Text         = save.Speed.ToString();
            SOpacity.Value       = save.Opacity * 10;
            TBOpacity.Text       = save.Opacity.ToString();
            switch (save.Ratio)
            {
            case 0.5: Ratio05.IsChecked = true; break;

            case 0.75: Ratio075.IsChecked = true; break;

            case 1: Ratio1.IsChecked = true; break;

            case 1.25: Ratio125.IsChecked = true; break;

            case 1.5: Ratio15.IsChecked = true; break;

            case 2: Ratio2.IsChecked = true; break;
            }
            switch (save.Range)
            {
            case 1: Range1.IsChecked = true; break;

            case 3: Range3.IsChecked = true; break;

            case 5: Range5.IsChecked = true; break;

            case 10: Range10.IsChecked = true; break;

            case 15: Range15.IsChecked = true; break;

            case 20: Range20.IsChecked = true; break;
            }
        }
Ejemplo n.º 2
0
        private void BSave_Click(object sender, RoutedEventArgs e)
        {
            double ratio = 0;

            if ((bool)Ratio05.IsChecked)
            {
                ratio = 0.5;
            }
            else if ((bool)Ratio075.IsChecked)
            {
                ratio = 0.75;
            }
            else if ((bool)Ratio1.IsChecked)
            {
                ratio = 1;
            }
            else if ((bool)Ratio125.IsChecked)
            {
                ratio = 1.25;
            }
            else if ((bool)Ratio15.IsChecked)
            {
                ratio = 1.5;
            }
            else if ((bool)Ratio2.IsChecked)
            {
                ratio = 2;
            }
            var range = 0;

            if ((bool)Range1.IsChecked)
            {
                range = 1;
            }
            else if ((bool)Range3.IsChecked)
            {
                range = 3;
            }
            else if ((bool)Range5.IsChecked)
            {
                range = 5;
            }
            else if ((bool)Range10.IsChecked)
            {
                range = 10;
            }
            else if ((bool)Range15.IsChecked)
            {
                range = 15;
            }
            else if ((bool)Range20.IsChecked)
            {
                range = 20;
            }

            var temp = new SaveSettings()
            {
                Speed = (int)SSpeed.Value, Range = range, Opacity = SOpacity.Value / 10, Ratio = ratio, WindowOpacity = SWindowOpacity.Value / 10
            };
            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            config.AppSettings.Settings.Clear();
            config.AppSettings.Settings.Add("Speed", temp.Speed.ToString());
            config.AppSettings.Settings.Add("Range", temp.Range.ToString());
            config.AppSettings.Settings.Add("Opacity", temp.Opacity.ToString());
            config.AppSettings.Settings.Add("Ratio", temp.Ratio.ToString());
            config.AppSettings.Settings.Add("WindowOpacity", temp.WindowOpacity.ToString());
            config.Save(ConfigurationSaveMode.Modified);
            ConfigurationManager.RefreshSection("appSettings");

            saveSettings(temp);
            Close();
        }
Ejemplo n.º 3
0
 public SettingWindow(SaveSettings @default)
 {
     InitializeComponent();
     BaseCanvas.MouseLeftButtonDown += (o, e) => { DragMove(); };
     Initialize(@default);
 }