void Presenter_AuthRequest(object sender, AuthEventArgs e) { // present login using (dlgLogin login = new dlgLogin(e.UserName)) { login.StartPosition = FormStartPosition.CenterParent; if (login.ShowDialog(this) == DialogResult.OK) { e.UserName = login.Username; e.Password = login.Password; e.Handled = true; } else { Log.InfoFormat("Login canceled. Closing parent form"); this.ParentForm.Close(); } } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); #if (DEBUG) var connectionString = PersistanceManager.GetConnectionStringByName("ServisDBLocal"); #else var connectionString = PersistanceManager.GetConnectionStringByName("ServisDB"); #endif PersistanceManager.SetConnection(connectionString); #if (DEBUG) Application.Run(new FormGlavna()); #else dlgLogin dlg = new dlgLogin(); if (dlg.ShowDialog() == DialogResult.OK) { Application.Run(new FormGlavna()); } #endif }