public void Execute() { Debug.Assert(this.CanExecute(), "UnbindCommand.Execute should not be called if CanExecute is false"); Debug.Assert(ThreadHelper.CheckAccess(), "Expected step to be run on the UI thread"); host.Logger.WriteLine(Strings.Unbind_State_Started); try { host.VisualStateManager.IsBusy = true; host.Logger.WriteLine(Strings.Unbind_DeletingBinding); configProvider.DeleteConfiguration(); host.Logger.WriteLine(Strings.Unbind_DisconnectingFromSonarQube); host.ActiveSection.DisconnectCommand.Execute(null); Debug.Assert(!host.VisualStateManager.HasBoundProject, "Bound project should be null after unbinding"); Debug.Assert(!host.VisualStateManager.IsConnected, "Should be disconnected from the SQ server after unbinding"); host.Logger.WriteLine(Strings.Unbind_State_Succeeded); } catch (Exception ex) when(!ErrorHandler.IsCriticalException(ex)) { host.Logger.WriteLine(ex.Message); host.Logger.WriteLine(Strings.Unbind_State_Failed); } finally { host.VisualStateManager.IsBusy = false; } }
public void DeleteConfiguration() { var mode = this.GetConfiguration().Mode; Debug.Assert(mode == SonarLintMode.Connected, "Can only delete a configuration when in new connected mode"); if (mode != SonarLintMode.LegacyConnected) { wrappedProvider.DeleteConfiguration(); } }