コード例 #1
0
        public override void StartProgressMessage(string message)
        {
            // stock general animation icon
            object icon = (short)Microsoft.VisualStudio.Shell.Interop.Constants.SBAI_General;

            try
            {
                // Make sure the status bar is not frozen
                int frozen;
                _statusBar.IsFrozen(out frozen);

                if (frozen != 0)
                {
                    _statusBar.FreezeOutput(0);
                }

                _statusBar.SetText(message);

                // start icon animation
                _statusBar.Animation(1, ref icon);
            }
            catch (InvalidOperationException)
            {
            }
        }
コード例 #2
0
        private void ShowActionStateInStatusBar(object sender, ActionExecutionStateChangedEventArgs e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            if (_statusBar == null)
            {
                _statusBar = (IVsStatusbar)_serviceProvider.GetService(typeof(SVsStatusbar));
            }

            _statusBar.FreezeOutput(0);
            switch (e.State)
            {
            case ActionExecutionState.Started:
                _statusBar.SetText("Running " + e.ActionName + " action...");
                break;

            case ActionExecutionState.Finished:
                _statusBar.SetText("Finished running " + e.ActionName + " action");
                break;

            case ActionExecutionState.Cancelling:
                _statusBar.SetText("Cancelling " + e.ActionName + " action...");
                break;
            }
            _statusBar.FreezeOutput(1);
        }
コード例 #3
0
        public static void StartProgressMessage(string message)
        {
            ThreadHelper.JoinableTaskFactory.RunAsync(async() =>
            {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                // stock general animation icon
                object icon = (short)Constants.SBAI_General;


                // Make sure the status bar is not frozen
                int frozen;
                _statusBar.IsFrozen(out frozen);

                if (frozen != 0)
                {
                    _statusBar.FreezeOutput(0);
                }

                _statusBar.SetText(message);

                // start icon animation
                _statusBar.Animation(1, ref icon);
            });
        }
コード例 #4
0
        /// <summary>
        /// Update status bar.
        /// </summary>
        /// <param name="message"></param>
        private void UpdateStatusBar(string message)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            IVsStatusbar statusBar = (IVsStatusbar)ServiceProvider.GetService(typeof(SVsStatusbar));

            Assumes.Present(statusBar);

            // Make sure the status bar is not frozen

            statusBar.IsFrozen(out int frozen);

            if (frozen != 0)
            {
                statusBar.FreezeOutput(0);
            }

            // Set the status bar text and make its display static.
            statusBar.SetText(message);

            // Freeze the status bar.
            statusBar.FreezeOutput(1);

            // Clear the status bar text.
            statusBar.FreezeOutput(0);
            statusBar.Clear();
        }
コード例 #5
0
        /// <summary>
        /// Override this method to define the async command body te execute on the
        /// background thread
        /// </summary>
        protected override async Task ExecuteAsync()
        {
            IVsStatusbar statusBar = (IVsStatusbar)await SpectNetPackage.Default.GetServiceAsync(typeof(SVsStatusbar));

            statusBar.IsFrozen(out int frozen);
            if (frozen != 0)
            {
                statusBar.FreezeOutput(0);
            }
            statusBar.SetText("Building ZX Spectrum code");
            statusBar.FreezeOutput(1);
            object icon = (short)Constants.SBAI_Build;

            statusBar.Animation(1, ref icon);
            try
            {
                CompileSuccess = await Task.Run(() => CompileCode());
            }
            catch (Exception ex)
            {
                CompileException = ex;
            }
            finally
            {
                statusBar.FreezeOutput(0);
                statusBar.Animation(0, ref icon);
                statusBar.Clear();
            }
        }
コード例 #6
0
        public static void Text(string aText, int aFreezeStatusBar)
        {
            DispatcherHandler.BeginInvoke(() =>
            {
                // Make sure the status bar is not frozen
                if (VSConstants.S_OK != mStatusBar.IsFrozen(out int frozen))
                {
                    return;
                }

                if (0 != frozen)
                {
                    mStatusBar.FreezeOutput(0);
                }

                // Set the status bar text
                mStatusBar.SetText(aText);

                // Freeze the status bar.
                mStatusBar.FreezeOutput(aFreezeStatusBar);

                // Clear the status bar text.
                if (0 == aFreezeStatusBar)
                {
                    mStatusBar.Clear();
                }
            });
        }
