Skip to content

Commit

Permalink
Merge pull request #600 from mbbsemu/ui-cleanup
Browse files Browse the repository at this point in the history
UI Cleanup
  • Loading branch information
paladine authored Nov 22, 2023
2 parents b2a8435 + c5298e9 commit dd9c93a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
28 changes: 25 additions & 3 deletions MBBSEmu/UI/Main/MainView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ public override void Setup()
"https://www.mbbsemu.com", "OK")),
})
});
menu.Text = "Test";
menu.TextAlignment = TextAlignment.Right;
MainWindow.Add(menu);

//Audit Log Window
Expand All @@ -102,6 +100,17 @@ public override void Setup()
PreserveTrailingSpaces = false,
Style = new TableView.TableStyle { AlwaysShowHeaders = true }
};

//Use local Function to return new ColumnStyle with specified MinWidth and MaxWidth
TableView.ColumnStyle GetAuditLogStyle(int minWidth, int maxWidth) => new()
{
MinWidth = minWidth,
MaxWidth = maxWidth
};

_auditLogTableView.Style.ColumnStyles.Add(_auditLogTableView.Table.Columns["Summary"], GetAuditLogStyle(20, 20));
_auditLogTableView.Style.ColumnStyles.Add(_auditLogTableView.Table.Columns["Detail"], GetAuditLogStyle(50, 50));

auditLogContainer.Add(_auditLogTableView);
MainWindow.Add(auditLogContainer);

Expand Down Expand Up @@ -264,9 +273,22 @@ private void UpdateApplicationLog()
{
var logDate = ((DateTime)entry[0]).ToString("HH:mm:ss.fff");
var logClass = (entry[1].ToString())?[8..];
var logLevel = ((LogLevel)entry[2]).ToString();
var logLevel = string.Empty;
var logMessage = (string)entry[3];

//Evaluate message LogLevel and set string to be the level name up to 5 characters
logLevel = (LogLevel)entry[2] switch
{
LogLevel.Trace => "TRACE",
LogLevel.Debug => "DEBUG",
LogLevel.Information => "INFO",
LogLevel.Warning => "WARN",
LogLevel.Error => "ERROR",
LogLevel.Critical => "CRIT",
LogLevel.None => "NONE",
_ => logLevel
};

_logTable.Rows.Add(
logDate, logClass, logLevel, logMessage);
}
Expand Down
15 changes: 15 additions & 0 deletions MBBSEmu/UI/Setup/SetupView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ public SetupView() : base()

public override void Setup()
{
//Setup an outer view for the Initial Setup Wizard
var outerView = new Window()
{
X = 0,
Y = 0,
Width = Dim.Fill(),
Height = Dim.Fill(),
Border = new Border
{
BorderStyle = BorderStyle.Double,
BorderBrush = Color.BrightCyan,
Title= "MBBSEmu Initial Setup"
},
};
MainWindow.Add(outerView);

var wizard = new Wizard("Initial Setup Wizard")
{
Expand Down

0 comments on commit dd9c93a

Please sign in to comment.