using SkullLabs; using System; using System.Drawing; using System.Windows.Forms; namespace SkullLabsAuthExample { public partial class Form2 : Form { public Form2(LoginResult session) { Text = "Skull Labs Auth - Welcome"; Size = new Size(420, 240); StartPosition = FormStartPosition.CenterScreen; FormBorderStyle = FormBorderStyle.FixedDialog; MaximizeBox = false; BackColor = Color.FromArgb(12, 13, 17); ForeColor = Color.FromArgb(230, 232, 238); Font = new Font("Segoe UI", 9.5f); var title = new Label { Text = "AUTHENTICATED", Font = new Font("Consolas", 10f, FontStyle.Bold), ForeColor = Color.FromArgb(34, 211, 154), Location = new Point(24, 24), Size = new Size(360, 20), }; var welcome = new Label { Text = $"Welcome, {session.User?.Username ?? "user"}", Font = new Font("Segoe UI", 16f, FontStyle.Bold), ForeColor = Color.White, Location = new Point(24, 50), Size = new Size(360, 32), }; string validityText; if (session.User?.ExpiresAtUtc.HasValue == true) { var local = session.User.ExpiresAtUtc.Value.ToLocalTime(); validityText = $"Valid until: {local:dd MMM yyyy, HH:mm}"; } else { validityText = "Valid until: lifetime"; } var validity = new Label { Text = validityText, Font = new Font("Consolas", 10f), ForeColor = Color.FromArgb(0, 229, 255), Location = new Point(24, 96), Size = new Size(360, 22), }; var sessionLbl = new Label { Text = $"Session: {session.SessionId ?? "-"}", Font = new Font("Consolas", 8.5f), ForeColor = Color.FromArgb(139, 143, 156), Location = new Point(24, 122), Size = new Size(360, 20), }; var logoutBtn = new Button { Text = "Logout", Location = new Point(24, 156), Size = new Size(360, 32), BackColor = Color.FromArgb(20, 22, 28), ForeColor = Color.White, FlatStyle = FlatStyle.Flat, }; logoutBtn.FlatAppearance.BorderColor = Color.FromArgb(40, 44, 56); logoutBtn.Click += (s, e) => Close(); Controls.AddRange(new Control[] { title, welcome, validity, sessionLbl, logoutBtn }); } } }