Exemple #1
0
        private void saveAsButton_Click(object sender, EventArgs e)
        {
            string presetValue = GetOptsString();
            int    i           = SearchPresetsValue(presetValue);

            if (i != -1)
            {
                if (Util.MsgBox(string.Format(Util.translationList["000179"], presets[i].name),
                                MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2)
                    == DialogResult.No)
                {
                    return;
                }
            }

            SavePresetInfo   savePresetInfo   = new SavePresetInfo("", optionsPresetComboBox);
            SavePresetDialog savePresetDialog = new SavePresetDialog(savePresetInfo);

            if (savePresetDialog.ShowDialog(this) == DialogResult.OK)
            {
                if (i != -1)
                {
                    presets.RemoveAt(i);
                }

                i = SearchPresets(savePresetDialog.PresetName);

                if (i != -1)
                {
                    presets.RemoveAt(i);
                }

                Preset p;

                p.name  = savePresetDialog.PresetName;
                p.value = presetValue;
                presets.Add(p);
                UpdateOptionsPresetComboBox();
                savePresets = true;
            }

            savePresetDialog.Dispose();
        }
        public SavePresetDialog(SavePresetInfo spi)
        {
            InitializeComponent();

            this.spi = spi;
        }