コード例 #7
0
        private void OnKeyInputEnd(object sender, KeyInputEventArgs args)
        {
            System.Console.WriteLine("cyc add listener---");

            return;

            IVimBuffer vb = (IVimBuffer)sender;

            if (vb == null)
            {
                return;
            }

            var status = CommandMarginUtil.GetStatus(vb, vb.Mode, forModeSwitch: false);
            int frozen;

            if (_vsStatusbar != null)
            {
                _vsStatusbar.IsFrozen(out frozen);
                if (frozen != 0)
                {
                    _vsStatusbar.FreezeOutput(0);
                }
                _vsStatusbar.SetText(status);
            }
        }
コード例 #8
0
            public override void Dispose()
            {
                _taskFactory.Run(async() =>
                {
                    await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

                    StatusBar.Animation(0, ref icon);
                    StatusBar.Progress(ref cookie, 0, "", 0, 0);
                    StatusBar.FreezeOutput(0);
                    StatusBar.Clear();
                });
            }
コード例 #9
0
            public override void Dispose()
            {
                _taskFactory.Run(async() =>
                {
                    await _taskFactory.SwitchToMainThreadAsync();

                    _statusBar.Animation(0, ref Icon);
                    _statusBar.Progress(ref _cookie, 0, "", 0, 0);
                    _statusBar.FreezeOutput(0);
                    _statusBar.Clear();
                });
            }
コード例 #10
0
        private void Log(string logText)
        {
            // Make sure the status bar is not frozen
            int frozen;

            _statusBar.IsFrozen(out frozen);
            if (frozen != 0)
            {
                _statusBar.FreezeOutput(0);
            }
            // Set the status bar text and make its display static.
            _statusBar.SetText(logText);
            // Freeze the status bar.
            _statusBar.FreezeOutput(1);
        }
コード例 #11
0
        static public void Run(IServiceProvider serviceProvider, IVsStatusbar statusbar)
        {
            var dte      = (DTE2)serviceProvider.GetService(typeof(DTE));
            var projects = dte.Solution.Projects;

            uint   cookie = 0;
            object icon   = (short)Microsoft.VisualStudio.Shell.Interop.Constants.SBAI_Build;

            // Initialize the progress bar.
            statusbar.Progress(ref cookie, 1, "", 0, 0);
            statusbar.Animation(1, ref icon);

            for (uint i = 1, n = (uint)projects.Count; i <= n; ++i)
            {
                var project = projects.Item(i);
                statusbar.Progress(ref cookie, 1, "", i + 1, n);
                statusbar.SetText(string.Format("Converting {0}", project.Name));

                ProjectConverter.Run(serviceProvider, project);
            }

            // Clear the progress bar.
            statusbar.Animation(0, ref icon);
            statusbar.Progress(ref cookie, 0, "", 0, 0);
            statusbar.FreezeOutput(0);
            statusbar.Clear();
        }
コード例 #12
0
 /// <summary>
 /// Display text on the Visual Studio status bar.
 /// </summary>
 /// <param name="text"></param>
 private void DisplayTextOnStatusBar(string text)
 {
     if (statusBar != null)
     {
         statusBar.IsFrozen(out frozen);
         if (frozen == 0)
         {
             // Set the status bar text and make its display static.
             statusBar.SetText(text);
             statusBar.FreezeOutput(1);
             // Clear the status bar text.
             statusBar.FreezeOutput(0);
             statusBar.Clear();
         }
     }
 }
コード例 #13
0
        public override void StopProgressMsg(string msg)
        {
            try
            {
                int fFrozen = 1;
                if (m_statusBar != null && m_statusBar.IsFrozen(out fFrozen) == Utility.COM_HResults.S_OK)
                {
                    if (fFrozen == 1)
                    {
                        m_statusBar.FreezeOutput(0);
                    }

                    if (String.IsNullOrEmpty(msg))
                    {
                        m_statusBar.Clear();
                    }
                    else
                    {
                        m_statusBar.SetText(msg);
                    }
                }
            }
            catch (InvalidOperationException)
            {
            }
        }
