/// <summary> /// Initializes the members used by a solution /// </summary> private void OnSolutionOpened() { CheckCpsFiles(); // --- Let's create the ZX Spectrum virtual machine view model // --- that is used all around in tool windows CodeDiscoverySolution = new SolutionStructure(); CodeDiscoverySolution.CollectProjects(); // --- Every time a new solution has been opened, initialize the // --- Spectrum virtual machine with all of its accessories var vm = MachineViewModel = CreateProjectMachine(); // --- Set up the debug info provider DebugInfoProvider.Prepare(); vm.DebugInfoProvider = DebugInfoProvider; // --- Prepare the virtual machine vm.PrepareStartupConfig(); vm.MachineController.EnsureMachine(); SolutionOpened?.Invoke(this, EventArgs.Empty); // --- Let initialize these tool windows even before showing up them GetToolWindow(typeof(SpectrumEmulatorToolWindow)); GetToolWindow(typeof(AssemblerOutputToolWindow)); GetToolWindow(typeof(MemoryToolWindow)); GetToolWindow(typeof(DisassemblyToolWindow)); }
/// <summary> /// Initializes the members used by a solution /// </summary> private void OnSolutionOpened() { CheckCpsFiles(); // --- Let's create the ZX Spectrum virtual machine view model // --- that is used all around in tool windows CodeDiscoverySolution = new SolutionStructure(); CodeDiscoverySolution.CollectProjects(); // --- Every time a new solution has been opened, initialize the // --- Spectrum virtual machine with all of its accessories var spectrumConfig = CodeDiscoverySolution.CurrentProject.SpectrumConfiguration; var vm = MachineViewModel = new MachineViewModel(); vm.MachineController = new MachineController(); vm.ScreenConfiguration = spectrumConfig.Screen; // --- Create devices according to the project's Spectrum model var modelName = CodeDiscoverySolution.CurrentProject.ModelName; switch (modelName) { case SpectrumModels.ZX_SPECTRUM_128: vm.DeviceData = CreateSpectrum128Devices(spectrumConfig); break; case SpectrumModels.ZX_SPECTRUM_P3_E: vm.DeviceData = CreateSpectrumP3Devices(spectrumConfig); break; case SpectrumModels.ZX_SPECTRUM_NEXT: vm.DeviceData = CreateSpectrum48Devices(spectrumConfig); break; default: vm.DeviceData = CreateSpectrum48Devices(spectrumConfig); break; } vm.AllowKeyboardScan = true; vm.StackDebugSupport = new SimpleStackDebugSupport(); vm.DisplayMode = SpectrumDisplayMode.Fit; // --- Set up the debug info provider DebugInfoProvider.Prepare(); vm.DebugInfoProvider = DebugInfoProvider; // --- Prepare the virtual machine vm.PrepareStartupConfig(); vm.MachineController.EnsureMachine(); SolutionOpened?.Invoke(this, EventArgs.Empty); // --- Let initializethese tool windows even before showing up them GetToolWindow(typeof(AssemblerOutputToolWindow)); GetToolWindow(typeof(MemoryToolWindow)); GetToolWindow(typeof(DisassemblyToolWindow)); }
/// <summary> /// Initializes the members used by a solution /// </summary> private async void OnSolutionOpened() { try { CheckCpsFiles(); await Task.Delay(2000); // --- Let's create the ZX Spectrum virtual machine view model // --- that is used all around in tool windows CodeDiscoverySolution = new SolutionStructure(); CodeDiscoverySolution.CollectProjects(); // --- Every time a new solution has been opened, initialize the // --- Spectrum virtual machine with all of its accessories var vm = MachineViewModel = CreateProjectMachine(); // --- Create an expression evaluation context and bind the machine with it DebugEvaluationContext = new SymbolAwareSpectrumEvaluationContext(vm.SpectrumVm); // --- Set up the debug info provider DebugInfoProvider.Prepare(); vm.DebugInfoProvider = DebugInfoProvider; SolutionOpened?.Invoke(this, EventArgs.Empty); // --- Let initialize these tool windows even before showing up them GetToolWindow(typeof(SpectrumEmulatorToolWindow)); GetToolWindow(typeof(AssemblerOutputToolWindow)); GetToolWindow(typeof(MemoryToolWindow)); GetToolWindow(typeof(DisassemblyToolWindow)); GetToolWindow(typeof(WatchToolWindow)); } catch (Exception e) { if (!(GetService(typeof(SVsActivityLog)) is IVsActivityLog log)) { return; } log.LogEntry((uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, "OnSolutionOpen", $"Exception raised: {e}"); } }