private void OnChangePasswordClick(object sender, EventArgs e)
 {
     if (!this.Visible)
     {
         this.Show();
         this.WindowState = FormWindowState.Normal;
     }
     using (ChangePasswordForm form = new ChangePasswordForm(AppContext.LoggedUser))
     {
         form.ShowDialog();
     }
 }
        public static bool ShowForm(User obj)
        {
            bool r = false;

            if (!Objectbase.IsNullOrEmpty(obj))
            {
                using (ChangePasswordForm frm = new ChangePasswordForm(obj))
                {
                    r = frm.ShowDialog() == DialogResult.OK;
                }
            }
            return(r);
        }
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);
            if (!AppContext.IsUserLoggedIn)
            {
                if (!LoginForm.ShowForm())
                {
                    Application.Exit();
                }
                else
                {
                    if (string.IsNullOrEmpty(AppContext.LoggedUser.Password))
                    {
                        ChangePasswordForm.ShowForm();
                    }

                    this.RefreshUserData();
                    this.LoadEntities(null);
                    //this.scMainSplitter.Panel2Collapsed = false;
                    //this.LoadWorkspace();
                    this.nicApp.Visible = true;
                }
                if (AppContext.IsMainUser)
                {
                    this.LoadEntities(null);
                }
            }
            else if (isFirstTime)
            {
                this.RefreshUserData();
                this.LoadEntities(null);
                //this.scMainSplitter.Panel2Collapsed = false;
                // this.LoadWorkspace();
                this.nicApp.Visible = true;
            }
            isFirstTime = false;
        }