コード例 #14
0
        /// <summary>
        /// Shows the progress indicator in the status bar.
        /// Set <paramref name="currentStep"/> and <paramref name="numberOfSteps"/>
        /// to the same value to stop the progress.
        /// </summary>
        /// <param name="text">The text to display in the status bar.</param>
        /// <param name="currentStep">The current step number starting at 1.</param>
        /// <param name="numberOfSteps">The total number of steps to completion.</param>
        public async Task ShowProgressAsync(string text, int currentStep, int numberOfSteps)
        {
            if (currentStep == 0)
            {
                throw new ArgumentOutOfRangeException(nameof(currentStep), "currentStep must have a value of 1 or higher.");
            }

            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            IVsStatusbar statusBar = await VS.Services.GetStatusBarAsync();

            statusBar.FreezeOutput(0);
            uint cookie = 0;

            // Start by resetting the status bar.
            if (currentStep == 1)
            {
                statusBar.Progress(ref cookie, 1, "", 0, 0);
            }

            // Then report progress.
            if (currentStep < numberOfSteps)
            {
                statusBar.Progress(ref cookie, 1, text, (uint)currentStep, (uint)numberOfSteps);
            }

            // And clear the status bar when done.
            else
            {
                statusBar.Progress(ref cookie, 1, "", 0, 0);
            }
        }
コード例 #15
0
        public static async Task SetTextAsync(string text)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            try
            {
                IVsStatusbar statusBar = await GetServiceAsync();

                statusBar.FreezeOutput(0);
                statusBar.SetText(text);
                statusBar.FreezeOutput(1);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
コード例 #16
0
        private void statusBarRefreshTimer_Tick(object sender, object e)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            int frozen;

            statusBar.IsFrozen(out frozen);

            if (frozen != 0)
            {
                statusBar.FreezeOutput(0);
            }

            statusBar.SetText(text);

            statusBar.FreezeOutput(1);
        }
コード例 #17
0
        public static async Task EndAnimationAsync(StatusAnimation animation)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            try
            {
                IVsStatusbar statusBar = await GetServiceAsync();

                statusBar.FreezeOutput(0);
                statusBar.Animation(0, animation);
                statusBar.FreezeOutput(1);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
コード例 #18
0
        /// <summary>Ends the animation on the status bar.</summary>
        public async Task EndAnimationAsync(StatusAnimation animation)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            try
            {
                IVsStatusbar statusBar = await GetServiceAsync();

                statusBar.FreezeOutput(0);
                statusBar.Animation(0, animation);
                statusBar.FreezeOutput(1);
            }
            catch (Exception ex)
            {
                await ex.LogAsync();
            }
        }
コード例 #19
0
        /// <summary>Clears all text from the status bar.</summary>
        public async Task ClearAsync()
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            try
            {
                IVsStatusbar statusBar = await VS.Services.GetStatusBarAsync();

                statusBar.FreezeOutput(0);
                statusBar.Clear();
                statusBar.FreezeOutput(1);
            }
            catch (Exception ex)
            {
                await ex.LogAsync();
            }
        }
コード例 #20
0
ファイル: StatusBarService.cs プロジェクト: Tonur/PowerClean
 public void Dispose(string?endMessage = null)
 {
     Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
     // Clear the status bar text.
     _statusBar.FreezeOutput(0);
     _statusBar.SetText(endMessage ?? "ready");
     _statusBar.Clear();
 }
コード例 #21
0
        private void SetVsStatusbarText(string text)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            IVsStatusbar statusBar = (IVsStatusbar)ServiceProvider.GetService(typeof(SVsStatusbar));

            Assumes.Present(statusBar);
            int frozen;

            statusBar.IsFrozen(out frozen);
            if (frozen != 0)
            {
                statusBar.FreezeOutput(0);
            }

            statusBar.SetText(text);
            statusBar.FreezeOutput(1);
        }
コード例 #22
0
        /// <summary>Sets the text in the status bar.</summary>
        public async Task ShowMessageAsync(string text)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            try
            {
                IVsStatusbar statusBar = await VS.Services.GetStatusBarAsync();

                statusBar.FreezeOutput(0);
                statusBar.SetText(text);
                statusBar.FreezeOutput(1);
            }
            catch (Exception ex)
            {
                await ex.LogAsync();
            }
        }
コード例 #23
0
        private void ClearVsStatusbarText()
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            IVsStatusbar statusBar = (IVsStatusbar)ServiceProvider.GetService(typeof(SVsStatusbar));

            Assumes.Present(statusBar);
            statusBar.FreezeOutput(0);
            statusBar.Clear();
        }
コード例 #24
0
        public void SetStatusMessage(String message)
        {
            // Make sure the status bar is not frozen
            int frozen;

            StatusBar.IsFrozen(out frozen);

            if (frozen != 0)
            {
                StatusBar.FreezeOutput(0);
            }

            // Set the status bar text and make its display static.
            StatusBar.SetText(message);

            //SetAnimationObject();
            //StatusBar.Animation(1, ref _animationObject);
        }
