private void AddNewScreen() { if (InputValid()) { TrimInput(); if (ScreenCollection.GetByName(textBoxName.Text) == null) { ScreenCollection.Add(new Screen( textBoxName.Text, FileSystem.CorrectDirectoryPath(textBoxFolder.Text), textBoxMacro.Text, comboBoxScreenComponent.SelectedIndex, ImageFormatCollection.GetByName(comboBoxFormat.Text), (int)numericUpDownJpegQuality.Value, (int)numericUpDownResolutionRatio.Value, checkBoxMouse.Checked)); Okay(); } else { MessageBox.Show("A screen with this name already exists.", "Duplicate Name Conflict", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Please enter valid input for each field.", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void AddScreen() { if (InputValid()) { TrimInput(); if (ScreenCollection.GetByName(textBoxScreenName.Text) == null) { ScreenCollection.Add(new Screen() { ViewId = Guid.NewGuid(), Name = textBoxScreenName.Text, Folder = _fileSystem.CorrectScreenshotsFolderPath(textBoxFolder.Text), Macro = textBoxMacro.Text, Component = comboBoxScreenComponent.SelectedIndex, Format = ImageFormatCollection.GetByName(comboBoxFormat.Text), JpegQuality = (int)numericUpDownJpegQuality.Value, Mouse = checkBoxMouse.Checked, Enable = checkBoxEnable.Checked, X = (int)numericUpDownX.Value, Y = (int)numericUpDownY.Value, Width = (int)numericUpDownWidth.Value, Height = (int)numericUpDownHeight.Value, Source = comboBoxScreenSource.SelectedIndex, AutoAdapt = checkBoxAutoAdapt.Checked, CaptureMethod = comboBoxScreenCaptureMethod.SelectedIndex, Encrypt = checkBoxEncrypt.Checked, ResolutionRatio = (int)numericUpDownResolutionRatio.Value }); Okay(); } else { MessageBox.Show("A screen with this name already exists.", "Duplicate Name Conflict", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Please enter valid input for each field.", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void AddNewScreen() { if (InputValid()) { TrimInput(); if (ScreenCollection.GetByName(textBoxName.Text) == null) { ScreenCollection.Add(new Screen() { Name = textBoxName.Text, Folder = FileSystem.CorrectScreenshotsFolderPath(textBoxFolder.Text), Macro = textBoxMacro.Text, Component = comboBoxScreenComponent.SelectedIndex, Format = ImageFormatCollection.GetByName(comboBoxFormat.Text), JpegQuality = (int)numericUpDownJpegQuality.Value, ResolutionRatio = (int)numericUpDownResolutionRatio.Value, Mouse = checkBoxMouse.Checked, Active = checkBoxActive.Checked, ActiveWindowTitleCaptureCheck = checkBoxActiveWindowTitle.Checked, ActiveWindowTitleCaptureText = textBoxActiveWindowTitle.Text }); Okay(); } else { MessageBox.Show("A screen with this name already exists.", "Duplicate Name Conflict", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Please enter valid input for each field.", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Error); } }