handle build animation on run failure
This commit is contained in:
@@ -42,9 +42,10 @@ public partial class RunService(ILogger<RunService> logger, RoslynAnalysis rosly
|
|||||||
if (buildResult is not SharpIdeBuildResult.Success)
|
if (buildResult is not SharpIdeBuildResult.Success)
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Build failed for project {ProjectName}. Aborting run/debug.", project.Name);
|
_logger.LogInformation("Build failed for project {ProjectName}. Aborting run/debug.", project.Name);
|
||||||
|
project.ProjectRunFailed.InvokeParallelFireAndForget();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
project.RunningCancellationTokenSource = new CancellationTokenSource();
|
project.RunningCancellationTokenSource = new CancellationTokenSource();
|
||||||
|
|
||||||
var launchProfiles = await LaunchSettingsParser.GetLaunchSettingsProfiles(project);
|
var launchProfiles = await LaunchSettingsParser.GetLaunchSettingsProfiles(project);
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ public class SharpIdeProjectModel : ISharpIdeNode, IExpandableSharpIdeNode, IChi
|
|||||||
public bool OpenInRunPanel { get; set; }
|
public bool OpenInRunPanel { get; set; }
|
||||||
public Channel<byte[]>? RunningOutputChannel { get; set; }
|
public Channel<byte[]>? RunningOutputChannel { get; set; }
|
||||||
|
|
||||||
|
public EventWrapper<Task> ProjectRunFailed { get; } = new(() => Task.CompletedTask);
|
||||||
public EventWrapper<Task> ProjectStartedRunning { get; } = new(() => Task.CompletedTask);
|
public EventWrapper<Task> ProjectStartedRunning { get; } = new(() => Task.CompletedTask);
|
||||||
public EventWrapper<Task> ProjectStoppedRunning { get; } = new(() => Task.CompletedTask);
|
public EventWrapper<Task> ProjectStoppedRunning { get; } = new(() => Task.CompletedTask);
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,19 @@ public partial class RunMenuItem : HBoxContainer
|
|||||||
_buildAnimationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
|
_buildAnimationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
|
||||||
Project.ProjectStartedRunning.Subscribe(OnProjectStartedRunning);
|
Project.ProjectStartedRunning.Subscribe(OnProjectStartedRunning);
|
||||||
Project.ProjectStoppedRunning.Subscribe(OnProjectStoppedRunning);
|
Project.ProjectStoppedRunning.Subscribe(OnProjectStoppedRunning);
|
||||||
|
Project.ProjectRunFailed.Subscribe(OnProjectRunFailed);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnProjectRunFailed()
|
||||||
|
{
|
||||||
|
await this.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
_stopButton.Visible = false;
|
||||||
|
_debugButton.Visible = true;
|
||||||
|
_runButton.Visible = true;
|
||||||
|
_animatedTextureParentControl.Visible = false;
|
||||||
|
_buildAnimationPlayer.Stop();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task OnProjectStoppedRunning()
|
private async Task OnProjectStoppedRunning()
|
||||||
@@ -62,10 +75,7 @@ public partial class RunMenuItem : HBoxContainer
|
|||||||
private StringName _buildAnimationName = "BuildingAnimation";
|
private StringName _buildAnimationName = "BuildingAnimation";
|
||||||
private async void OnRunButtonPressed()
|
private async void OnRunButtonPressed()
|
||||||
{
|
{
|
||||||
_runButton.Visible = false;
|
SetAttemptingRunState();
|
||||||
_debugButton.Visible = false;
|
|
||||||
_animatedTextureParentControl.Visible = true;
|
|
||||||
_buildAnimationPlayer.Play(_buildAnimationName);
|
|
||||||
await _runService.RunProject(Project).ConfigureAwait(false);
|
await _runService.RunProject(Project).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,6 +86,15 @@ public partial class RunMenuItem : HBoxContainer
|
|||||||
UseInMemorySharpDbg = Singletons.AppState.IdeSettings.DebuggerUseSharpDbg,
|
UseInMemorySharpDbg = Singletons.AppState.IdeSettings.DebuggerUseSharpDbg,
|
||||||
DebuggerExecutablePath = Singletons.AppState.IdeSettings.DebuggerExecutablePath
|
DebuggerExecutablePath = Singletons.AppState.IdeSettings.DebuggerExecutablePath
|
||||||
};
|
};
|
||||||
|
SetAttemptingRunState();
|
||||||
await _runService.RunProject(Project, true, debuggerExecutableInfo).ConfigureAwait(false);
|
await _runService.RunProject(Project, true, debuggerExecutableInfo).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetAttemptingRunState()
|
||||||
|
{
|
||||||
|
_runButton.Visible = false;
|
||||||
|
_debugButton.Visible = false;
|
||||||
|
_animatedTextureParentControl.Visible = true;
|
||||||
|
_buildAnimationPlayer.Play(_buildAnimationName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user