/// <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)); }
private void OnSolutionOpened() { if (!string.IsNullOrEmpty(Solution.FileName)) { SolutionOpened?.Invoke(this, EventArgs.Empty); } }
public int OnAfterOpenSolution(object pUnkReserved, int fNewSolution) { SolutionOpened?.Invoke(this, new SolutionOpenedEventArgs()); AdviseRunningDocumentTableEvents(); AdviseTrackProjectDocumentsEvents(); return(VSConstants.S_OK); }
/// <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)); }
public SolutionModel(DTE dte) { this.dte = dte; solutionEvents = this.dte.Events.SolutionEvents; solutionEvents.Opened += () => SolutionOpened?.Invoke(this.dte.Solution); solutionEvents.AfterClosing += () => SolutionClosed?.Invoke(); StartupSolution = dte.Solution; }
public void Initialize(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; Dte = (DTE2)serviceProvider.GetService(typeof(DTE)); _solution = (Solution2)Dte.Solution; _solutionEvents = Dte.Events.SolutionEvents; _solutionEvents.Opened += () => { SolutionOpened?.Invoke(); }; _solutionEvents.AfterClosing += () => { SolutionClosed?.Invoke(); }; }
private async Task OnSolutionExistsAndFullyLoadedAsync() { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SolutionOpening?.Invoke(this, EventArgs.Empty); // although the SolutionOpened event fires, the solution may be only in memory (e.g. when // doing File - New File). In that case, we don't want to act on the event. if (!IsSolutionOpen) { return; } await EnsureNuGetAndVsProjectAdapterCacheAsync(); SolutionOpened?.Invoke(this, EventArgs.Empty); _solutionOpenedRaised = true; }
/// <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}"); } }
private void OnSolutionExistsAndFullyLoaded() { ThreadHelper.ThrowIfNotOnUIThread(); SolutionOpening?.Invoke(this, EventArgs.Empty); // although the SolutionOpened event fires, the solution may be only in memory (e.g. when // doing File - New File). In that case, we don't want to act on the event. if (!IsSolutionOpen) { return; } NuGetUIThreadHelper.JoinableTaskFactory.Run(() => EnsureNuGetAndVsProjectAdapterCacheAsync()); SolutionOpened?.Invoke(this, EventArgs.Empty); _solutionOpenedRaised = true; }
private void Initialize() { _dte = TaskExplorerWindowCommand.Instance.ServiceProvider.GetService(typeof(DTE)) as DTE2; if (_dte == null) { throw new InvalidOperationException("Solution info cannot be loaded"); } UpdateState(); _solutionEvents = _dte.Events.SolutionEvents; _solutionEvents.Opened += () => { UpdateState(); SolutionOpened?.Invoke(this); }; _solutionEvents.AfterClosing += () => { UpdateState(); SolutionClosed?.Invoke(this); }; }
public int OnAfterOpenSolution(object pUnkReserved, int fNewSolution) { SolutionOpened?.Invoke(); return(VSConstants.S_OK); }
/// <summary> /// Collects project information every time a solution has been opened. /// </summary> private void OnSolutionOpened() { CreateMachines(); SolutionOpened?.Invoke(this, EventArgs.Empty); }
protected virtual void OnSolutionOpened() { SolutionOpened?.Invoke(this, EventArgs.Empty); }