mirror of
https://git.battle-of-pip.de/root/vpr-mitarbeiterverwaltung.git
synced 2025-06-20 15:53:16 +02:00
55 lines
1.3 KiB
C#
55 lines
1.3 KiB
C#
namespace DX86.Modules;
|
|
/*
|
|
* Copyright 2024 SnapixLP
|
|
*/
|
|
public class MessageBox
|
|
{
|
|
private MessageSender ms;
|
|
|
|
public MessageBox(MessageSender ms)
|
|
{
|
|
this.ms = ms;
|
|
ms.Log("[MessageBox] MessageBox initialized");
|
|
}
|
|
|
|
public async Task<string> ShowAsync(string title, List<string> lines)
|
|
{
|
|
ms.SaveOnly(true);
|
|
Console.Clear();
|
|
string message = "";
|
|
|
|
List<int> longestLine = new List<int>();
|
|
int lineNumber = 0;
|
|
|
|
foreach (var line in lines)
|
|
{
|
|
longestLine.Add(line.Length);
|
|
lineNumber++;
|
|
}
|
|
|
|
longestLine.Add(title.Length + 4);
|
|
|
|
int maxLength = longestLine.Max();
|
|
|
|
string titleBar = new string('-', maxLength);
|
|
|
|
Console.WriteLine("+ {0} +", titleBar);
|
|
Console.WriteLine("| » {0}{1} |", title, new string(' ', (maxLength - title.Length) - 4));
|
|
Console.WriteLine("+ {0} +", titleBar);
|
|
|
|
for (int i = 0; i < lines.Count; i++)
|
|
{
|
|
Console.WriteLine("| {0}{1} |", lines[i], new string(' ', maxLength - longestLine[i]));
|
|
}
|
|
|
|
Console.WriteLine("+ {0} +", titleBar);
|
|
|
|
Console.Write(" »» Press any key to continue...");
|
|
Console.ReadKey();
|
|
ms.SaveOnly(false);
|
|
ms.SendHistory();
|
|
|
|
return "OK";
|
|
}
|
|
|
|
} |