Under a certain condition I need to prevent the user from closing both the project they have opened and the Pro application (essentially disabling the X button in the upper right corner). I have subscribed to ProjectClosingEvent and set args.Cancel to true. The project still closes while Pro does not. What should be done to keep the project open? Thanks.
public Module1()
{
ProjectClosingEvent.Subscribe(OnProjectClosing);
}
private Task OnProjectClosing(ProjectClosingEventArgs args)
{
if (CanClosePro == false)
{
args.Cancel = true;
return Task.FromResult(0);
}
else
{
return Task.CompletedTask;
}
}