public void VsTextViewCreated(IVsTextView textViewAdapter) { //This gets executed as each code file is loaded //1st if (!(GetGlobalService(typeof(DTE)) is DTE dte)) { return; } //bool useIntellisense = UserOptionsGrid.GetUseIntellisense(dte); //if (!useIntellisense) // return; if (!(SharedGlobals.GetGlobal("CrmService", dte) is CrmServiceClient client)) { return; } ITextView textView = AdapterService.GetWpfTextView(textViewAdapter); if (textView == null) { return; } CrmCompletionCommandHandler CreateCommandHandler() => new CrmCompletionCommandHandler(textViewAdapter, textView, this); textView.Properties.GetOrCreateSingletonProperty(CreateCommandHandler); if (CrmMetadata.Metadata == null) { CrmMetadata.GetMetadata(client); } }
public void GetData(CrmServiceClient client, InfoBar infoBar) { if (CrmMetadata.Metadata != null) { infoBar.HideInfoBar(); return; } var bgw = new BackgroundWorker(); bgw.DoWork += (_, __) => CrmMetadata.GetMetadata(client); bgw.RunWorkerCompleted += (_, __) => infoBar.HideInfoBar(); bgw.RunWorkerAsync(); }