/// <summary>
 /// Change the text in the status bar. If the status bar is frozen no change is made.
 /// </summary>
 /// <param name="text">The text to display.</param>
 public void SetText(string text)
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     try
     {
         SetTextImpl(text);
     }
     catch (Exception ex)
     {
         IVsActivityLog vsActivityLog =
             GoogleCloudExtensionPackage.Instance.GetService <SVsActivityLog, IVsActivityLog>();
         vsActivityLog.LogError($"Failed to write to the status bar: {ex.Message}");
     }
 }
 private void UnFreeze()
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     try
     {
         Statusbar.FreezeOutput(0);
     }
     catch (Exception ex)
     {
         IVsActivityLog vsActivityLog =
             GoogleCloudExtensionPackage.Instance.GetService <SVsActivityLog, IVsActivityLog>();
         vsActivityLog.LogError($"Failed to unfreeze the status bar output: {ex.Message}");
     }
 }
 private void HideDeployAnimation()
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     try
     {
         object animation = (short)Constants.SBAI_Deploy;
         Statusbar.Animation(0, ref animation);
     }
     catch (Exception ex)
     {
         IVsActivityLog vsActivityLog =
             GoogleCloudExtensionPackage.Instance.GetService <SVsActivityLog, IVsActivityLog>();
         vsActivityLog.LogError($"Failed to hide animation: {ex.Message}");
     }
 }
 /// <summary>
 /// Freezes the status bar, which prevents updates from other parts of the VS shell.
 /// </summary>
 /// <returns>An implementation of <seealso cref="IDisposable"/> that will unfreeze the status bar on dispose.</returns>
 public IDisposable Freeze()
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     try
     {
         Statusbar.FreezeOutput(1);
         return(new Disposable(UnFreeze));
     }
     catch (Exception ex)
     {
         IVsActivityLog vsActivityLog =
             GoogleCloudExtensionPackage.Instance.GetService <SVsActivityLog, IVsActivityLog>();
         vsActivityLog.LogError($"Failed to freeze the status bar output: {ex.Message}");
         return(null);
     }
 }
 /// <summary>
 /// Shows an animation to show that a deploy action is being executed. This animation will only show
 /// if VS is showing all of the visual effects. The result of the method should stored in a variable in a
 /// using statement.
 /// </summary>
 /// <returns>An implementation of <seealso cref="IDisposable"/> that will stop the animation on dispose.</returns>
 public IDisposable ShowDeployAnimation()
 {
     ThreadHelper.ThrowIfNotOnUIThread();
     try
     {
         object animation = (short)Constants.SBAI_Deploy;
         Statusbar.Animation(1, ref animation);
         return(new Disposable(HideDeployAnimation));
     }
     catch (Exception ex)
     {
         IVsActivityLog vsActivityLog =
             GoogleCloudExtensionPackage.Instance.GetService <SVsActivityLog, IVsActivityLog>();
         vsActivityLog.LogError($"Failed to show animation: {ex.Message}");
         return(null);
     }
 }
        /// <summary>
        /// Change the text in the status bar. If the status bar is frozen no change is made.
        /// </summary>
        /// <param name="text">The text to display.</param>
        public async Task <IDisposable> FreezeTextAsync(string text)
        {
            await GoogleCloudExtensionPackage.Instance.JoinableTaskFactory.SwitchToMainThreadAsync();

            try
            {
                return(FreezeTextImpl(text));
            }
            catch (Exception ex)
            {
                IVsActivityLog vsActivityLog =
                    await GoogleCloudExtensionPackage.Instance.GetServiceAsync <SVsActivityLog, IVsActivityLog>();

                vsActivityLog.LogError($"Failed to write to the status bar: {ex.Message}");
                return(new Disposable());
            }
        }