-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
37 lines (34 loc) · 1.16 KB
/
Program.cs
File metadata and controls
37 lines (34 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Windows.Forms;
namespace MyPasswordManager
{
internal static class Program
{
[STAThread]
static void Main()
{
// 1. Standard WinForms setup
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
// 2. Open the Login window first
using (LoginForm login = new LoginForm())
{
// This line pauses the code here and shows the Login screen
Application.Run(login);
// 3. Once the Login window closes, check if they actually logged in
if (login.IsAuthenticated)
{
// 4. THIS IS THE FIX: We pass the password from the login form
// directly into the Form1 constructor.
Application.Run(new Form1(login.MasterPassword));
}
else
{
// If they just closed the login window without unlocking,
// the app simply exits.
Application.Exit();
}
}
}
}
}