public XSharpProjectPackage() : base() { XInstance = this; ModelScannerEvents.Start(); }
// XSharpLanguageService _langService = null; #region Overridden Implementation /// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { // Suspend walking until Solution is opened. XSettings.DisplayOutputMessage = this.DisplayOutPutMessage; XSettings.DisplayException = this.DisplayException; XSettings.ShowMessageBox = this.ShowMessageBox; await base.InitializeAsync(cancellationToken, progress); await JoinableTaskFactory.SwitchToMainThreadAsync(); var modelscanner = new ModelScannerEvents(this); base.SolutionListeners.Add(modelscanner); modelscanner.Init(); XSharpProjectPackage.instance = this; this.RegisterProjectFactory(new XSharpProjectFactory(this)); this.settings = new XPackageSettings(this); validateVulcanEditors(); this.RegisterDebuggerEvents(); // Indicate how to open the different source files : SourceCode or Designer ?? this.RegisterEditorFactory(new XSharpEditorFactory(this)); this.RegisterProjectFactory(new XSharpWPFProjectFactory(this)); // editors for the binaries base.RegisterEditorFactory(new VOFormEditorFactory(this)); base.RegisterEditorFactory(new VOMenuEditorFactory(this)); base.RegisterEditorFactory(new VODBServerEditorFactory(this)); base.RegisterEditorFactory(new VOFieldSpecEditorFactory(this)); XSharp.Project.XSharpMenuItems.Initialize(this); // Register a timer to call our language service during // idle periods. IOleComponentManager mgr = await GetServiceAsync(typeof(SOleComponentManager)) as IOleComponentManager; if (m_componentID == 0 && mgr != null) { OLECRINFO[] crinfo = new OLECRINFO[1]; crinfo[0].cbSize = (uint)Marshal.SizeOf(typeof(OLECRINFO)); crinfo[0].grfcrf = (uint)_OLECRF.olecrfNeedIdleTime | (uint)_OLECRF.olecrfNeedPeriodicIdleTime; crinfo[0].grfcadvf = (uint)_OLECADVF.olecadvfModal | (uint)_OLECADVF.olecadvfRedrawOff | (uint)_OLECADVF.olecadvfWarningsOff; crinfo[0].uIdleTimeInterval = 1000; int hr = mgr.FRegisterComponent(this, crinfo, out m_componentID); } // Initialize Custom Menu Items // register property changed event handler var shell = await this.GetServiceAsync(typeof(SVsShell)) as IVsShell; Assumes.Present(shell); shell.AdviseShellPropertyChanges(this, out shellCookie); // // ObjectBrowser : Add the LibraryManager service as a Service provided by that container IServiceContainer container = this as IServiceContainer; ServiceCreatorCallback callback = new ServiceCreatorCallback(CreateLibraryService); // container.AddService(typeof(IXSharpLibraryManager), callback, true); this._documentWatcher = new XSharpDocumentWatcher(this); _txtManager = await GetServiceAsync(typeof(SVsTextManager)) as IVsTextManager4; // determine version of VS object vers; shell.GetProperty((int)__VSSPROPID5.VSSPROPID_ReleaseVersion, out vers); VsVersion = vers.ToString(); _errorList = await GetServiceAsync(typeof(SVsErrorList)) as IErrorList; _taskList = await GetServiceAsync(typeof(SVsTaskList)) as ITaskList; addOurFileExtensionsForDiffAndPeek("Diff\\SupportedContentTypes"); addOurFileExtensionsForDiffAndPeek("Peek\\SupportedContentTypes"); }