private void comboBoxFileNameFormat_SelectedIndexChanged(object sender, EventArgs e) { if (initialized) { SQLiteDBClass.PutSettingInt("comboBoxFileNameFormat", comboBoxFileNameFormat.SelectedIndex); } textBoxFileNameExample.Text = ImageConverter.CreateFileName("Sol", "HighResScreenshot_0000.bmp", comboBoxFileNameFormat.SelectedIndex, checkBoxHires.Checked, DateTime.Now); }
public void InitControl(EDDiscoveryForm discoveryForm) { _discoveryForm = discoveryForm; this.Watcher = new ScreenshotDirectoryWatcher(_discoveryForm, CallWithConverter); this.Watcher.OnScreenshot += ConvertCompleted; ScreenshotsDirdefault = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), "Frontier Developments", "Elite Dangerous"); OutputDirdefault = Path.Combine(ScreenshotsDirdefault, "Converted"); try { comboBoxFormat.SelectedIndex = SQLiteDBClass.GetSettingInt("ImageHandlerFormatNr", 0); } catch { } try { comboBoxFileNameFormat.SelectedIndex = SQLiteDBClass.GetSettingInt("comboBoxFileNameFormat", 0); } catch { } try { comboBoxSubFolder.SelectedIndex = SQLiteDBClass.GetSettingInt("comboBoxSubFolder", 0); } catch { } try { comboBoxScanFor.Enabled = false; // to prevent the select change from actually doing any work here comboBoxScanFor.SelectedIndex = SQLiteDBClass.GetSettingInt("comboBoxScanFor", 0); comboBoxScanFor.Enabled = true; } catch { } checkBoxAutoConvert.Checked = SQLiteDBClass.GetSettingBool("ImageHandlerAutoconvert", false); checkBoxRemove.Checked = SQLiteDBClass.GetSettingBool("checkBoxRemove", false); checkBoxHires.Checked = SQLiteDBClass.GetSettingBool("checkBoxHires", false); textBoxOutputDir.Text = EDDConfig.UserPaths.ImageHandlerOutputDir ?? OutputDirdefault; if (!Directory.Exists(textBoxOutputDir.Text)) { textBoxOutputDir.Text = OutputDirdefault; } textBoxScreenshotsDir.Text = EDDConfig.UserPaths.ImageHandlerScreenshotsDir ?? ScreenshotsDirdefault; if (!Directory.Exists(textBoxScreenshotsDir.Text)) { textBoxScreenshotsDir.Text = ScreenshotsDirdefault; } checkBoxCopyClipboard.Checked = SQLiteDBClass.GetSettingBool("ImageHandlerClipboard", false); checkBoxPreview.Checked = SQLiteDBClass.GetSettingBool("ImageHandlerPreview", false); checkBoxCropImage.Checked = SQLiteDBClass.GetSettingBool("ImageHandlerCropImage", false); // fires the checked handler which sets the readonly mode of the controls numericUpDownTop.Value = SQLiteDBClass.GetSettingInt("ImageHandlerCropTop", 0); numericUpDownLeft.Value = SQLiteDBClass.GetSettingInt("ImageHandlerCropLeft", 0); numericUpDownWidth.Value = SQLiteDBClass.GetSettingInt("ImageHandlerCropWidth", 0); numericUpDownHeight.Value = SQLiteDBClass.GetSettingInt("ImageHandlerCropHeight", 0); textBoxFileNameExample.Text = ImageConverter.CreateFileName("Sol", "HighResScreenshot_0000.bmp", comboBoxFileNameFormat.SelectedIndex, checkBoxHires.Checked, DateTime.Now); numericUpDownTop.Enabled = numericUpDownWidth.Enabled = numericUpDownLeft.Enabled = numericUpDownHeight.Enabled = checkBoxCropImage.Checked; this.initialized = true; }