Beispiel #1
0
 private void btn_preset_delete_Click(object sender, EventArgs e)
 {
     if (settings.Presets.Length == 1)
     {
         File.Delete("setting_presets.xml");
         // Reload
         LoadPresets();
         return;
     }
     // Remove at currently selected index
     settings.Presets = Global.RemoveAt(settings.Presets, cBox_presets.SelectedIndex);
     // New index
     if (settings.Presets.Length > 0)
     {
         settings.selected_index = 0;
         // Save
         XmlSerializing.SerializeToPlain(settings);
         // Reload
         LoadPresets();
     }
     else
     {
         File.Delete("setting_presets.xml");
         // Reload
         LoadPresets();
     }
 }
Beispiel #2
0
        private void btn_preset_saveas_Click(object sender, EventArgs e)
        {
            Input_dialog input = new Input_dialog();

            if (input.ShowDialog() == DialogResult.OK)
            {
                if (settings.Presets == null)
                {
                    settings.Presets = new Preset[1];
                }
                else
                {
                    Array.Resize(ref settings.Presets, settings.Presets.Length + 1);
                }
                settings.Presets[settings.Presets.Length - 1] = new Preset()
                {
                    preset_name   = input.Result,
                    brightness_th = (int)nUD_brightness.Value,
                    dot_pause_th  = (int)nUD_dot.Value,
                    char_pause_th = (int)nUD_char.Value,
                    word_pause_th = (int)nUD_word.Value,
                    frameinterval = (int)nUD_finterval.Value
                };

                settings.selected_index = settings.Presets.Length - 1;
            }

            // Save
            XmlSerializing.SerializeToPlain(settings);
            // Reload
            LoadPresets();
        }
Beispiel #3
0
        private void btn_preset_save_Click(object sender, EventArgs e)
        {
            if (cBox_presets.SelectedIndex == -1 || cBox_presets.SelectedIndex >= settings.Presets.Length)
            {
                return;
            }

            settings.Presets[cBox_presets.SelectedIndex].brightness_th = (int)nUD_brightness.Value;
            settings.Presets[cBox_presets.SelectedIndex].dot_pause_th  = (int)nUD_dot.Value;
            settings.Presets[cBox_presets.SelectedIndex].char_pause_th = (int)nUD_char.Value;
            settings.Presets[cBox_presets.SelectedIndex].word_pause_th = (int)nUD_word.Value;
            settings.Presets[cBox_presets.SelectedIndex].frameinterval = (int)nUD_finterval.Value;

            // Save
            XmlSerializing.SerializeToPlain(settings);
        }
Beispiel #4
0
        private void cBox_presets_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (cBox_presets.SelectedIndex == -1 || cBox_presets.SelectedIndex >= settings.Presets.Length)
            {
                return;
            }

            nUD_brightness.Value = settings.Presets[cBox_presets.SelectedIndex].brightness_th;
            nUD_dot.Value        = settings.Presets[cBox_presets.SelectedIndex].dot_pause_th;
            nUD_char.Value       = settings.Presets[cBox_presets.SelectedIndex].char_pause_th;
            nUD_word.Value       = settings.Presets[cBox_presets.SelectedIndex].word_pause_th;
            nUD_finterval.Value  = settings.Presets[cBox_presets.SelectedIndex].frameinterval;

            // Save
            settings.selected_index = cBox_presets.SelectedIndex;
            XmlSerializing.SerializeToPlain(settings);
        }