|
@@ -217,6 +217,12 @@ public class MainWindowViewModel : ViewModelBase
|
|
|
|
|
|
}
|
|
|
|
|
|
+ public MainWindowViewModel(Action hide, Action show) : this()
|
|
|
+ {
|
|
|
+ _hide = hide;
|
|
|
+ _show = show;
|
|
|
+ }
|
|
|
+
|
|
|
System.Timers.Timer _consoleOutputTimer = new(250);
|
|
|
|
|
|
private HubConnection? _connection;
|
|
@@ -231,6 +237,9 @@ public class MainWindowViewModel : ViewModelBase
|
|
|
private string _startButtonOutput = string.Empty;
|
|
|
private CancellationTokenSource _tokenSource = new();
|
|
|
|
|
|
+ private Action _hide = () => { };
|
|
|
+ private Action _show = () => { };
|
|
|
+
|
|
|
LatestLauncherVersion? _latestLauncherInfo;
|
|
|
DownloadedVersion? _downloadedVersion;
|
|
|
DownloadedVersion? _startedVersion;
|
|
@@ -493,7 +502,7 @@ public class MainWindowViewModel : ViewModelBase
|
|
|
ProcessStartInfo proc;
|
|
|
proc = new ProcessStartInfo
|
|
|
{
|
|
|
- UseShellExecute = false,
|
|
|
+ UseShellExecute = false,
|
|
|
RedirectStandardOutput = true,
|
|
|
RedirectStandardError = true,
|
|
|
CreateNoWindow = true,
|
|
@@ -532,6 +541,7 @@ public class MainWindowViewModel : ViewModelBase
|
|
|
_startedVersion = DownloadedVersion;
|
|
|
minecraft.Start();
|
|
|
|
|
|
+ _hide();
|
|
|
minecraft.Exited += ProcessExited;
|
|
|
|
|
|
minecraft.BeginOutputReadLine();
|
|
@@ -621,6 +631,8 @@ public class MainWindowViewModel : ViewModelBase
|
|
|
|
|
|
StartButtonOutput = "";
|
|
|
IsNoGameRunning = true;
|
|
|
+
|
|
|
+ _show();
|
|
|
if (minecraftProcess.ExitCode is not (0 or 2))
|
|
|
OpenErrorWindow(new JavaProcessException($"Minecraft process exited with an error code {minecraftProcess.ExitCode}.\nCheck log in game folder or launcher console.", $"{Settings.minecraftForlderPath}versions/{_startedVersion?.Version ?? "NULL"}/crash-reports"));
|
|
|
else if (minecraftProcess.ExitCode is 2)
|
|
@@ -850,11 +862,7 @@ public class MainWindowViewModel : ViewModelBase
|
|
|
serverPanelModel.Players = $"{status.NumPlayers}/{status.MaxPlayers}";
|
|
|
serverPanelModel.Tip = String.Empty;
|
|
|
if (UInt16.Parse(status.NumPlayers ?? "0") > 0)
|
|
|
- foreach (var player in status.Players ?? new())
|
|
|
- {
|
|
|
- serverPanelModel.Tip += player;
|
|
|
- serverPanelModel.Tip += "\n";
|
|
|
- }
|
|
|
+ serverPanelModel.Tip = string.Join('\n',status.Players);
|
|
|
else
|
|
|
serverPanelModel.Tip = "No players.";
|
|
|
}
|