コード例 #1
0
        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);
        }
コード例 #2
0
        public bool ApplyChangesToSolution(Workspace ws, Solution renamedSolution)
        {
            _threadingService.VerifyOnUIThread();

            // Always make sure TryApplyChanges is called from an UI thread.
            return(ws.TryApplyChanges(renamedSolution));
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: PropertyPageBase.cs プロジェクト: gurupeter/Common
        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);
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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));
        }
コード例 #8
0
        /// <summary>
        /// Occurs when a design time output moniker is deleted.
        /// </summary>
        internal virtual void OnDesignTimeOutputDeleted(string outputMoniker)
        {
            _threadingService.VerifyOnUIThread();

            DesignTimeOutputDeleted?.Invoke(outputMoniker);
        }