Exemple #1
0
        public static TestMethodViewModel CreateTestMethodViewModel(CloseApp closeApp, AddResultControl addResultContol, ClearResultControl clearTestResult)
        {
            TestMethodViewModel viewModel = new TestMethodViewModel(addResultContol, clearTestResult);
            viewModel.CloseApp = closeApp;
            viewModel.ConsoleMode = App.ConsoleMode;

            return viewModel;
        }
 public MainViewModel(ILogger <MainViewModel> logger, IAcmePdbParser acmePdbParser, Globals globals, IDispatcher dispatcher,
                      ISettingsManager settingsManager, ErrorMessagesViewModel errorMessagesViewModel, IServiceScope scope, IViceBridge viceBridge,
                      IProjectPrgFileWatcher projectPdbFileWatcher, RegistersMapping registersMapping, RegistersViewModel registers,
                      ExecutionStatusViewModel executionStatusViewModel, BreakpointsViewModel breakpointsViewModel)
 {
     this.logger                               = logger;
     this.acmePdbParser                        = acmePdbParser;
     this.Globals                              = globals;
     this.dispatcher                           = dispatcher;
     this.settingsManager                      = settingsManager;
     this.scope                                = scope;
     this.viceBridge                           = viceBridge;
     this.projectPdbFileWatcher                = projectPdbFileWatcher;
     this.executionStatusViewModel             = executionStatusViewModel;
     RegistersViewModel                        = registers;
     BreakpointsViewModel                      = breakpointsViewModel;
     executionStatusViewModel.PropertyChanged += ExecutionStatusViewModel_PropertyChanged;
     uiFactory                          = new TaskFactory(TaskScheduler.FromCurrentSynchronizationContext());
     commandsManager                    = new CommandsManager(this, uiFactory);
     closeOverlaySubscription           = dispatcher.Subscribe <CloseOverlayMessage>(CloseOverlay);
     prgFileChangedSubscription         = dispatcher.Subscribe <PrgFileChangedMessage>(PrgFileChanged);
     prgFilePathChangedSubscription     = dispatcher.Subscribe <PrgFilePathChangedMessage>(PrgFilePathChanged);
     showModalDialogMessageSubscription = dispatcher.Subscribe <ShowModalDialogMessageCore>(OnShowModalDialog);
     ErrorMessagesViewModel             = errorMessagesViewModel;
     ShowSettingsCommand                = commandsManager.CreateRelayCommand(ShowSettings, () => !IsShowingSettings);
     ShowProjectCommand                 = commandsManager.CreateRelayCommand(ShowProject, () => !IsShowingProject && IsProjectOpen);
     TestCommand                        = commandsManager.CreateRelayCommand(Test, () => !IsBusy);
     CreateProjectCommand               = commandsManager.CreateRelayCommand(CreateProject, () => !IsBusy && !IsDebugging);
     OpenProjectFromPathCommand         = commandsManager.CreateRelayCommand <string>(OpenProjectFromPath, _ => !IsBusy && !IsDebugging);
     OpenProjectCommand                 = commandsManager.CreateRelayCommand(OpenProject, () => !IsBusy && !IsDebugging);
     globals.PropertyChanged           += Globals_PropertyChanged;
     CloseProjectCommand                = commandsManager.CreateRelayCommand(CloseProject, () => IsProjectOpen && !IsDebugging);
     ExitCommand                        = new RelayCommand(() => CloseApp?.Invoke());
     ToggleErrorsVisibilityCommand      = new RelayCommand(() => IsShowingErrors = !IsShowingErrors);
     RunCommand                         = commandsManager.CreateRelayCommandAsync(StartDebuggingAsync, () => IsProjectOpen && (!IsDebugging || IsDebuggingPaused));
     StopCommand                        = commandsManager.CreateRelayCommand(StopDebugging, () => IsDebugging);
     PauseCommand                       = commandsManager.CreateRelayCommand(PauseDebugging, () => IsDebugging && !IsDebuggingPaused && IsViceConnected);
     StepIntoCommand                    = commandsManager.CreateRelayCommandAsync(StepIntoAsync, () => IsDebugging && IsDebuggingPaused);
     StepOverCommand                    = commandsManager.CreateRelayCommandAsync(StepOverAsync, () => IsDebugging && IsDebuggingPaused);
     UpdatePdbCommand                   = commandsManager.CreateRelayCommandAsync(UpdatePdbAsync, () => !IsBusy && IsDebugging);
     SwitchContent <DebuggerViewModel>();
     // by default opens most recent project
     if (globals.Settings.RecentProjects.Count > 0)
     {
         OpenProjectFromPath(globals.Settings.RecentProjects[0]);
     }
     stoppedExecution             = new TaskCompletionSource();
     resumedExecution             = new TaskCompletionSource();
     viceBridge.ConnectedChanged += ViceBridge_ConnectedChanged;
     viceBridge.ViceResponse     += ViceBridge_ViceResponse;
     viceBridge.Start();
     requiresBreakpointsRefresh = true;
     if (!Directory.Exists(globals.Settings.VicePath))
     {
         SwitchOverlayContent <SettingsViewModel>();
     }
 }
