public void AboutBox() { var dialog = new AboutBox(); dialog.Show(); dialog.Close(); Assert.IsNotNull(dialog); }
/// <summary> /// 关于响应事件 /// </summary> /// <param name="Ctrl"></param> /// <param name="CancelDefault"></param> public static void btnAbout_Click(CommandBarButton Ctrl, ref bool CancelDefault) { ThisAddIn.g_log.Info("operator:btnAboutClicked begin"); try { AboutBox aboutBox = new AboutBox(); aboutBox.ShowDialog(); } catch (Exception ex) { ThisAddIn.g_log.Error(string.Format("open about failed, because {0}", ex.Message)); MessageBox.Show(ex.Message); } ThisAddIn.g_log.Info("operator:btnAboutClicked end"); }
private void AboutButton_Click(object sender, EventArgs e) { OnSideBarMenuClicked(); AboutBox.ShowDialog(); }
private void helpAboutMenuItem_Click(object sender, EventArgs e) { using (AboutBox aboutBox = new AboutBox()) { aboutBox.ShowDialog(); } }
void OnAbout(object sender,EventArgs e) { AboutBox about = new AboutBox(); about.ShowDialog(); }
private void ����VJK3GToolStripMenuItem_Click(object sender, EventArgs e) { AboutBox abt = new AboutBox(); abt.ShowDialog(this); }
private void MenuItemClick(object sender, RoutedEventArgs e) { AboutBox abInfo = new AboutBox(); abInfo.Show(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ExecutedAbout(object sender, ExecutedRoutedEventArgs e) { AboutBox box = new AboutBox(this); box.ShowDialog(); }
private void linkAbout_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { AboutBox aboutBox = new AboutBox(); aboutBox.ShowDialog(); }
/// <summary> /// Opens an About box. /// </summary> private void OnAbout(object sender, EventArgs e) { Form form = new AboutBox(); form.ShowDialog(); }
public static void ShowAbout(Object obj) { AboutBox AboutDlg = new AboutBox(Application.Current.Windows[0]); AboutDlg.ShowDialog(); }
public void About() { var dlg = new AboutBox(); dlg.ShowDialog(); }
private void aboutToolStripMenuItem_Click_1(object sender, EventArgs e) { var abtBox = new AboutBox(); abtBox.ShowDialog(); }
void mnuItemAbout_Click(object sender, EventArgs e) { AboutBox aboutBox = new AboutBox(); aboutBox.ShowDialog(this); }
private void AboutToolStripMenuItem_Click(object sender, EventArgs e) { var window = new AboutBox(); window.ShowDialog(this); }
private static void About(object sender, ExecutedRoutedEventArgs e) { MainWindow mainWindow = (MainWindow)sender; AboutBox about = new AboutBox(mainWindow); about.ShowDialog(); }
private void OnAboutMenuItemClicked(object sender, EventArgs e) { AboutBox aboutBox = new AboutBox(); aboutBox.ShowDialog(); }
/// <summary> /// Opens AboutBox dialog. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AboutToolStripMenuItemClick(object sender, EventArgs e) { AboutBox about = new AboutBox(); about.ShowDialog(); }
private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { using (AboutBox about = new AboutBox()) { about.ShowDialog(); } }
void menuItemAboutDetail_Click(object sender, System.EventArgs e) { AboutBox aboutBox = new AboutBox(); aboutBox.ShowDialog(this); }
private void menuItemAbout_Click(object sender, RoutedEventArgs e) { AboutBox about = new AboutBox(this); about.ShowDialog(); }
/// <summary> /// Open an About Box dialog. /// </summary> public void OpenAboutBox() { var dialog = new AboutBox(); dialog.ShowDialog(); }
private void ShowAboutBox() { var about = new AboutBox(this); about.ShowDialog(); }
protected override void Execute() { var about = new AboutBox(); about.ShowDialog(); }
void About_Click(object sender, RoutedEventArgs e) { AboutBox dialog = new AboutBox(Application.Current.MainWindow); dialog.ShowDialog(); }
private void tsB_Help_Click(object sender, EventArgs e) { AboutBox objAboutBox = new AboutBox(); objAboutBox.ShowDialog(); }
/// <summary> /// This function is the callback used to execute a command when the a menu item is clicked. /// See the Initialize method to see how the menu item is associated to this function using /// the OleMenuCommandService service and the MenuCommand class. /// </summary> private static void MenuItemCallback(object sender, EventArgs e) { var aboutBox = new AboutBox(); aboutBox.ShowModal(); }
private void about_Click(object sender, RoutedEventArgs e) { AboutBox about = new AboutBox(this); about.ShowDialog(); }
private void aboutButton_Click(object sender, EventArgs e) { AboutBox about = new AboutBox(); about.ShowDialog(); about.Dispose(); }
private void mnuHelp_About_Click(object sender, EventArgs e) { var dlg = new AboutBox(mRoot != null ? mRoot.ApplicationName : "Python", Resources.python_powered_h_140x182, Assembly.GetExecutingAssembly()); dlg.ShowDialog(); }
private void tsAbout_Click(object sender, EventArgs e) { AboutBox objAbout = new AboutBox(); objAbout.ShowDialog(); }
/// <summary> /// Static constructor. /// </summary> static AboutBox() { Instance = new AboutBox(); }
private void OnAbout(object sender, ExecutedRoutedEventArgs e) { AboutBox about = new AboutBox(this); about.ShowDialog(); }
public static void ShowAbout(Object obj) { var AboutDlg = new AboutBox(Application.Current.MainWindow); AboutDlg.ShowDialog(); }
private void 关于ToolStripMenuItem_Click(object sender, EventArgs e) { //MessageBox.Show("萝卜头IT论坛 nkc3g4制作\nQQ:1443112740\nEmail:[email protected]","关于"); AboutBox abx = new AboutBox(); abx.Show(); }
private void ExcuteShowAboutWindow() { AboutBox aboutBox = new AboutBox(); aboutBox.ShowDialog(); }
private void btnAbout_Click(object sender, EventArgs e) { AboutBox dialog = new AboutBox(); dialog.ShowDialog(); }
private void oAplikacijiToolStripMenuItem_Click(object sender, EventArgs e) { var frm = new AboutBox(); frm.ShowDialog(); }
/// <summary> /// /// </summary> /// <param name="Sender"></param> /// <param name="e"></param> private void about(object Sender, EventArgs e) { // var results = MessageBox.Show("FXPAL DisplayCast Player (v " + Shared.DisplayCastGlobals.DISPLAYCAST_VERSION.ToString() + "))", "FXPAL DisplayCast Player", MessageBoxButtons.OK); AboutBox about = new AboutBox(); var results = about.ShowDialog(); }
private void WireUpEvents() { #region Model Events _model.Events.TestsLoading += (TestFilesLoadingEventArgs e) => { UpdateViewCommands(testLoading: true); var message = e.TestFilesLoading.Count == 1 ? $"Loading Assembly: {e.TestFilesLoading[0]}" : $"Loading {e.TestFilesLoading.Count} Assemblies..."; _view.LongRunningOperation.Display(message); }; _model.Events.TestLoaded += (TestNodeEventArgs e) => { _view.LongRunningOperation.Hide(); UpdateViewCommands(); var files = _model.TestFiles; if (files.Count == 1) { _view.SetTitleBar(files.First()); } }; _model.Events.TestsUnloading += (TestEventArgse) => { UpdateViewCommands(); }; _model.Events.TestUnloaded += (TestEventArgs e) => { _view.RunSummary.Text = null; UpdateViewCommands(); }; _model.Events.TestsReloading += (TestEventArgs e) => { UpdateViewCommands(); _view.LongRunningOperation.Display("Reloading..."); }; _model.Events.TestReloaded += (TestNodeEventArgs e) => { _view.LongRunningOperation.Hide(); if (_settings.Gui.ClearResultsOnReload) { _view.RunSummary.Text = null; } UpdateViewCommands(); }; _model.Events.TestLoadFailure += (TestLoadFailureEventArgs e) => { _view.LongRunningOperation.Hide(); _view.MessageDisplay.Error(e.Exception.Message); }; _model.Events.RunStarting += (RunStartingEventArgs e) => { UpdateViewCommands(); _view.RunSummary.Text = null; }; _model.Events.RunFinished += (TestResultEventArgs e) => { _view.LongRunningOperation.Hide(); UpdateViewCommands(); ResultSummary summary = ResultSummaryCreator.FromResultNode(e.Result); _view.RunSummary.Text = string.Format( "Passed: {0} Failed: {1} Errors: {2} Inconclusive: {3} Invalid: {4} Ignored: {5} Skipped: {6} Time: {7}", summary.PassCount, summary.FailedCount, summary.ErrorCount, summary.InconclusiveCount, summary.InvalidCount, summary.IgnoreCount, summary.SkipCount, summary.Duration); if (summary.RunCount == 0) { } //string resultPath = Path.Combine(TestProject.BasePath, "TestResult.xml"); // TODO: Use Work Directory string resultPath = "TestResult.xml"; _model.SaveResults(resultPath); //try //{ // _model.SaveResults(resultPath); // //log.Debug("Saved result to {0}", resultPath); //} //catch (Exception ex) //{ // //log.Warning("Unable to save result to {0}\n{1}", resultPath, ex.ToString()); //} //if (e.Result.Outcome.Status == TestStatus.Failed) // _view.Activate(); // If we were running unattended, it's time to close if (_options.Unattended) { _view.Close(); } }; _settings.Changed += (s, e) => { if (e.SettingName == "Gui.Options.DisplayFormat") { InitializeDisplay(); } }; _model.Events.UnhandledException += (UnhandledExceptionEventArgs e) => { MessageBoxDisplay.Error($"{e.Message}\n\n{e.StackTrace}", "TestCentric - Internal Error"); }; #endregion #region View Events _view.Load += (s, e) => { InitializeDisplay(_settings.Gui.DisplayFormat); var settings = _model.PackageOverrides; if (_options.MaxAgents >= 0) { _model.Settings.Engine.Agents = _options.MaxAgents; } _view.RunAsX86.Checked = _options.RunAsX86; }; _view.Shown += (s, e) => { Application.DoEvents(); // Load test specified on command line or // the most recent one if options call for it if (_options.InputFiles.Count != 0) { LoadTests(_options.InputFiles); } else if (_settings.Gui.LoadLastProject && !_options.NoLoad) { foreach (string entry in _recentFiles.Entries) { if (entry != null && File.Exists(entry)) { LoadTests(entry); break; } } } //if ( guiOptions.include != null || guiOptions.exclude != null) //{ // testTree.ClearSelectedCategories(); // bool exclude = guiOptions.include == null; // string[] categories = exclude // ? guiOptions.exclude.Split(',') // : guiOptions.include.Split(','); // if ( categories.Length > 0 ) // testTree.SelectCategories( categories, exclude ); //} // Run loaded test automatically if called for if (_model.IsPackageLoaded && _options.RunAllTests) { RunAllTests(); } // Currently, --unattended without --run does nothing except exit. else if (_options.Unattended) { _view.Close(); } }; _view.SplitterPositionChanged += (s, e) => { _settings.Gui.MainForm.SplitPosition = _view.SplitterPosition; }; _view.FormClosing += (s, e) => { if (_model.IsPackageLoaded) { if (_model.IsTestRunning) { if (!_view.MessageDisplay.YesNo("A test is running, do you want to forcibly stop the test and exit?")) { e.Cancel = true; return; } _model.StopTestRun(true); } if (CloseProject() == DialogResult.Cancel) { e.Cancel = true; } } if (!e.Cancel) { if (_settings.Gui.DisplayFormat == "Mini") { _settings.Gui.MiniForm.Location = _view.Location; _settings.Gui.MiniForm.Size = _view.Size; } else { _settings.Gui.MainForm.Location = _view.Location; _settings.Gui.MainForm.Size = _view.Size; } } }; _view.RunButton.Execute += () => RunSelectedTests(); _view.StopButton.Execute += () => StopTests(); _view.ForceStopButton.Execute += () => ForceStop(); _view.FileMenu.Popup += () => { bool isPackageLoaded = _model.IsPackageLoaded; bool isTestRunning = _model.IsTestRunning; _view.OpenCommand.Enabled = !isTestRunning; _view.CloseCommand.Enabled = isPackageLoaded && !isTestRunning; _view.ReloadTestsCommand.Enabled = isPackageLoaded && !isTestRunning; _view.RuntimeMenu.Visible = _model.AvailableRuntimes.Count > 1; _view.RecentFilesMenu.Enabled = !isTestRunning; //if (!isTestRunning) //{ // _recentProjectsMenuHandler.Load(); //} }; _view.RuntimeMenu.Popup += () => _runtimeSelectionController.PopulateMenu(); _view.OpenCommand.Execute += () => OpenProject(); _view.CloseCommand.Execute += () => CloseProject(); _view.AddTestFilesCommand.Execute += () => AddTestFiles(); _view.ReloadTestsCommand.Execute += () => ReloadTests(); _view.RunAsX86.CheckedChanged += () => { var key = EnginePackageSettings.RunAsX86; if (_view.RunAsX86.Checked) { ChangePackageSettingAndReload(key, true); } else { ChangePackageSettingAndReload(key, null); } }; _view.RecentFilesMenu.Popup += () => { var menuItems = _view.RecentFilesMenu.MenuItems; // Test for null, in case we are running tests with a mock if (menuItems == null) { return; } menuItems.Clear(); int num = 0; foreach (string entry in _model.RecentFiles.Entries) { var menuText = string.Format("{0} {1}", ++num, entry); var menuItem = new ToolStripMenuItem(menuText); menuItem.Click += (sender, ea) => { // HACK: We are loading new files, cancel any runtime override _model.PackageOverrides.Remove(EnginePackageSettings.RequestedRuntimeFramework); string path = ((ToolStripMenuItem)sender).Text.Substring(2); _model.LoadTests(new[] { path }); }; menuItems.Add(menuItem); if (num >= _settings.Gui.RecentProjects.MaxFiles) { break; } } }; _view.ExitCommand.Execute += () => _view.Close(); _view.DisplayFormat.SelectionChanged += () => { _settings.Gui.DisplayFormat = _view.DisplayFormat.SelectedItem; InitializeDisplay(_view.DisplayFormat.SelectedItem); }; _view.IncreaseFontCommand.Execute += () => { applyFont(IncreaseFont(_settings.Gui.Font)); }; _view.DecreaseFontCommand.Execute += () => { applyFont(DecreaseFont(_settings.Gui.Font)); }; _view.ChangeFontCommand.Execute += () => { Font currentFont = _settings.Gui.Font; Font newFont = _view.DialogManager.SelectFont(currentFont); if (newFont != _settings.Gui.Font) { applyFont(newFont); } }; _view.DialogManager.ApplyFont += (font) => applyFont(font); _view.RestoreFontCommand.Execute += () => { applyFont(Form.DefaultFont); }; _view.IncreaseFixedFontCommand.Execute += () => { _settings.Gui.FixedFont = IncreaseFont(_settings.Gui.FixedFont); }; _view.DecreaseFixedFontCommand.Execute += () => { _settings.Gui.FixedFont = DecreaseFont(_settings.Gui.FixedFont); }; _view.RestoreFixedFontCommand.Execute += () => { _settings.Gui.FixedFont = new Font(FontFamily.GenericMonospace, 8.0f); }; _view.StatusBarCommand.CheckedChanged += () => { _view.StatusBarView.Visible = _view.StatusBarCommand.Checked; }; _view.RunAllCommand.Execute += () => RunAllTests(); _view.RunSelectedCommand.Execute += () => RunSelectedTests(); _view.RunFailedCommand.Execute += () => RunFailedTests(); _view.StopRunCommand.Execute += () => StopTests(); _view.ForceStopCommand.Execute += () => ForceStop(); _view.TestParametersCommand.Execute += () => { using (var dlg = new TestParametersDialog()) { dlg.Font = _settings.Gui.Font; dlg.StartPosition = FormStartPosition.CenterParent; if (_model.PackageOverrides.ContainsKey("TestParametersDictionary")) { var testParms = _model.PackageOverrides["TestParametersDictionary"] as IDictionary <string, string>; foreach (string key in testParms.Keys) { dlg.Parameters.Add(key, testParms[key]); } } if (dlg.ShowDialog(_view as IWin32Window) == DialogResult.OK) { ChangePackageSettingAndReload("TestParametersDictionary", dlg.Parameters); } } }; _view.ToolsMenu.Popup += () => { _view.SaveResultsAsMenu.MenuItems.Clear(); foreach (string format in _resultFormats) { var formatItem = new ToolStripMenuItem(format); formatItem.Click += (s, e) => SaveResults(format); _view.SaveResultsAsMenu.MenuItems.Add(formatItem); } }; _view.SaveResultsCommand.Execute += () => SaveResults(); _view.OpenWorkDirectoryCommand.Execute += () => System.Diagnostics.Process.Start(_model.WorkDirectory); _view.ExtensionsCommand.Execute += () => { using (var extensionsDialog = new ExtensionDialog(_model.Services.ExtensionService)) { extensionsDialog.Font = _settings.Gui.Font; extensionsDialog.ShowDialog(); } }; _view.SettingsCommand.Execute += () => { SettingsDialog.Display(this, _model); }; _view.TestCentricHelpCommand.Execute += () => { System.Diagnostics.Process.Start("https://test-centric.org/testcentric-gui"); }; _view.NUnitHelpCommand.Execute += () => { System.Diagnostics.Process.Start("https://docs.nunit.org/articles/nunit/intro.html"); }; _view.AboutCommand.Execute += () => { using (AboutBox aboutBox = new AboutBox()) { aboutBox.ShowDialog(); } }; _view.ResultTabs.SelectionChanged += () => { _settings.Gui.SelectedTab = _view.ResultTabs.SelectedIndex; }; #endregion }
private void aboutMenu_Click(object sender, EventArgs e) { AboutBox aboutBox = new AboutBox(); aboutBox.ShowDialog(); }
private void menuHelpAbout_Click(object sender, EventArgs e) { AboutBox a = new AboutBox(); a.ShowDialog(this); }
private void CommandBinding_About(object sender, ExecutedRoutedEventArgs e) { var ab = new AboutBox(this); ab.ShowDialog(); }
private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { AboutBox aboutBox = new AboutBox(desc, Text); aboutBox.ShowDialog(); }
private void hover_FileAboutClicked(object sender, EventArgs e) { AboutBox dlg = new AboutBox(); dlg.ShowDialog(this); }
private void WireUpEvents() { #region Model Events _model.Events.TestsLoading += (TestFilesLoadingEventArgs e) => { UpdateViewCommands(testLoading: true); var message = e.TestFilesLoading.Count == 1 ? $"Loading Assembly: {e.TestFilesLoading[0]}" : $"Loading {e.TestFilesLoading.Count} Assemblies..."; _longOpDisplay = _view.LongOperationDisplay(message); }; _model.Events.TestLoaded += (TestNodeEventArgs e) => { if (_longOpDisplay != null) { _longOpDisplay.Dispose(); _longOpDisplay = null; } UpdateViewCommands(); }; _model.Events.TestsUnloading += (TestEventArgse) => { UpdateViewCommands(); }; _model.Events.TestUnloaded += (TestEventArgs e) => { _view.RunSummary.Text = null; UpdateViewCommands(); }; _model.Events.TestsReloading += (TestEventArgs e) => { UpdateViewCommands(); _longOpDisplay = _view.LongOperationDisplay("Reloading..."); }; _model.Events.TestReloaded += (TestNodeEventArgs e) => { if (_longOpDisplay != null) { _longOpDisplay.Dispose(); _longOpDisplay = null; } //SetTitleBar(TestProject.Name); if (_settings.Gui.ClearResultsOnReload) { _view.RunSummary.Text = null; } UpdateViewCommands(); }; _model.Events.RunStarting += (RunStartingEventArgs e) => { UpdateViewCommands(); }; _model.Events.RunFinished += (TestResultEventArgs e) => { UpdateViewCommands(); ResultSummary summary = ResultSummaryCreator.FromResultNode(e.Result); _view.RunSummary.Text = string.Format( "Passed: {0} Failed: {1} Errors: {2} Inconclusive: {3} Invalid: {4} Ignored: {5} Skipped: {6} Time: {7}", summary.PassCount, summary.FailedCount, summary.ErrorCount, summary.InconclusiveCount, summary.InvalidCount, summary.IgnoreCount, summary.SkipCount, summary.Duration); //string resultPath = Path.Combine(TestProject.BasePath, "TestResult.xml"); // TODO: Use Work Directory string resultPath = "TestResult.xml"; _model.SaveResults(resultPath); //try //{ // _model.SaveResults(resultPath); // //log.Debug("Saved result to {0}", resultPath); //} //catch (Exception ex) //{ // //log.Warning("Unable to save result to {0}\n{1}", resultPath, ex.ToString()); //} //if (e.Result.Outcome.Status == TestStatus.Failed) // _view.Activate(); }; _settings.Changed += (s, e) => { if (e.SettingName == "Gui.Options.DisplayFormat") { InitializeDisplay(); } }; _model.Events.UnhandledException += (UnhandledExceptionEventArgs e) => { var display = new MessageDisplay("TestCentric - Internal Error"); display.Error($"{e.Message}\n\n{e.StackTrace}"); }; #endregion #region View Events _view.Load += (s, e) => { InitializeDisplay(_settings.Gui.DisplayFormat); }; _view.Shown += (s, e) => { Application.DoEvents(); // Load test specified on command line or // the most recent one if options call for it if (_options.InputFiles.Count != 0) { LoadTests(_options.InputFiles); } else if (_settings.Gui.LoadLastProject && !_options.NoLoad) { foreach (string entry in _recentFiles.Entries) { if (entry != null && File.Exists(entry)) { LoadTests(entry); break; } } } //if ( guiOptions.include != null || guiOptions.exclude != null) //{ // testTree.ClearSelectedCategories(); // bool exclude = guiOptions.include == null; // string[] categories = exclude // ? guiOptions.exclude.Split(',') // : guiOptions.include.Split(','); // if ( categories.Length > 0 ) // testTree.SelectCategories( categories, exclude ); //} // Run loaded test automatically if called for if (_model.IsPackageLoaded && _options.RunAllTests) { RunAllTests(); } }; _view.Move += (s, e) => { if (!_view.Maximized) { var location = _view.Location; switch (_view.DisplayFormat.SelectedItem) { case "Full": default: _settings.Gui.MainForm.Left = location.X; _settings.Gui.MainForm.Top = location.Y; _settings.Gui.MainForm.Maximized = false; break; case "Mini": _settings.Gui.MiniForm.Left = location.X; _settings.Gui.MiniForm.Top = location.Y; _settings.Gui.MiniForm.Maximized = false; break; } } }; _view.Resize += (s, e) => { if (!_view.Maximized) { var size = _view.Size; if (_view.DisplayFormat.SelectedItem == "Full") { _settings.Gui.MainForm.Width = size.Width; _settings.Gui.MainForm.Height = size.Height; } else { _settings.Gui.MiniForm.Width = size.Width; _settings.Gui.MiniForm.Height = size.Height; } } }; _view.SplitterPositionChanged += (s, e) => { _settings.Gui.MainForm.SplitPosition = _view.SplitterPosition; }; _view.FormClosing += (s, e) => { if (_model.IsPackageLoaded) { if (_model.IsTestRunning) { DialogResult dialogResult = _view.MessageDisplay.Ask( "A test is running, do you want to stop the test and exit?"); if (dialogResult == DialogResult.No) { e.Cancel = true; return; } _model.CancelTestRun(); } if (CloseProject() == DialogResult.Cancel) { e.Cancel = true; } } }; _view.RunButton.Execute += () => RunSelectedTests(); _view.StopButton.Execute += () => CancelRun(); _view.FileMenu.Popup += () => { bool isPackageLoaded = _model.IsPackageLoaded; bool isTestRunning = _model.IsTestRunning; _view.OpenCommand.Enabled = !isTestRunning; _view.CloseCommand.Enabled = isPackageLoaded && !isTestRunning; _view.ReloadTestsCommand.Enabled = isPackageLoaded && !isTestRunning; var frameworks = _model.AvailableRuntimes; var runtimeMenu = _view.RuntimeMenu; runtimeMenu.Visible = frameworks.Count > 1; if (runtimeMenu.Visible && runtimeMenu.Enabled && runtimeMenu.MenuItems.Count == 0) { var defaultMenuItem = new MenuItem("Default"); defaultMenuItem.Name = "defaultMenuItem"; defaultMenuItem.Tag = "DEFAULT"; defaultMenuItem.Checked = true; runtimeMenu.MenuItems.Add(defaultMenuItem); // TODO: Disable selections that are not supported for the target? foreach (IRuntimeFramework framework in frameworks) { MenuItem item = new MenuItem(framework.DisplayName); item.Tag = framework.Id; runtimeMenu.MenuItems.Add(item); } _view.SelectedRuntime.Refresh(); } _view.RecentFilesMenu.Enabled = !isTestRunning; //if (!isTestRunning) //{ // _recentProjectsMenuHandler.Load(); //} }; _view.OpenCommand.Execute += () => OpenProject(); _view.CloseCommand.Execute += () => CloseProject(); _view.AddTestFilesCommand.Execute += () => AddTestFiles(); _view.ReloadTestsCommand.Execute += () => ReloadTests(); _view.SelectedRuntime.SelectionChanged += () => { ChangePackageSettingAndReload(EnginePackageSettings.RuntimeFramework, _view.SelectedRuntime.SelectedItem); }; _view.ProcessModel.SelectionChanged += () => { ChangePackageSettingAndReload(EnginePackageSettings.ProcessModel, _view.ProcessModel.SelectedItem); }; _view.DomainUsage.SelectionChanged += () => { ChangePackageSettingAndReload(EnginePackageSettings.DomainUsage, _view.DomainUsage.SelectedItem); }; _view.RunAsX86.CheckedChanged += () => { var key = EnginePackageSettings.RunAsX86; if (_view.RunAsX86.Checked) { ChangePackageSettingAndReload(key, true); } else { ChangePackageSettingAndReload(key, null); } }; _view.RecentFilesMenu.Popup += () => { var menuItems = _view.RecentFilesMenu.MenuItems; // Test for null, in case we are running tests with a mock if (menuItems == null) { return; } menuItems.Clear(); int num = 0; foreach (string entry in _model.Services.RecentFiles.Entries) { var menuText = string.Format("{0} {1}", ++num, entry); var menuItem = new MenuItem(menuText); menuItem.Click += (sender, ea) => { string path = ((MenuItem)sender).Text.Substring(2); _model.LoadTests(new[] { path }); }; menuItems.Add(menuItem); if (num >= _settings.Gui.RecentProjects.MaxFiles) { break; } } }; _view.ExitCommand.Execute += () => _view.Close(); _view.DisplayFormat.SelectionChanged += () => { _settings.Gui.DisplayFormat = _view.DisplayFormat.SelectedItem; InitializeDisplay(_view.DisplayFormat.SelectedItem); }; _view.IncreaseFontCommand.Execute += () => { applyFont(IncreaseFont(_settings.Gui.Font)); }; _view.DecreaseFontCommand.Execute += () => { applyFont(DecreaseFont(_settings.Gui.Font)); }; _view.ChangeFontCommand.Execute += () => { Font currentFont = _settings.Gui.Font; Font newFont = _view.DialogManager.SelectFont(currentFont); if (newFont != _settings.Gui.Font) { applyFont(newFont); } }; _view.DialogManager.ApplyFont += (font) => applyFont(font); _view.RestoreFontCommand.Execute += () => { applyFont(Form.DefaultFont); }; _view.IncreaseFixedFontCommand.Execute += () => { _settings.Gui.FixedFont = IncreaseFont(_settings.Gui.FixedFont); }; _view.DecreaseFixedFontCommand.Execute += () => { _settings.Gui.FixedFont = DecreaseFont(_settings.Gui.FixedFont); }; _view.RestoreFixedFontCommand.Execute += () => { _settings.Gui.FixedFont = new Font(FontFamily.GenericMonospace, 8.0f); }; _view.StatusBarCommand.CheckedChanged += () => { _view.StatusBarView.Visible = _view.StatusBarCommand.Checked; }; _view.RunAllCommand.Execute += () => RunAllTests(); _view.RunSelectedCommand.Execute += () => RunSelectedTests(); _view.RunFailedCommand.Execute += () => RunFailedTests(); _view.StopRunCommand.Execute += () => CancelRun(); _view.SaveResultsCommand.Execute += () => SaveResults(); _view.OpenWorkDirectoryCommand.Execute += () => System.Diagnostics.Process.Start(_model.WorkDirectory); _view.ExtensionsCommand.Execute += () => { using (var extensionsDialog = new ExtensionDialog(_model.Services.ExtensionService)) { extensionsDialog.Font = _settings.Gui.Font; extensionsDialog.ShowDialog(); } }; _view.SettingsCommand.Execute += () => { SettingsDialog.Display(this, _model); }; _view.TestCentricHelpCommand.Execute += () => { _view.MessageDisplay.Error("Not Yet Implemented"); }; _view.NUnitHelpCommand.Execute += () => { System.Diagnostics.Process.Start("https://github.com/nunit/docs/wiki/NUnit-Documentation"); }; _view.AboutCommand.Execute += () => { using (AboutBox aboutBox = new AboutBox()) { aboutBox.ShowDialog(); } }; _view.ResultTabs.SelectionChanged += () => { _settings.Gui.SelectedTab = _view.ResultTabs.SelectedIndex; }; #endregion }
private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { AboutBox aboutBox = new AboutBox(); aboutBox.ShowDialog(); }
private void 关于ToolStripMenuItem_Click(object sender, EventArgs e) { AboutBox box = new AboutBox(); box.ShowDialog(); }
protected virtual void OnAboutActionActivated(object sender, System.EventArgs e) { AboutBox abb = new AboutBox(); abb.Run(); abb.Destroy(); }
private void aboutUsToolStripMenuItem_Click(object sender, EventArgs e) { AboutBox aboutBox = new AboutBox(); aboutBox.Show(); }
/// <summary> /// Reset all dialogs by closing it, so when next time each of the dialog will be executed, it will be reopened from scratch /// </summary> public static void Reset() { var forms = AllDialogs; foreach (Form form in forms) { if (form != null) form.Close(); } oath = null; open = null; save = null; timeLog = null; summary = null; about = null; options = null; taskManager = null; spentOnDiffDays = null; }
private void WireUpEvents() { #region Model Events _model.Events.TestsLoading += (TestFilesLoadingEventArgs e) => { UpdateViewCommands(testLoading: true); var message = e.TestFilesLoading.Count == 1 ? $"Loading Assembly: {e.TestFilesLoading[0]}" : $"Loading {e.TestFilesLoading.Count} Assemblies..."; BeginLongRunningOperation(message); }; _model.Events.TestLoaded += (TestNodeEventArgs e) => { OnLongRunningOperationComplete(); UpdateViewCommands(); _view.StopRunButton.Visible = true; _view.ForceStopButton.Visible = false; var files = _model.TestFiles; if (files.Count == 1) { _view.SetTitleBar(files.First()); } }; _model.Events.TestsUnloading += (TestEventArgse) => { UpdateViewCommands(); _view.StopRunButton.Visible = true; _view.ForceStopButton.Visible = false; BeginLongRunningOperation("Unloading..."); }; _model.Events.TestUnloaded += (TestEventArgs e) => { OnLongRunningOperationComplete(); UpdateViewCommands(); _view.StopRunButton.Visible = true; _view.ForceStopButton.Visible = false; }; _model.Events.TestsReloading += (TestEventArgs e) => { UpdateViewCommands(); BeginLongRunningOperation("Reloading..."); }; _model.Events.TestReloaded += (TestNodeEventArgs e) => { OnLongRunningOperationComplete(); UpdateViewCommands(); _view.StopRunButton.Visible = true; _view.ForceStopButton.Visible = false; }; _model.Events.TestLoadFailure += (TestLoadFailureEventArgs e) => { OnLongRunningOperationComplete(); _view.MessageDisplay.Error(e.Exception.Message); }; _model.Events.RunStarting += (RunStartingEventArgs e) => { UpdateViewCommands(); _view.StopRunButton.Visible = true; _view.ForceStopButton.Visible = false; _view.RunSummaryButton.Visible = false; }; _model.Events.RunFinished += (TestResultEventArgs e) => OnRunFinished(e.Result); // Separate internal method for testing void OnRunFinished(ResultNode result) { OnLongRunningOperationComplete(); UpdateViewCommands(); // Reset these in case run was cancelled _view.StopRunMenuCommand.Visible = true; _view.ForceStopMenuCommand.Visible = false; _view.StopRunButton.Visible = true; _view.ForceStopButton.Visible = false; _view.RunSummaryButton.Visible = true; //string resultPath = Path.Combine(TestProject.BasePath, "TestResult.xml"); // TODO: Use Work Directory string resultPath = "TestResult.xml"; _model.SaveResults(resultPath); //try //{ // _model.SaveResults(resultPath); // //log.Debug("Saved result to {0}", resultPath); //} //catch (Exception ex) //{ // //log.Warning("Unable to save result to {0}\n{1}", resultPath, ex.ToString()); //} //if (e.Result.Outcome.Status == TestStatus.Failed) // _view.Activate(); // If we were running unattended, it's time to close if (_options.Unattended) { _view.Close(); } else { DisplayTestRunSummary(result, true); } }; _settings.Changed += (s, e) => { switch (e.SettingName) { case "TestCentric.Gui.GuiLayout": // Settings have changed (from settings dialog) // so we want to update the GUI to match. var newLayout = _settings.Gui.GuiLayout; var oldLayout = _view.GuiLayout.SelectedItem; // Make sure it hasn't already been changed if (oldLayout != newLayout) { // Save position of form for old layout SaveFormLocationAndSize(oldLayout); // Update the GUI itself SetGuiLayout(newLayout); _view.GuiLayout.SelectedItem = newLayout; } break; case "TestCentric.Gui.MainForm.ShowStatusBar": _view.StatusBarView.Visible = _settings.Gui.MainForm.ShowStatusBar; break; } }; _model.Events.UnhandledException += (UnhandledExceptionEventArgs e) => { MessageBoxDisplay.Error($"{e.Message}\n\n{e.StackTrace}", "TestCentric - Internal Error"); }; #endregion #region View Events _view.Load += (s, e) => { var guiLayout = _settings.Gui.GuiLayout; _view.GuiLayout.SelectedItem = guiLayout; SetGuiLayout(guiLayout); var settings = _model.PackageOverrides; if (_options.MaxAgents >= 0) { _model.Settings.Engine.Agents = _options.MaxAgents; } _view.RunAsX86.Checked = _options.RunAsX86; }; _view.Shown += (s, e) => { Application.DoEvents(); // Load test specified on command line or // the most recent one if options call for it if (_options.InputFiles.Count != 0) { LoadTests(_options.InputFiles); } else if (_settings.Gui.LoadLastProject && !_options.NoLoad) { foreach (string entry in _recentFiles.Entries) { if (entry != null && File.Exists(entry)) { LoadTests(entry); break; } } } //if ( guiOptions.include != null || guiOptions.exclude != null) //{ // testTree.ClearSelectedCategories(); // bool exclude = guiOptions.include == null; // string[] categories = exclude // ? guiOptions.exclude.Split(',') // : guiOptions.include.Split(','); // if ( categories.Length > 0 ) // testTree.SelectCategories( categories, exclude ); //} // Run loaded test automatically if called for if (_model.IsPackageLoaded && _options.RunAllTests) { RunAllTests(); } // Currently, --unattended without --run does nothing except exit. else if (_options.Unattended) { _view.Close(); } }; _view.SplitterPositionChanged += (s, e) => { _settings.Gui.MainForm.SplitPosition = _view.SplitterPosition; }; _view.FormClosing += (s, e) => { if (_model.IsPackageLoaded) { if (_model.IsTestRunning) { if (!_view.MessageDisplay.YesNo("A test is running, do you want to forcibly stop the test and exit?")) { e.Cancel = true; return; } _model.StopTestRun(true); } if (CloseProject() == DialogResult.Cancel) { e.Cancel = true; } } if (!e.Cancel) { SaveFormLocationAndSize(_settings.Gui.GuiLayout); } }; _view.FileMenu.Popup += () => { bool isPackageLoaded = _model.IsPackageLoaded; bool isTestRunning = _model.IsTestRunning; _view.OpenCommand.Enabled = !isTestRunning; _view.CloseCommand.Enabled = isPackageLoaded && !isTestRunning; _view.ReloadTestsCommand.Enabled = isPackageLoaded && !isTestRunning; _view.SelectAgentMenu.Enabled = _agentSelectionController.AllowAgentSelection(); _view.RunAsX86.Enabled = isPackageLoaded && !isTestRunning; _view.RecentFilesMenu.Enabled = !isTestRunning; //if (!isTestRunning) //{ // _recentProjectsMenuHandler.Load(); //} }; _view.OpenCommand.Execute += () => OpenProject(); _view.CloseCommand.Execute += () => CloseProject(); _view.AddTestFilesCommand.Execute += () => AddTestFiles(); _view.ReloadTestsCommand.Execute += () => ReloadTests(); _view.SelectAgentMenu.Popup += () => { _agentSelectionController.PopulateMenu(); }; _view.RunAsX86.CheckedChanged += () => { var key = EnginePackageSettings.RunAsX86; if (_view.RunAsX86.Checked) { ChangePackageSettingAndReload(key, true); } else { ChangePackageSettingAndReload(key, null); } }; _view.RecentFilesMenu.Popup += () => { var menuItems = _view.RecentFilesMenu.MenuItems; // Test for null, in case we are running tests with a mock if (menuItems == null) { return; } menuItems.Clear(); int num = 0; foreach (string entry in _model.RecentFiles.Entries) { var menuText = string.Format("{0} {1}", ++num, entry); var menuItem = new ToolStripMenuItem(menuText); menuItem.Click += (sender, ea) => { // HACK: We are loading new files, cancel any runtime override _model.PackageOverrides.Remove(EnginePackageSettings.RequestedRuntimeFramework); string path = ((ToolStripMenuItem)sender).Text.Substring(2); _model.LoadTests(new[] { path }); }; menuItems.Add(menuItem); if (num >= _settings.Gui.RecentProjects.MaxFiles) { break; } } }; _view.ExitCommand.Execute += () => _view.Close(); _view.GuiLayout.SelectionChanged += () => { // Selection menu item has changed, so we want // to update both the display and the settings var oldLayout = _settings.Gui.GuiLayout; var newLayout = _view.GuiLayout.SelectedItem; if (oldLayout != newLayout) { SaveFormLocationAndSize(oldLayout); SetGuiLayout(newLayout); } _settings.Gui.GuiLayout = _view.GuiLayout.SelectedItem; }; _view.IncreaseFontCommand.Execute += () => { applyFont(IncreaseFont(_settings.Gui.Font)); }; _view.DecreaseFontCommand.Execute += () => { applyFont(DecreaseFont(_settings.Gui.Font)); }; _view.ChangeFontCommand.Execute += () => { Font currentFont = _settings.Gui.Font; Font newFont = _view.DialogManager.SelectFont(currentFont); if (newFont != _settings.Gui.Font) { applyFont(newFont); } }; _view.DialogManager.ApplyFont += (font) => applyFont(font); _view.RestoreFontCommand.Execute += () => { applyFont(Form.DefaultFont); }; _view.IncreaseFixedFontCommand.Execute += () => { _settings.Gui.FixedFont = IncreaseFont(_settings.Gui.FixedFont); }; _view.DecreaseFixedFontCommand.Execute += () => { _settings.Gui.FixedFont = DecreaseFont(_settings.Gui.FixedFont); }; _view.RestoreFixedFontCommand.Execute += () => { _settings.Gui.FixedFont = new Font(FontFamily.GenericMonospace, 8.0f); }; _view.RunAllMenuCommand.Execute += () => RunAllTests(); _view.RunSelectedMenuCommand.Execute += () => RunSelectedTests(); _view.RunFailedMenuCommand.Execute += () => RunFailedTests(); _view.RunAllToolbarCommand.Execute += () => RunAllTests(); _view.RunSelectedToolbarCommand.Execute += () => RunSelectedTests(); _view.RunButton.Execute += () => { // Necessary test because we don't disable the button click if (_model.HasTests && !_model.IsTestRunning) { RunAllTests(); } // TODO: This should actually run the last Run action selected in the dropdown }; _view.DebugAllToolbarCommand.Execute += () => _model.DebugAllTests(); _view.DebugSelectedToolbarCommand.Execute += () => _model.DebugSelectedTests(); _view.DebugButton.Execute += () => { // Necessary test because we don't disable the button click if (_model.HasTests && !_model.IsTestRunning) { _model.DebugAllTests(); } // TODO: This should actually run the last Run action selected in the dropdown }; _view.DisplayFormat.SelectionChanged += () => { SetTreeDisplayFormat(_view.DisplayFormat.SelectedItem); }; _view.GroupBy.SelectionChanged += () => { switch (_view.DisplayFormat.SelectedItem) { case "TEST_LIST": _settings.Gui.TestTree.TestList.GroupBy = _view.GroupBy.SelectedItem; break; case "FIXTURE_LIST": _settings.Gui.TestTree.FixtureList.GroupBy = _view.GroupBy.SelectedItem; break; } }; _view.StopRunMenuCommand.Execute += ExecuteNormalStop; _view.StopRunButton.Execute += ExecuteNormalStop; _view.ForceStopMenuCommand.Execute += ExecuteForcedStop; _view.ForceStopButton.Execute += ExecuteForcedStop; _view.TestParametersMenuCommand.Execute += DisplayTestParametersDialog; _view.TestParametersToolbarCommand.Execute += DisplayTestParametersDialog; _view.RunSummaryButton.Execute += () => { var result = _model.GetResultForTest(_model.Tests.Id); DisplayTestRunSummary(result, false); }; //_view.RunSummaryButton.CheckedChanged += () => //{ // if (_view.RunSummaryButton.Checked) // { // var resultId = _model.GetResultForTest(_model.Tests.Id); // var summary = ResultSummaryCreator.FromResultNode(resultId); // string report = ResultSummaryReporter.WriteSummaryReport(summary); // _view.DisplayTestRunSummary(report); // } // else // _view.HideTestRunSummary(); //}; _view.ToolsMenu.Popup += () => { _view.SaveResultsAsMenu.MenuItems.Clear(); foreach (string format in _resultFormats) { var formatItem = new ToolStripMenuItem(format); formatItem.Click += (s, e) => SaveResults(format); _view.SaveResultsAsMenu.MenuItems.Add(formatItem); } }; _view.SaveResultsCommand.Execute += () => SaveResults(); _view.OpenWorkDirectoryCommand.Execute += () => System.Diagnostics.Process.Start(_model.WorkDirectory); _view.ExtensionsCommand.Execute += () => { using (var extensionsDialog = new ExtensionDialog(_model.Services.ExtensionService)) { extensionsDialog.Font = _settings.Gui.Font; extensionsDialog.ShowDialog(); } }; _view.SettingsCommand.Execute += () => { SettingsDialog.Display(this, _model); }; _view.TestCentricHelpCommand.Execute += () => { System.Diagnostics.Process.Start("https://test-centric.org/testcentric-gui"); }; _view.NUnitHelpCommand.Execute += () => { System.Diagnostics.Process.Start("https://docs.nunit.org/articles/nunit/intro.html"); }; _view.AboutCommand.Execute += () => { using (AboutBox aboutBox = new AboutBox()) { aboutBox.ShowDialog(); } }; _view.ResultTabs.SelectionChanged += () => { _settings.Gui.SelectedTab = _view.ResultTabs.SelectedIndex; }; #endregion }
/// <summary> /// The btn about click. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void BtnAboutClick(object sender, RoutedEventArgs e) { var aboutBox = new AboutBox(this); aboutBox.ShowDialog(); }
public void About() { AboutBox aboutBox = new AboutBox(); aboutBox.Show(); }
/// <summary> /// About command handler /// </summary> public void About() { AboutBox about = new AboutBox(Application.Current.MainWindow); about.Title = @"About SimpleConverter"; try { System.IO.StreamReader reader = new System.IO.StreamReader(Application.GetResourceStream(new System.Uri("/about.txt", UriKind.Relative)).Stream); about.description.Text = reader.ReadToEnd(); } catch (System.IO.IOException) { } about.ShowDialog(); }
/// <summary> /// Display the about box. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { AboutBox aboutForm = new AboutBox(); aboutForm.ShowDialog(this); }
public void ShowAboutDialog() { AboutBox dialog = new AboutBox(); dialog.ShowDialog(); }
/// <summary> /// Shows the "about" visual form with an help button to open the help file, /// and another help button to open the code documentation. /// </summary> public void Info() { AboutBox frm = new AboutBox(); frm.ShowDialog(); }
// Please update FormCommandlineHelp if you add or change commands private void RunCommandBasedOnArgument(string[] args, Dictionary<string, string> arguments) { switch (args[1]) { case "about": var frm = new AboutBox(); frm.StartPosition = FormStartPosition.CenterScreen; Application.Run(frm); return; case "add": case "addfiles": StartAddFilesDialog(args.Length == 3 ? args[2] : "."); return; case "apply": // [filename] case "applypatch": StartApplyPatchDialog(args.Length == 3 ? args[2] : ""); return; case "blame": // filename RunBlameCommand(args); return; case "branch": StartCreateBranchDialog(); return; case "browse": // [path] [-filter] RunBrowseCommand(args); return; case "checkout": case "checkoutbranch": StartCheckoutBranch(); return; case "checkoutrevision": StartCheckoutRevisionDialog(); return; case "cherry": StartCherryPickDialog(); return; case "cleanup": StartCleanupRepositoryDialog(); return; case "clone": // [path] RunCloneCommand(args); return; case "commit": // [--quiet] Commit(arguments); return; case "difftool": // filename Module.OpenWithDifftool(args[2]); return; case "filehistory": // filename if (Module.WorkingDir.TrimEnd('\\') == Path.GetFullPath(args[2])) Module = Module.SuperprojectModule; RunFileHistoryCommand(args); return; case "fileeditor": // filename if (!StartFileEditorDialog(args[2])) System.Environment.ExitCode = -1; return; case "formatpatch": StartFormatPatchDialog(); return; case "gitbash": Module.RunBash(); return; case "gitignore": StartEditGitIgnoreDialog(); return; case "init": // [path] RunInitCommand(args); return; case "merge": // [--branch name] RunMergeCommand(arguments); return; case "mergeconflicts": // [--quiet] case "mergetool": RunMergeToolOrConflictCommand(arguments); return; case "openrepo": // [path] RunOpenRepoCommand(args); return; case "pull": // [--rebase] [--merge] [--fetch] [--quiet] [--remotebranch name] Pull(arguments); return; case "push": // [--quiet] Push(arguments); return; case "rebase": // [--branch name] RunRebaseCommand(arguments); return; case "remotes": StartRemotesDialog(); return; case "revert": case "reset": StartResetChangesDialog(args.Length == 3 ? args[2] : ""); return; case "searchfile": RunSearchFileCommand(); return; case "settings": StartSettingsDialog(); return; case "stash": StartStashDialog(); return; case "synchronize": // [--rebase] [--merge] [--fetch] [--quiet] RunSynchronizeCommand(arguments); return; case "tag": StartCreateTagDialog(); return; case "viewdiff": StartCompareRevisionsDialog(); return; case "viewpatch": // [filename] StartViewPatchDialog(args.Length == 3 ? args[2] : ""); return; default: if (args[1].StartsWith("git://") || args[1].StartsWith("http://") || args[1].StartsWith("https://")) { StartCloneDialog(null, args[1], true, null); return; } if (args[1].StartsWith("github-windows://openRepo/")) { StartCloneDialog(null, args[1].Replace("github-windows://openRepo/", ""), true, null); return; } break; } var frmCmdLine = new FormCommandlineHelp(); frmCmdLine.StartPosition = FormStartPosition.CenterScreen; Application.Run(frmCmdLine); }
private void AboutToolStripMenuItem1Click(object sender, EventArgs e) { var aboutBox = new AboutBox(); aboutBox.ShowDialog(this); }