Skip to content

Commit 2aaf7af

Browse files
committed
Wait before resize the windows after it's embedded
1 parent b37da67 commit 2aaf7af

File tree

2 files changed

+11
-14
lines changed

2 files changed

+11
-14
lines changed

Source/NETworkManager/Controls/PuTTYControl.xaml.cs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -149,19 +149,6 @@ private async Task Connect()
149149

150150
while ((DateTime.Now - startTime).TotalSeconds < 10)
151151
{
152-
// Fix for netcore3.1 https://stackoverflow.com/questions/60342879/process-mainwindowhandle-is-non-zero-in-net-framework-but-zero-in-net-core-unl
153-
/*
154-
try
155-
{
156-
_process = Process.GetProcessById(_process.Id);
157-
}
158-
catch
159-
{
160-
break; // Process has exited
161-
}
162-
*/
163-
164-
165152
_process.Refresh();
166153

167154
if (_process.HasExited)
@@ -200,7 +187,10 @@ private async Task Connect()
200187

201188
IsConnected = true;
202189

203-
// Resize embedded application & refresh
190+
// Resize embedded application & refresh
191+
// Requires a short delay because it'S not applied immediately
192+
await Task.Delay(500);
193+
204194
ResizeEmbeddedWindow();
205195
}
206196
}

Source/NETworkManager/ViewModels/ProfilesViewModel.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
using NETworkManager.Settings;
1414
using System.Threading.Tasks;
1515
using System.Windows;
16+
using System.Diagnostics;
1617

1718
namespace NETworkManager.ViewModels
1819
{
@@ -396,6 +397,12 @@ private void StopDelayedSearch()
396397

397398
public void RefreshProfiles()
398399
{
400+
if(Profiles == null)
401+
{
402+
Debug.WriteLine("Profiles is null");
403+
return;
404+
}
405+
399406
Profiles.Refresh();
400407
}
401408
#endregion

0 commit comments

Comments
 (0)