Exemple #3
0
        public static TestMethodViewModel CreateTestMethodViewModel(CloseApp closeApp, AddResultControl addResultContol, ClearResultControl clearTestResult)
        {
            TestMethodViewModel viewModel = new TestMethodViewModel(addResultContol, clearTestResult);

            viewModel.CloseApp            = closeApp;
            viewModel.ConsoleMode         = App.ConsoleMode;
            viewModel.CurrentTestCategory = App.CurrentTestCategory;

            return(viewModel);
        }
Exemple #4
0
 public void ThreadSafeClose()
 {
     //If the calling thread is different than the GUI thread, then use the
     //delegate to close the application, otherwise call close() directly
     if (this.InvokeRequired)
     {
         CloseApp d = new CloseApp(ThreadSafeClose);
         this.Invoke(d);
     }
 }
		public MainWindow()
		{
			InitializeComponent();
			_incrementProgress = delegate
			{
				Progress.Value++;
				Title = Convert.ToString(Progress.Value) + " from " + Convert.ToString(Progress.Maximum);
			};
			_setMaximum = delegate { Progress.Maximum = _max; };
			_closeApp = Close;
		}
 public MainWindow()
 {
     InitializeComponent();
     _incrementProgress = delegate
     {
         Progress.Value++;
         Title = Convert.ToString(Progress.Value) + " from " + Convert.ToString(Progress.Maximum);
     };
     _setMaximum = delegate { Progress.Maximum = _max; };
     _closeApp   = Close;
 }
Exemple #7
0
        public void DisplayErrorPopup(String source, String message)
        {
            DialogResult errormsgbox = new DialogResult();

            MessageBox.Show("ERROR: " + message, source, MessageBoxButtons.OK, MessageBoxIcon.Error);

            if (errormsgbox == DialogResult.Cancel)
            {
                // GUI thread - if this is the case we must use a delegate to close the application.
                //Dim d As New CloseApp(AddressOf ThreadSafeClose)
                CloseApp d = new CloseApp(ThreadSafeClose);
                this.Invoke(d);
            }
        }
Exemple #8
0
        public PopupMenuItems()
        {
            Close          = new NSMenuItem("Close", (s, e) => CloseApp?.Invoke());
            Options        = new NSMenuItem("Options", (s, e) => ShowOptions?.Invoke());
            OpenLogs       = new NSMenuItem("Open Logs");
            RaiseIssue     = new NSMenuItem("Raise issue");
            Clear          = new NSMenuItem("Clear");
            PendingDeletes = new NSMenuItem("Pending Deletes");
            PendingMoves   = new NSMenuItem("Pending Moves");
            AcceptAll      = new NSMenuItem("Accept All");

            AssignImages();
            AssignItems();
        }
        public void DisplayError(Exception ex)
        {
            DialogResult errormsgbox = new DialogResult();

            MessageBox.Show("Error Message: " + ex.Message + "\n" + "Error Source: "
                            + ex.Source, "CMO Error", MessageBoxButtons.RetryCancel);
            if (errormsgbox == DialogResult.Cancel)
            {
                // GUI thread - if this is the case we must use a delegate to close the application.
                //Dim d As New CloseApp(AddressOf ThreadSafeClose)
                CloseApp d = new CloseApp(ThreadSafeClose);
                this.Invoke(d);
            }
        }
Exemple #10
0
 private void Main_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Escape)
     {
         CloseApp.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
     }
     else if (e.KeyboardDevice.Modifiers == ModifierKeys.Control &&
              e.Key == Key.N)
     {
         CreateFile.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
     }
     else if (e.KeyboardDevice.Modifiers == ModifierKeys.Control &&
              e.Key == Key.E)
     {
         EditFile.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
     }
     else if (e.KeyboardDevice.Modifiers == ModifierKeys.Control &&
              e.Key == Key.O)
     {
         OpenFile.RaiseEvent(new RoutedEventArgs(Button.ClickEvent));
     }
 }
Exemple #11
0
 private void CloseBtn_Click(object sender, RoutedEventArgs e) => CloseApp?.Invoke(this, null);
Exemple #12
0
 private void CloseClicked(object sender, System.Windows.RoutedEventArgs e) => CloseApp?.Invoke(this, null);
Exemple #13
0
 //NEED TO FIND A WAY TO PASS THIS TO CONTROLLER
 /// <summary>
 /// Overrides OnFormClosing to include saving alarm information to persistent text file
 /// </summary>
 /// <param name="e"></param>
 protected override void OnFormClosing(System.Windows.Forms.FormClosingEventArgs e)
 {
     //myTimer.Close();
     CloseApp.Invoke();
     base.OnFormClosing(e);
 }
Exemple #14
0
 public static void SignalCloseApp()
 {
     CloseApp?.Invoke();
 }