예제 #1
0
        /// <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));
        }
예제 #2
0
 private void OnSolutionOpened()
 {
     if (!string.IsNullOrEmpty(Solution.FileName))
     {
         SolutionOpened?.Invoke(this, EventArgs.Empty);
     }
 }
예제 #3
0
        public int OnAfterOpenSolution(object pUnkReserved, int fNewSolution)
        {
            SolutionOpened?.Invoke(this, new SolutionOpenedEventArgs());

            AdviseRunningDocumentTableEvents();
            AdviseTrackProjectDocumentsEvents();

            return(VSConstants.S_OK);
        }
예제 #4
0
        /// <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));
        }
예제 #5
0
        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;
        }
예제 #6
0
 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();
     };
 }
예제 #7
0
        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;
        }
예제 #8
0
        /// <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}");
            }
        }
예제 #9
0
        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;
        }
예제 #10
0
        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);
 }
예제 #12
0
 /// <summary>
 /// Collects project information every time a solution has been opened.
 /// </summary>
 private void OnSolutionOpened()
 {
     CreateMachines();
     SolutionOpened?.Invoke(this, EventArgs.Empty);
 }
예제 #13
0
 protected virtual void OnSolutionOpened()
 {
     SolutionOpened?.Invoke(this, EventArgs.Empty);
 }