run menu buttons
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Threading.Tasks;
|
||||||
using Godot;
|
using Godot;
|
||||||
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
||||||
|
|
||||||
@@ -8,12 +9,32 @@ public partial class RunMenuItem : HBoxContainer
|
|||||||
public SharpIdeProjectModel Project { get; set; } = null!;
|
public SharpIdeProjectModel Project { get; set; } = null!;
|
||||||
private Label _label = null!;
|
private Label _label = null!;
|
||||||
private Button _runButton = null!;
|
private Button _runButton = null!;
|
||||||
|
private Button _stopButton = null!;
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
_label = GetNode<Label>("Label");
|
_label = GetNode<Label>("Label");
|
||||||
|
_label.Text = Project.Name;
|
||||||
_runButton = GetNode<Button>("RunButton");
|
_runButton = GetNode<Button>("RunButton");
|
||||||
_runButton.Pressed += OnRunButtonPressed;
|
_runButton.Pressed += OnRunButtonPressed;
|
||||||
_label.Text = Project.Name;
|
_stopButton = GetNode<Button>("StopButton");
|
||||||
|
_stopButton.Pressed += OnStopButtonPressed;
|
||||||
|
Project.ProjectStartedRunning += OnProjectStartedRunning;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task OnProjectStartedRunning()
|
||||||
|
{
|
||||||
|
await this.InvokeAsync(() =>
|
||||||
|
{
|
||||||
|
_runButton.Visible = false;
|
||||||
|
_stopButton.Visible = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void OnStopButtonPressed()
|
||||||
|
{
|
||||||
|
await Singletons.RunService.CancelRunningProject(Project);
|
||||||
|
_stopButton.Visible = false;
|
||||||
|
_runButton.Visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void OnRunButtonPressed()
|
private async void OnRunButtonPressed()
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
[gd_scene load_steps=3 format=3 uid="uid://d2ewm2lajutpv"]
|
[gd_scene load_steps=4 format=3 uid="uid://d2ewm2lajutpv"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://btsnapfx0dlbb" path="res://Features/Run/RunMenuItem.cs" id="1_syj0f"]
|
[ext_resource type="Script" uid="uid://btsnapfx0dlbb" path="res://Features/Run/RunMenuItem.cs" id="1_syj0f"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bnprs1lvjyaji" path="res://Features/Run/Play.png" id="1_xfxpu"]
|
[ext_resource type="Texture2D" uid="uid://bnprs1lvjyaji" path="res://Features/Run/Play.png" id="1_xfxpu"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://csj1r7s3u10ch" path="res://Features/Run/Stop.png" id="4_cd138"]
|
||||||
|
|
||||||
[node name="RunMenuItem" type="HBoxContainer"]
|
[node name="RunMenuItem" type="HBoxContainer"]
|
||||||
offset_right = 40.0
|
offset_right = 40.0
|
||||||
@@ -19,3 +20,8 @@ size_flags_horizontal = 3
|
|||||||
[node name="RunButton" type="Button" parent="."]
|
[node name="RunButton" type="Button" parent="."]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
icon = ExtResource("1_xfxpu")
|
icon = ExtResource("1_xfxpu")
|
||||||
|
|
||||||
|
[node name="StopButton" type="Button" parent="."]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
icon = ExtResource("4_cd138")
|
||||||
|
|||||||
BIN
src/SharpIDE.Godot/Features/Run/Stop.png
Normal file
BIN
src/SharpIDE.Godot/Features/Run/Stop.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 607 B |
34
src/SharpIDE.Godot/Features/Run/Stop.png.import
Normal file
34
src/SharpIDE.Godot/Features/Run/Stop.png.import
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://csj1r7s3u10ch"
|
||||||
|
path="res://.godot/imported/Stop.png-369cb830460ee73ee5ab96abbb3f5c92.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://Features/Run/Stop.png"
|
||||||
|
dest_files=["res://.godot/imported/Stop.png-369cb830460ee73ee5ab96abbb3f5c92.ctex"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/high_quality=false
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_compression=1
|
||||||
|
compress/normal_map=0
|
||||||
|
compress/channel_pack=0
|
||||||
|
mipmaps/generate=false
|
||||||
|
mipmaps/limit=-1
|
||||||
|
roughness/mode=0
|
||||||
|
roughness/src_normal=""
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
process/hdr_as_srgb=false
|
||||||
|
process/hdr_clamp_exposure=false
|
||||||
|
process/size_limit=0
|
||||||
|
detect_3d/compress_to=1
|
||||||
@@ -56,9 +56,6 @@ public partial class IdeRoot : Control
|
|||||||
_solutionExplorerPanel.SolutionModel = solutionModel;
|
_solutionExplorerPanel.SolutionModel = solutionModel;
|
||||||
Callable.From(_solutionExplorerPanel.RepopulateTree).CallDeferred();
|
Callable.From(_solutionExplorerPanel.RepopulateTree).CallDeferred();
|
||||||
RoslynAnalysis.StartSolutionAnalysis(path);
|
RoslynAnalysis.StartSolutionAnalysis(path);
|
||||||
var infraProject = solutionModel.AllProjects.Single(s => s.Name == "Infrastructure");
|
|
||||||
var diFile = infraProject.Files.Single(s => s.Name == "DependencyInjection.cs");
|
|
||||||
await this.InvokeAsync(async () => await _sharpIdeCodeEdit.SetSharpIdeFile(diFile));
|
|
||||||
|
|
||||||
var tasks = solutionModel.AllProjects.Select(p => p.MsBuildEvaluationProjectTask).ToList();
|
var tasks = solutionModel.AllProjects.Select(p => p.MsBuildEvaluationProjectTask).ToList();
|
||||||
await Task.WhenAll(tasks).ConfigureAwait(false);
|
await Task.WhenAll(tasks).ConfigureAwait(false);
|
||||||
@@ -74,6 +71,11 @@ public partial class IdeRoot : Control
|
|||||||
}
|
}
|
||||||
_runMenuButton.Disabled = false;
|
_runMenuButton.Disabled = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var infraProject = solutionModel.AllProjects.Single(s => s.Name == "Infrastructure");
|
||||||
|
var diFile = infraProject.Files.Single(s => s.Name == "DependencyInjection.cs");
|
||||||
|
await this.InvokeAsync(async () => await _sharpIdeCodeEdit.SetSharpIdeFile(diFile));
|
||||||
|
|
||||||
//var runnableProject = solutionModel.AllProjects.First(s => s.IsRunnable);
|
//var runnableProject = solutionModel.AllProjects.First(s => s.IsRunnable);
|
||||||
//await this.InvokeAsync(() => _runPanel.NewRunStarted(runnableProject));
|
//await this.InvokeAsync(() => _runPanel.NewRunStarted(runnableProject));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user