Generalise and combine cancel/confirm prompts.

This commit is contained in:
Paul Chote
2016-06-16 18:21:55 +01:00
parent bc03c199f5
commit 3ac42e1643
9 changed files with 94 additions and 146 deletions

View File

@@ -128,14 +128,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
}
catch (System.Net.Sockets.SocketException e)
{
var err_msg = "Could not listen on port {0}.".F(Game.Settings.Server.ListenPort);
var message = "Could not listen on port {0}.".F(Game.Settings.Server.ListenPort);
if (e.ErrorCode == 10048) { // AddressAlreadyInUse (WSAEADDRINUSE)
err_msg += "\n\nCheck if the port is already being used.";
message += "\nCheck if the port is already being used.";
} else {
err_msg += "\n\nError is: \"{0}\" ({1})".F(e.Message, e.ErrorCode);
message += "\nError is: \"{0}\" ({1})".F(e.Message, e.ErrorCode);
}
ConfirmationDialogs.CancelPrompt("Server Creation Failed", err_msg, cancelText: "OK");
ConfirmationDialogs.ButtonPrompt("Server Creation Failed", message, onCancel: () => { }, cancelText: "Back");
return;
}