private void MainFormShown(object sender, System.EventArgs e)
        {
            Boolean isFirstRun = Boolean.Parse(ConfigurationManager.AppSettings.Get("FirstRun"));
            if (isFirstRun)
            {
                var selectClinic = new ClinicSelection();
                selectClinic.ShowDialog(this);
            }

            var login = new Login();
            login.ShowDialog(this);

            if (AppContext.Authenticated)
            {
                this.txtLoggedIn.Text = String.Format("{0}:{1}", AppContext.LoggedInUser.RoleName, AppContext.LoggedInUser.UserName);
                this.txtClinic.Text = String.Format("Phòng khám: {0}", AppContext.CurrentClinic.Name);
                this.mnuLogout.Enabled = true;
                this.mnuLogin.Enabled = false;
            }
            else
            {
                this.mnuLogout.Enabled = false;
                this.mnuLogin.Enabled = true;
            }
            this.CommonInitilize();
        }
        private void OpenToolStripMenuItemClick(object sender, System.EventArgs e)
        {
            var login = new Login();
            login.ShowDialog(this);

            if (AppContext.Authenticated)
            {
                this.txtLoggedIn.Text = AppContext.LoggedInUser.UserName;
                this.txtClinic.Text = AppContext.CurrentClinic.Name;
                this.mnuLogout.Enabled = true;
                this.mnuLogin.Enabled = false;
            } else
            {
                this.mnuLogout.Enabled = false;
                this.mnuLogin.Enabled = true;
            }
            this.CommonInitilize();
        }
 private void MainForm_Shown(object sender, System.EventArgs e) {
     this.txtClinic.Text = AppContext.CurrentClinic.Name;
     Login login = new Login();
     login.ShowDialog(this);
     if (AppContext.Authenticated)
     {
         this.txtLoggedIn.Text = AppContext.LoggedInUser.UserName;
     }
 }