Skip to content

Commit

Permalink
Remove unused events and method implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeRobich committed Sep 29, 2022
1 parent e4c39b0 commit 048cc80
Showing 1 changed file with 7 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ private async Task<string> WaitForBuildToFinishAsync(IVsOutputWindowPane buildOu
using var solutionEvents = new UpdateSolutionEvents(buildManager);
var buildCompleteTaskCompletionSource = new TaskCompletionSource<bool>();

void HandleUpdateSolutionDone(bool succeeded, bool modified, bool canceled) => buildCompleteTaskCompletionSource.SetResult(succeeded);
void HandleUpdateSolutionDone() => buildCompleteTaskCompletionSource.SetResult(true);
solutionEvents.OnUpdateSolutionDone += HandleUpdateSolutionDone;
try
{
Expand Down Expand Up @@ -712,22 +712,9 @@ internal sealed class UpdateSolutionEvents : IVsUpdateSolutionEvents, IDisposabl
private uint _cookie;
private readonly IVsSolutionBuildManager2 _solutionBuildManager;

internal delegate void UpdateSolutionDoneEvent(bool succeeded, bool modified, bool canceled);

internal delegate void UpdateSolutionBeginEvent(ref bool cancel);

internal delegate void UpdateSolutionStartUpdateEvent(ref bool cancel);

internal delegate void UpdateSolutionDoneEvent();
public event UpdateSolutionDoneEvent? OnUpdateSolutionDone;

public event UpdateSolutionBeginEvent? OnUpdateSolutionBegin;

public event UpdateSolutionStartUpdateEvent? OnUpdateSolutionStartUpdate;

public event Action? OnActiveProjectConfigurationChange;

public event Action? OnUpdateSolutionCancel;

internal UpdateSolutionEvents(IVsSolutionBuildManager2 solutionBuildManager)
{
ThreadHelper.ThrowIfNotOnUIThread();
Expand All @@ -736,55 +723,14 @@ internal UpdateSolutionEvents(IVsSolutionBuildManager2 solutionBuildManager)
ErrorHandler.ThrowOnFailure(solutionBuildManager.AdviseUpdateSolutionEvents(this, out _cookie));
}

int IVsUpdateSolutionEvents.UpdateSolution_Begin(ref int pfCancelUpdate)
{
var cancel = false;
OnUpdateSolutionBegin?.Invoke(ref cancel);
if (cancel)
{
pfCancelUpdate = 1;
}

return 0;
}
int IVsUpdateSolutionEvents.UpdateSolution_Begin(ref int pfCancelUpdate) => 0;
int IVsUpdateSolutionEvents.UpdateSolution_StartUpdate(ref int pfCancelUpdate) => 0;
int IVsUpdateSolutionEvents.UpdateSolution_Cancel() => 0;
int IVsUpdateSolutionEvents.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) => 0;

int IVsUpdateSolutionEvents.UpdateSolution_Done(int fSucceeded, int fModified, int fCancelCommand)
{
OnUpdateSolutionDone?.Invoke(fSucceeded != 0, fModified != 0, fCancelCommand != 0);
return 0;
}

int IVsUpdateSolutionEvents.UpdateSolution_StartUpdate(ref int pfCancelUpdate)
{
return UpdateSolution_StartUpdate(ref pfCancelUpdate);
}

int IVsUpdateSolutionEvents.UpdateSolution_Cancel()
{
OnUpdateSolutionCancel?.Invoke();
return 0;
}

int IVsUpdateSolutionEvents.OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy)
{
return OnActiveProjectCfgChange(pIVsHierarchy);
}

private int UpdateSolution_StartUpdate(ref int pfCancelUpdate)
{
var cancel = false;
OnUpdateSolutionStartUpdate?.Invoke(ref cancel);
if (cancel)
{
pfCancelUpdate = 1;
}

return 0;
}

private int OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy)
{
OnActiveProjectConfigurationChange?.Invoke();
OnUpdateSolutionDone?.Invoke();
return 0;
}

Expand All @@ -793,10 +739,6 @@ void IDisposable.Dispose()
ThreadHelper.ThrowIfNotOnUIThread();

OnUpdateSolutionDone = null;
OnUpdateSolutionBegin = null;
OnUpdateSolutionStartUpdate = null;
OnActiveProjectConfigurationChange = null;
OnUpdateSolutionCancel = null;

if (_cookie != 0)
{
Expand Down

0 comments on commit 048cc80

Please sign in to comment.