public async Task <QuickInfoItem> GetQuickInfoItemAsync(IAsyncQuickInfoSession session, CancellationToken cancellationToken) { if (!_textBuffer.ContentType.DisplayName.Contains("CSharp")) { return(await System.Threading.Tasks.Task.FromResult <QuickInfoItem>(null)); } _quickInfoUtils = new OverloadGenerator(_textBuffer, session); var overloads = _quickInfoUtils.GetAllOverLoadsForMousePosition(); ContainerElementBuilder uIHelper = new ContainerElementBuilder(); GeneralOptions options = await GeneralOptions.GetLiveInstanceAsync(); var showButton = options.ShowButtonToBrowser; if (overloads.Count > 0 || showButton) { if (overloads.Count > 0) { foreach (var item in overloads) { uIHelper.AddContainer(item); } } var symbol = _quickInfoUtils.GetSymbol(); if (showButton && symbol != null) { uIHelper.AddContainer("Search in browser", Buttonelement_Click); } var containers = uIHelper.Build(); return(await System.Threading.Tasks.Task.FromResult(new QuickInfoItem(session.ApplicableToSpan, containers))); } return(await System.Threading.Tasks.Task.FromResult <QuickInfoItem>(null)); }
private void Buttonelement_Click(object sender, RoutedEventArgs e) { GeneralOptions options = GeneralOptions.GetLiveInstanceAsync().Result; string message = options.SearchUrl; var symbol = _quickInfoUtils.GetSymbol(); Process.Start($"{message}{symbol.ToDisplayString()}"); }
public static void PersistVSToolOptions(string fileName) { Task.Run(async() => { var generalOptions = await GeneralOptions.GetLiveInstanceAsync(); generalOptions.ActualPathToExe = fileName; await generalOptions.SaveAsync(); }); }
/// <summary> /// Gets the values. /// </summary> /// <owner>Anton Patron</owner> /// <returns>The text values.</returns> private async Task <Dictionary <string, string> > GetResourceFileValuesAsync() { var optionsInstance = await GeneralOptions.GetLiveInstanceAsync().ConfigureAwait(false); var manager = ResourceManager.CreateFileBasedResourceManager(optionsInstance.OptionResourceFile, optionsInstance.OptionResourceDirectoryPath, null); return(TranslatorProviderTextId.GetTextvalues(manager, new CultureInfo(optionsInstance.LaunguageId), true). GroupBy(textItem => textItem.textId). ToDictionary(textItem => textItem.Key.ToString(), textItem => textItem.First().text)); }
public async Task OnSettingsSaveAsync() { var generalOptions = await GeneralOptions.GetLiveInstanceAsync(); if (_stackDataDumpControl == null) { var window = await package.FindToolWindowAsync(typeof(StackDataDump), 0, true, package.DisposalToken); var stackDataDump = window as StackDataDump; _stackDataDumpControl = stackDataDump?.Content as StackDataDumpControl; } _stackDataDumpControl.MaxDepth.Text = generalOptions.MaxObjectDepth.ToString(); _stackDataDumpControl.AutomaticallyRefresh.IsChecked = generalOptions.AutomaticallyRefresh; }
// This method is executed when you open any file in the editor window public void TextViewCreated(IWpfTextView textView) { // Call the Instance singleton from the UI thread is easy bool showMessage = OtherOptions.Instance.ShowMessage; if (showMessage) { System.Threading.Tasks.Task.Run(async() => { // Make the call to GetLiveInstanceAsync from a background thread to avoid blocking the UI thread GeneralOptions options = await GeneralOptions.GetLiveInstanceAsync(); System.Windows.Forms.MessageBox.Show(options.Message); }); } }
//private GeneralOptionsDto GetGeneralOptionsDto() //{ // Task<GeneralOptionsDto> task = Task.Run<GeneralOptionsDto>(async () => await GetGeneralOptionsDtoAsync()); // return task.Result; //} private async Task <GeneralOptionsDto> GetGeneralOptionsDtoAsync() { // Call from a background thread to avoid blocking the UI thread //var generalOptions = GeneralOptions.Instance; // Call from a background thread to avoid blocking the UI thread var generalOptions = await GeneralOptions.GetLiveInstanceAsync(); return(new GeneralOptionsDto { LineLengthTruncationLimit = generalOptions.LineLengthTruncationLimit, OverallLinesLimit = generalOptions.OverallLinesLimit, ShowFileNamesInPopUp = generalOptions.ShowFileNamesInPopUp, ShowReadMeDotTxt = generalOptions.ShowReadMeDotTxt, ShowSolutionOpenPopUpDotTxt = generalOptions.ShowSolutionOpenPopUpDotTxt, }); }
private async Task <GeneralOptionsDto> GetGeneralOptionsDtoAsync() { // Call from a background thread to avoid blocking the UI thread //var generalOptions = GeneralOptions.Instance; // Call from a background thread to avoid blocking the UI thread var generalOptions = await GeneralOptions.GetLiveInstanceAsync(); var hiddenOptions = await HiddenOptions.GetLiveInstanceAsync(); return(new GeneralOptionsDto { LastPopUpDateTime = hiddenOptions.LastPopUpDateTime, MaximumPopUpsWeekDay = generalOptions.MaximumPopUpsWeekDay.GetAsInteger(), MaximumPopUpsWeekEnd = generalOptions.MaximumPopUpsWeekEnd.GetAsInteger(), PopUpIntervalInMins = generalOptions.PopUpIntervalInMins.GetAsInteger(), PopUpCountToday = hiddenOptions.PopUpCountToday, TimeOutInMilliSeconds = generalOptions.TimeOutInMilliSeconds.GetAsInteger(), }); }