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>();
     }
 }
 public SourceFileViewerViewModel(IDispatcher dispatcher, ILogger <SourceFileViewerViewModel> logger, Globals globals, IServiceProvider serviceProvider,
                                  ExecutionStatusViewModel executionStatusViewModel)
 {
     this.logger  = logger;
     this.globals = globals;
     this.executionStatusViewModel = executionStatusViewModel;
     this.serviceProvider          = serviceProvider;
     openSourceFileSubscription    = dispatcher.Subscribe <OpenSourceFileMessage>(OpenSourceFile);
     CloseSourceFileCommand        = new(CloseSourceFile);
     Files = new();
     globals.PropertyChanged += Globals_PropertyChanged;
     executionStatusViewModel.PropertyChanged += ExecutionStatusViewModel_PropertyChanged;
 }
Exemplo n.º 3
0
 public DebuggerViewModel(ILogger <DebuggerViewModel> logger, Globals globals, ProjectExplorerViewModel projectExplorerViewModel,
                          SourceFileViewerViewModel sourceFileViewerViewModel, RegistersViewModel registers, IDispatcher dispatcher, IAcmePdbManager acmePdbManager,
                          ExecutionStatusViewModel executionStatusViewModel)
 {
     this.logger                               = logger;
     this.globals                              = globals;
     this.dispatcher                           = dispatcher;
     this.acmePdbManager                       = acmePdbManager;
     this.executionStatusViewModel             = executionStatusViewModel;
     executionStatusViewModel.PropertyChanged += ExecutionStatusViewModel_PropertyChanged;
     ProjectExplorer                           = projectExplorerViewModel;
     SourceFileViewerViewModel                 = sourceFileViewerViewModel;
     Registers = registers;
     Registers.PropertyChanged += Registers_PropertyChanged;
     globals.PropertyChanged   += Globals_PropertyChanged;
 }
Exemplo n.º 4
0
 public BreakpointsViewModel(ILogger <RegistersViewModel> logger, IViceBridge viceBridge, IDispatcher dispatcher, Globals globals,
                             IAcmePdbManager acmePdbManager, ExecutionStatusViewModel executionStatusViewModel, IServiceScopeFactory serviceScopeFactory)
 {
     this.logger                               = logger;
     this.viceBridge                           = viceBridge;
     this.dispatcher                           = dispatcher;
     this.globals                              = globals;
     this.acmePdbManager                       = acmePdbManager;
     this.serviceScopeFactory                  = serviceScopeFactory;
     this.executionStatusViewModel             = executionStatusViewModel;
     Breakpoints                               = new ObservableCollection <BreakpointViewModel>();
     breakpointsLinesMap                       = new Dictionary <AcmeLine, BreakpointViewModel>();
     breakpointsMap                            = new Dictionary <uint, BreakpointViewModel>();
     ToggleBreakpointEnabledCommand            = new RelayCommandAsync <BreakpointViewModel>(ToggleBreakpointEnabledAsync);
     ShowBreakpointPropertiesCommand           = new RelayCommandAsync <BreakpointViewModel>(ShowBreakpointPropertiesAsync, b => b is not null);
     RemoveBreakpointCommand                   = new RelayCommandAsync <BreakpointViewModel>(RemoveBreakpointAsync, b => b is not null);
     CreateBreakpointCommand                   = new RelayCommandAsync(CreateBreakpoint);
     viceBridge.ViceResponse                  += ViceBridge_ViceResponse;
     globals.PropertyChanged                  += Globals_PropertyChanged;
     executionStatusViewModel.PropertyChanged += ExecutionStatusViewModel_PropertyChanged;
 }