mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-02-02 06:17:34 +00:00
Reconnect to MUD after unexpected loss
This commit is contained in:
parent
2ea24d407c
commit
2612721346
2 changed files with 29 additions and 3 deletions
|
@ -40,7 +40,7 @@ namespace ShiftOS.WinForms
|
|||
{
|
||||
get
|
||||
{
|
||||
return Desktop.Size.Height - ((Shiftorium.UpgradeInstalled("desktop_panel") == true) ? SkinEngine.LoadedSkin.DesktopPanelHeight : 0);
|
||||
return Desktop.Size.Height - ((Shiftorium.UpgradeInstalled("desktop") == true) ? SkinEngine.LoadedSkin.DesktopPanelHeight : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ namespace ShiftOS.WinForms
|
|||
{
|
||||
get
|
||||
{
|
||||
if (!Shiftorium.UpgradeInstalled("desktop_panel"))
|
||||
if (!Shiftorium.UpgradeInstalled("desktop"))
|
||||
return 0;
|
||||
return ((SkinEngine.LoadedSkin.DesktopPanelPosition == 0) ? SkinEngine.LoadedSkin.DesktopPanelHeight : 0);
|
||||
}
|
||||
|
@ -64,6 +64,14 @@ namespace ShiftOS.WinForms
|
|||
Desktop.InvokeOnWorkerThread(act);
|
||||
}
|
||||
|
||||
public WinformsWindowManager()
|
||||
{
|
||||
Shiftorium.Installed += () =>
|
||||
{
|
||||
SetupWindows();
|
||||
};
|
||||
}
|
||||
|
||||
public override void Maximize(IWindowBorder form)
|
||||
{
|
||||
try
|
||||
|
|
|
@ -51,9 +51,11 @@ namespace ShiftOS.Engine
|
|||
|
||||
public static Guid thisGuid { get; private set; }
|
||||
private static NetObjectClient client { get; set; }
|
||||
private static bool UserDisconnect = false;
|
||||
|
||||
public static void Disconnect()
|
||||
{
|
||||
UserDisconnect = true;
|
||||
if (client != null)
|
||||
{
|
||||
client.Disconnect();
|
||||
|
@ -117,7 +119,23 @@ namespace ShiftOS.Engine
|
|||
public static void Initiate(string mud_address, int port)
|
||||
{
|
||||
client = new NetObjectClient();
|
||||
|
||||
client.OnDisconnected += (o, a) =>
|
||||
{
|
||||
if (!UserDisconnect)
|
||||
{
|
||||
TerminalBackend.PrefixEnabled = true;
|
||||
ConsoleEx.ForegroundColor = ConsoleColor.Red;
|
||||
ConsoleEx.Bold = true;
|
||||
Console.Write($@"Disconnected from MUD: ");
|
||||
ConsoleEx.Bold = false;
|
||||
ConsoleEx.Italic = true;
|
||||
ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow;
|
||||
Console.WriteLine("You have been disconnected from the multi-user domain for an unknown reason. Your save data is preserved within the kernel and you will be reconnected shortly.");
|
||||
TerminalBackend.PrefixEnabled = true;
|
||||
TerminalBackend.PrintPrompt();
|
||||
Initiate(mud_address, port);
|
||||
}
|
||||
};
|
||||
client.OnReceived += (o, a) =>
|
||||
{
|
||||
var msg = a.Data.Object as ServerMessage;
|
||||
|
|
Loading…
Add table
Reference in a new issue