コード例 #25
0
ファイル: Tool.cs プロジェクト: uk-mashfield/BuildVision
        private void OutputInStatusBar(string str, bool freeze)
        {
            if (!_viewModel.ControlSettings.GeneralSettings.EnableStatusBarOutput)
            {
                return;
            }

            if (_dteStatusBar == null)
            {
                return;
            }

            _dteStatusBar.FreezeOutput(0);
            _dteStatusBar.SetText(str);
            if (freeze)
            {
                _dteStatusBar.FreezeOutput(1);
            }
        }
コード例 #26
0
        /// <summary>Ends the animation on the status bar.</summary>
        public async Task EndAnimationAsync(StatusAnimation animation)
        {
            await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

            try
            {
                IVsStatusbar statusBar = await VS.Services.GetStatusBarAsync();

                object icon = (short)animation;

                statusBar.FreezeOutput(0);
                statusBar.Animation(0, ref icon);
                statusBar.FreezeOutput(1);
            }
            catch (Exception ex)
            {
                await ex.LogAsync();
            }
        }
コード例 #27
0
 private static bool TrySetTypingsLoadingStatusBar(IVsStatusbar statusBar, object icon) {
     if (statusBar != null && !IsStatusBarFrozen(statusBar)) {
         statusBar.SetText(SR.GetString(SR.StatusTypingsLoading));
         statusBar.Animation(1, ref icon);
         if (ErrorHandler.Succeeded(statusBar.FreezeOutput(1))) {
             return true;
         }
         Debug.Fail("Failed to freeze typings status bar");
     }
     return false;
 }
コード例 #28
0
        private static void TrySetTypingsLoadedStatusBar(IVsStatusbar statusBar, object icon, bool statusSetSuccess) {
            if (statusBar != null && (statusSetSuccess || !IsStatusBarFrozen(statusBar))) {
                if (!ErrorHandler.Succeeded(statusBar.FreezeOutput(0))) {
                    Debug.Fail("Failed to unfreeze typings status bar");
                    return;
                }

                statusBar.Animation(0, ref icon);
                statusBar.SetText(SR.GetString(SR.StatusTypingsLoaded));
            }
        }
コード例 #29
0
        void WriteStatusBarText(string text)
        {
            IVsStatusbar statusBar = (IVsStatusbar)_serviceProvider.GetService(typeof(SVsStatusbar));

            if (statusBar == null)
            {
                return;
            }

            int frozen;

            statusBar.IsFrozen(out frozen);
            if (frozen != 0)
            {
                statusBar.FreezeOutput(0);
            }

            statusBar.SetText(text);
            statusBar.FreezeOutput(1);
        }
コード例 #30
0
        public void WriteStatus(string message)
        {
            // Make sure the status bar is not frozen
            int frozen;

            _statusBar.IsFrozen(out frozen);
            if (frozen != 0)
            {
                _statusBar.FreezeOutput(0);
            }

            // Set the status bar text and make its display static.
            _statusBar.SetText(message);

            // Freeze the status bar.
            _statusBar.FreezeOutput(1);

            // Clear the status bar text.
            _statusBar.FreezeOutput(0);
            _statusBar.Clear();
        }
コード例 #31
0
        private static void TrySetTypingsLoadedStatusBar(IVsStatusbar statusBar, object icon, bool statusSetSuccess) {
            if (statusBar != null && (statusSetSuccess || !IsStatusBarFrozen(statusBar))) {
                if (!ErrorHandler.Succeeded(statusBar.FreezeOutput(0))) {
                    Debug.Fail("Failed to unfreeze typings status bar");
                    return;
                }

                statusBar.Animation(0, ref icon);
                statusBar.SetText(Resources.StatusTypingsLoaded);
            }
        }
コード例 #32
0
 private static bool TrySetTypingsLoadingStatusBar(IVsStatusbar statusBar, object icon) {
     if (statusBar != null && !IsStatusBarFrozen(statusBar)) {
         statusBar.SetText(Resources.StatusTypingsLoading);
         statusBar.Animation(1, ref icon);
         if (ErrorHandler.Succeeded(statusBar.FreezeOutput(1))) {
             return true;
         }
         Debug.Fail("Failed to freeze typings status bar");
     }
     return false;
 }