public formConfiguration() { InitializeComponent(); if (File.Exists(FILE_NAME)) { Stream input = File.OpenRead(FILE_NAME); BinaryFormatter bRead = new BinaryFormatter(); settings = (SettingsFile)bRead.Deserialize(input); input.Close(); try { String[] address = settings.serverAddress.Split(new Char[] { ':' }); textboxServerAddress.Text = address[0]; try { textboxPort.Text = address[1]; } catch { textboxPort.Text = "21"; } textboxUsername.Text = settings.username; textboxPassword.Text = settings.password; textboxPath.Text = settings.path; checkboxEnable.Checked = settings.urlEnable; passive_on.Checked = settings.passiveOn; textboxURLToImages.Text = settings.urlToImages; logRecord = settings.log; textboxPrefix.Text = settings.imagePrefix; count = settings.count; selectedImageFormat = settings.imageFormat; selectedImageFormatExtension = settings.imageFormatExt; selectedCapType = settings.capType; } catch { MessageBox.Show("Failed to load settings file.\nBackup created; using default settings."); File.Copy(FILE_NAME, "settings_backup.dat"); settings = new SettingsFile(); String[] address = settings.serverAddress.Split(new Char[] { ':' }); textboxPort.Text = address[1]; textboxPath.Text = settings.path; textboxPrefix.Text = settings.imagePrefix; count = settings.count; selectedImageFormat = settings.imageFormat; selectedImageFormatExtension = settings.imageFormatExt; selectedCapType = settings.capType; } } else { settings = new SettingsFile(); String[] address = settings.serverAddress.Split(new Char[] { ':' }); textboxPort.Text = address[1]; textboxPath.Text = settings.path; textboxPrefix.Text = settings.imagePrefix; count = settings.count; selectedImageFormat = settings.imageFormat; selectedImageFormatExtension = settings.imageFormatExt; selectedCapType = settings.capType; } hotkey = settings.hotkey; modkeys = settings.modkeys; modifiers = settings.modifiers; RegisterGlobalHotKey(hotkey, modifiers); if(modkeys.ToString().Equals("None")) labelCurrentHotkey.Text = hotkey.ToString(); else labelCurrentHotkey.Text = modkeys.ToString() + " + " + hotkey.ToString(); setRadioButtons(); }
public void defaultSettings() { serverAddress = ":21"; username = ""; password = ""; path = "/"; urlEnable = false; passiveOn = true; urlToImages = ""; imagePrefix = "sicatimage"; count = 1; imageFormat = ImageFormatHandler.ImageFormatTypes.imgJPEG; imageFormatExt = ".jpg"; capType = ScreenCapture.CaptureType.PrimaryScreen; hotkey = Keys.PrintScreen; }
private void resetSettings() { String[] address = settings.serverAddress.Split(new Char[] { ':' }); textboxServerAddress.Text = address[0]; try { textboxPort.Text = address[1]; } catch { textboxPort.Text = "21"; } textboxUsername.Text = settings.username; textboxPassword.Text = settings.password; textboxPath.Text = settings.path; checkboxEnable.Checked = settings.urlEnable; passive_on.Checked = settings.passiveOn; textboxURLToImages.Text = settings.urlToImages; textboxPrefix.Text = settings.imagePrefix; selectedImageFormat = settings.imageFormat; selectedImageFormatExtension = settings.imageFormatExt; selectedCapType = settings.capType; UnregisterGlobalHotKey(); hotkey = settings.hotkey; modkeys = settings.modkeys; modifiers = settings.modifiers; if(modkeys.ToString().Equals("None")) labelCurrentHotkey.Text = hotkey.ToString(); else labelCurrentHotkey.Text = modkeys.ToString() + " + " + hotkey.ToString(); RegisterGlobalHotKey(hotkey, modifiers); setRadioButtons(); }
private void radiobuttonPrimaryMonitor_CheckedChanged(object sender, EventArgs e) { if (radiobuttonPrimaryMonitor.Checked) selectedCapType = ScreenCapture.CaptureType.PrimaryScreen; }
private void radiobuttonAllMonitorsSingle_CheckedChanged(object sender, EventArgs e) { if (radiobuttonAllMonitorsSingle.Checked) selectedCapType = ScreenCapture.CaptureType.VirtualScreen; }
private void radiobuttonAllMonitorsMultiple_CheckedChanged(object sender, EventArgs e) { if (radiobuttonAllMonitorsMultiple.Checked) selectedCapType = ScreenCapture.CaptureType.AllScreens; }
private void radioButtonActiveForm_CheckedChanged(object sender, EventArgs e) { if (radioButtonActiveForm.Checked) selectedCapType = ScreenCapture.CaptureType.ActiveWindow; }