public LinkBuildableForm( ) { testNameAndBuildableDictionary = new Dictionary <string, string>( ); LinkTestListBuildable serializationLinkBuildables = new LinkTestListBuildable( ); serializationLinkBuildables.DeserializeTestDictionary( ); if (serializationLinkBuildables.testNameBuildableDictionary != null) { testNameAndBuildableDictionary = serializationLinkBuildables.testNameBuildableDictionary; } DataLoadHandlers loadDataHandler = new DataLoadHandlers( ); ButtonControl buttonControls = new ButtonControl( ); InitializeComponent( ); selectBuildablePathButton.MouseEnter += buttonControls.controlButtons_MouseEnter; selectBuildablePathButton.MouseLeave += buttonControls.controlButtons_MouseLeave; saveBuildableLinkedButton.MouseEnter += buttonControls.controlButtons_MouseEnter; saveBuildableLinkedButton.MouseLeave += buttonControls.controlButtons_MouseLeave; testListDropdown.DrawItem += testListDropdown_DrawItem; testBuildableSuccessfulLinkedMessage.Text = string.Empty; loadDataHandler.LoadInTestListToDropdown(testListDropdown, TestRunnerGUI.testDictionary); }
private void removeDropdownButton_Click(object sender, EventArgs e) { if (testListDropdown.SelectedIndex > -1) { string selectedTest = testListDropdown.GetItemText(testListDropdown.SelectedItem); DialogResult popupResult = MessageBox.Show($"Are you sure, that you would like to remove '{selectedTest}' from the list?", "Remove test", MessageBoxButtons.YesNo); if (popupResult == DialogResult.Yes) { TestRunnerGUI.testDictionary.Remove(selectedTest); Dictionary <string, string> linkTestListBuildableDictionary = new Dictionary <string, string>( ); LinkTestListBuildable linkTestListBuildable = new LinkTestListBuildable( ); linkTestListBuildable.DeserializeTestDictionary( ); if (linkTestListBuildable.testNameBuildableDictionary != null) { linkTestListBuildableDictionary = linkTestListBuildable.testNameBuildableDictionary; } if (linkTestListBuildableDictionary.ContainsKey(selectedTest)) { linkTestListBuildableDictionary.Remove(selectedTest); linkTestListBuildable.testNameBuildableDictionary = linkTestListBuildableDictionary; linkTestListBuildable.DeserializeTestDictionary( ); } loadDataHandler.LoadInTestListToDropdown(testListDropdown, TestRunnerGUI.testDictionary); testListDropdown.SelectedIndex = -1; successfullRemovalLabel.Text = $"'{selectedTest}' successfully removed from the list!"; } } else { MessageBox.Show("Please select the item from the dropdown, you would like to remove"); } }
public TestRunnerGUI( ) { loadDataHandler = new DataLoadHandlers( ); ButtonControl buttonControls = new ButtonControl(); FormControl formControls = new FormControl(); InitializeComponent( ); testSelectorDropdown.DrawItem += testSelectorDropdown_DrawItem; editDropdownButton.MouseEnter += buttonControls.controlButtons_MouseEnter; editDropdownButton.MouseLeave += buttonControls.controlButtons_MouseLeave; editRunOptionsButton.MouseEnter += buttonControls.controlButtons_MouseEnter; editRunOptionsButton.MouseLeave += buttonControls.controlButtons_MouseLeave; setCurrentTest.MouseEnter += buttonControls.controlButtons_MouseEnter; setCurrentTest.MouseLeave += buttonControls.controlButtons_MouseLeave; selectTestExecutableFromFileExplorer.MouseEnter += buttonControls.controlButtons_MouseEnter; selectTestExecutableFromFileExplorer.MouseLeave += buttonControls.controlButtons_MouseLeave; runTestButton.MouseEnter += buttonControls.controlButtons_MouseEnter; runTestButton.MouseLeave += buttonControls.controlButtons_MouseLeave; closeButton.MouseEnter += buttonControls.controlButtons_MouseEnter; closeButton.MouseLeave += buttonControls.controlButtons_MouseLeave; minimizeButton.MouseEnter += buttonControls.controlButtons_MouseEnter; minimizeButton.MouseLeave += buttonControls.controlButtons_MouseLeave; helpButton.MouseEnter += buttonControls.controlButtons_MouseEnter; helpButton.MouseLeave += buttonControls.controlButtons_MouseLeave; this.MouseDown += formControls.form_MouseDown; this.MouseMove += formControls.form_MouseMove; this.MouseUp += formControls.form_MouseUp; testList = new TestList(testListNamePath); testList.DeserializeTestDictionary( ); foreach (KeyValuePair <string, string> currentDictionaryItem in testList.testListNamePath) { testListNamePath.Add(currentDictionaryItem.Key, currentDictionaryItem.Value); } loadDataHandler.LoadInTestListToDropdown(testSelectorDropdown, testListNamePath); runOptions = new RunOptions( ); runOptions.DeserializeRunOptions( ); testRunnerRunOptionsDictionary = runOptions.runOptionsDictionary; runOptions.DeserializeRunOptionsBrowserList( ); testRunnerBrowserList = runOptions.browserList; if (testRunnerBrowserList != null) { loadDataHandler.PopulateBrowserDropdowns(new List <ComboBox>( ) { runBrowserSelector }, testRunnerBrowserList); } if (testRunnerRunOptionsDictionary != null) { loadDataHandler.SetDefaultBrowser(runBrowserSelector, testRunnerRunOptionsDictionary); loadDataHandler.SetMaxAndDefaultValueForWorkerInput(workersNumberSetterInput, testRunnerRunOptionsDictionary); } LinkTestListBuildable linkTestListBuildable = new LinkTestListBuildable( ); linkTestListBuildable.DeserializeTestDictionary( ); testLinkedToBuildableDictionary = linkTestListBuildable.testNameBuildableDictionary; }