using System; using System.Drawing; using System.Windows.Forms; class Program : Form { Program() { CenterToScreen(); Width = 800; Height = 600; } public static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); if (PerformLogin()) Application.Run(new Program()); } static bool PerformLogin() { using (AuthForm authform = new AuthForm()) { if (authform.ShowDialog() == DialogResult.OK) { if(AuthenticateUser(authform.UserName, authform.Password)) return true; else { MessageBox.Show("Azonosítás sikertelen"); return false; } } else return false; } } static bool AuthenticateUser(String user, String pass) { //Ide jön az azonosítás return true; } } public class AuthForm : Form { Label label = new Label(); Button loginButton = new Button(); public String UserName; public String Password; public AuthForm() { label.Text = "Azonosítás"; label.Location = new Point(50, 10); label.Size = new Size(100, 30); loginButton.Text = "Belépés"; loginButton.Location = new Point(50, 150); loginButton.Click += new EventHandler(LoginButton_Click); Controls.Add(label); Controls.Add(loginButton); TopMost = true; CenterToScreen(); Width = 300; Height = 200; } protected void LoginButton_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; Close(); } }