Skip to content

Commit 327b06f

Browse files
committed
Refact ContentRegion
1 parent 6a14e9a commit 327b06f

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/Modules/QuickCode.Modules.ContentRegion/ViewModels/ContentRegionViewModel.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
using QuickCode.Core.Mvvm;
55
using QuickCode.Services.Interfaces;
66
using System;
7-
using System.Net.Sockets;
8-
using System.Threading.Tasks;
97
using System.Windows;
108
using System.Windows.Threading;
119

@@ -76,7 +74,7 @@ private void RaiseDataReceivedEvent(object sender, string data)
7674
{
7775
Application.Current?.Dispatcher?.BeginInvoke(DispatcherPriority.Background, new Action(() =>
7876
{
79-
if(ExecutionResult != null && !mIsExecutionStop)
77+
if(!mIsExecutionStop && IsConnected)
8078
ExecutionResult = ExecutionResult + $"{data}\n";
8179
}));
8280
}
@@ -103,7 +101,7 @@ public string SourceCode
103101
}
104102
}
105103

106-
private string mExecutionResult = "";
104+
private string mExecutionResult = string.Empty;
107105
public string ExecutionResult
108106
{
109107
get { return mExecutionResult; }
@@ -154,7 +152,7 @@ public override void Destroy()
154152

155153
private async void Start()
156154
{
157-
ExecutionResult = "";
155+
ExecutionResult = string.Empty;
158156
string sourceCode = SourceCode;
159157

160158
try

src/Modules/QuickCode.Modules.ContentRegion/Views/ContentRegionView.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
HorizontalAlignment="Left"
2424
Content="Start"
2525
Command="{Binding StartCommand}"
26+
IsEnabled="{Binding IsConnected, Converter={StaticResource Boolean2BooleanReConverter}}"
2627
Style="{DynamicResource ButtonDefault.Small}"/>
2728

2829
<CheckBox Content="Enable Debug"

0 commit comments

Comments
 (0)