public bool Confirm(string message) { _threadingService.VerifyOnUIThread(); var result = VsShellUtilities.ShowMessageBox(_serviceProvider, message, null, OLEMSGICON.OLEMSGICON_QUERY, OLEMSGBUTTON.OLEMSGBUTTON_YESNO, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); if (result == (int)VSConstants.MessageBoxResult.IDNO) { return(false); } return(true); }
public bool ApplyChangesToSolution(Workspace ws, Solution renamedSolution) { _threadingService.VerifyOnUIThread(); // Always make sure TryApplyChanges is called from an UI thread. return(ws.TryApplyChanges(renamedSolution)); }
public bool ShowRemoteDiscoveryDialog(ref string remoteDebugMachine, ref IRemoteAuthenticationProvider?remoteAuthenticationProvider) { _threadingService.VerifyOnUIThread(); Guid currentPortSupplier = remoteAuthenticationProvider?.AuthenticationModeGuid ?? Guid.Empty; uint extraFlags = (uint)DEBUG_REMOTE_DISCOVERY_FLAGS.DRD_NONE; foreach (IRemoteAuthenticationProvider provider in AuthenticationProviders.ExtensionValues()) { extraFlags |= provider.AdditionalRemoteDiscoveryDialogFlags; } IVsDebugRemoteDiscoveryUI?remoteDiscoveryUIService = _remoteDiscoveryUIService.Value; Assumes.Present(remoteDiscoveryUIService); if (ErrorHandler.Succeeded(remoteDiscoveryUIService.SelectRemoteInstanceViaDlg(remoteDebugMachine, currentPortSupplier, extraFlags, out string remoteMachine, out Guid portSupplier))) { remoteDebugMachine = remoteMachine; remoteAuthenticationProvider = AuthenticationProviders.FirstOrDefaultValue(p => p.AuthenticationModeGuid.Equals(portSupplier)); return(true); } return(false); }
public int TranslateAccelerator(MSG[] pMsg) { if (pMsg == null) { return(VSConstants.E_POINTER); } #if DEBUG if (pMsg.Length == 0) { throw new ArgumentOutOfRangeException(nameof(pMsg)); } #endif if (_propertyPageUI.TranslateAccelerator(ref pMsg[0])) { return(VSConstants.S_OK); } _projectThreadingService.VerifyOnUIThread(); return(_propertyPageSite?.TranslateAccelerator(pMsg) ?? VSConstants.S_FALSE); }
private MessageBoxResult ShowMessageBox(string message, OLEMSGICON icon, OLEMSGBUTTON button, MessageBoxResult defaultResult = MessageBoxResult.IDOK) { _threadingService.VerifyOnUIThread(); if (VsShellUtilities.IsInAutomationFunction(_serviceProvider)) { return(defaultResult); } return((MessageBoxResult)VsShellUtilities.ShowMessageBox(_serviceProvider, message, null, icon, button, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST)); }
public T GetPropertiesValue <T>(string category, string page, string property, T defaultValue) { _threadingService.VerifyOnUIThread(); DTE dte = _serviceProvider.GetService <DTE, DTE>(); var props = dte.Properties[category, page]; if (props != null) { return((T)props.Item(property).Value); } return(defaultValue); }
private HResult Invoke(Func <IVsUIHierarchyWindow2, HResult> action) { _threadingService.VerifyOnUIThread(); IVsUIHierarchyWindow2?window = _solutionExplorer.Value; if (window == null) { throw new InvalidOperationException("Solution Explorer is not available in command-line mode."); } return(action(window)); }
/// <summary> /// Occurs when a design time output moniker is deleted. /// </summary> internal virtual void OnDesignTimeOutputDeleted(string outputMoniker) { _threadingService.VerifyOnUIThread(); DesignTimeOutputDeleted?.Invoke(outputMoniker); }