Esempio n. 1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //程序首先验证是否已经登录过,并且登录信息未失效
            if (!LoginController.IsEverLoggedIn())
            {
                //程序显示登录界面
                LoginForm loginForm = new LoginForm()
                {
                    StartPosition = FormStartPosition.CenterScreen
                };
                loginForm.ShowDialog();
                //显示主界面
                if (loginForm.DialogResult == DialogResult.OK)
                {
                    loginForm.Dispose();
                }
                else if (loginForm.DialogResult == DialogResult.Cancel)
                {
                    loginForm.Dispose();
                    return;
                }
            }
            Application.Run(new MainForm()
            {
                StartPosition = FormStartPosition.CenterScreen
            });
        }
Esempio n. 2
0
 public void CloseAllWindows()
 {
     if (lform != null)
     {
         lform.Dispose();
     }
     if (rform != null)
     {
         rform.Dispose();
     }
     if (mform != null)
     {
         mform.Dispose();
     }
     if (fform != null)
     {
         fform.Dispose();
     }
     if (aform != null)
     {
         aform.Dispose();
     }
     if (afform != null)
     {
         afform.Dispose();
     }
     if (mfform != null)
     {
         mfform.Dispose();
     }
 }
Esempio n. 3
0
 protected override void ExitThreadCore()
 {
     client.Dispose();
     formMessenger.Dispose();
     formLogin.Dispose();
     Settings.Default.Save();
     base.ExitThreadCore();
 }
Esempio n. 4
0
        private void button1_MouseClick(object sender, MouseEventArgs e)
        {
            LoginForm pant = new LoginForm();

            pant.Owner   = this;
            this.Visible = false;
            pant.ShowDialog();
            pant.Dispose();
        }
Esempio n. 5
0
        public static void Main()
        {
            if (CheckRunning())
            {
                return;
            }

            CheckForUpdates();

            InitDatabase();

            SCOUT.Security.Security.Initialize();

            DevExpress.Skins.SkinManager.Default.RegisterAssembly(typeof(DevExpress.UserSkins.OfficeSkins).Assembly);
            DevExpress.Skins.SkinManager.Default.RegisterAssembly(typeof(DevExpress.UserSkins.BonusSkins).Assembly);

            LoginForm loginForm = new LoginForm();

            s_mainForm = loginForm;

            if (loginForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            loginForm.Close();
            loginForm.Dispose();

            CheckResolution();

            s_splashForm = new SplashForm();
            s_splashForm.StartPosition = FormStartPosition.CenterScreen;
            s_splashForm.Show();
            Application.DoEvents();

            SetStatus("SCOUT is starting...");

            Thread.CurrentThread.CurrentCulture =
                System.Globalization.CultureInfo.InstalledUICulture;

            Application.Idle       += Application_Idle;
            Application.ThreadExit += Application_ThreadExit;

            s_mainForm = new mainForm();
            Application.Run(s_mainForm);

            //}
            //catch (Exception e)
            //{
            //    throw;
            //    //MessageBox.Show(e.Message + Environmen, Application.ProductName,
            //      //  MessageBoxButtons.OK, MessageBoxIcon.Error);
            //}
        }
Esempio n. 6
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Staff     currentStaff = new Staff();
            LoginForm loginForm    = new LoginForm();

            // TEST PURPOSE CODE BELOW
            //Application.Run(new OrderListForm());
            // TEST PURPOSE CODE ABOVE


//>>>>>>> origin/master
            if (loginForm.ShowDialog() == DialogResult.OK)
            {
                currentStaff = loginForm.currentStaff;
                DiningArea diningArea = new DiningArea(currentStaff);
                loginForm.Dispose();
                if (currentStaff.Role == StaffRole.Manager)
                {
                    //MessageBox.Show(string.Format("Welcome {0}! Your role is {1}", currentStaff.Name, currentStaff.Role));
                    //main form for Manager
                    Application.Run(new AdminForm(diningArea));
                }
                else if (currentStaff.Role == StaffRole.Waiter)
                {
                    //main form for waiter
                    Application.Run(new TabelStatusForm(diningArea));
                }
                else if (currentStaff.Role == StaffRole.Cook)
                {
                    MessageBox.Show(string.Format("Welcome {0}! Your role is {1}", currentStaff.Name, currentStaff.Role));
                    Application.Run(new OrderListForm());
                }
                else
                {
                    Application.Run(new WaitinglistScreenForm());
                    //MessageBox.Show(string.Format("Welcome {0}! Your role is {1}. And you will see customer UI.", currentStaff.Name, currentStaff.Role));
                }
            }


            ////test db
            //IntelligentRestaurantManager.Model.Staff staff = new Model.Staff();
            //DAL.StaffService staffService = new DAL.StaffService();
            //staff = staffService.GetByName("manager1");
            //MessageBox.Show(staff.Password + staff.Role);
            ////test int[] to string
            //int[] tableIds = new int[] { 1, 2, 3, 4, 5 };

            //MessageBox.Show(string.Join(",", tableIds));
        }
 /*
  * Disposes all forms. (Deletes them)
  */
 public void disposeForms()
 {
     if (orderForm != null)
     {
         orderForm.Dispose();
     }
     if (loginForm != null)
     {
         loginForm.Dispose();
     }
     if (adminForm != null)
     {
         adminForm.Dispose();
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            if (cmbAction.SelectedItem.ToString().Equals("Í˳ö"))
            {
                SyncForm frm = new SyncForm();
                frm.ShowDialog();
                login.Close();
                login.Dispose();
            }
            else
            {
                login.Refresh();
                login.Show();

                this.Dispose();
                mainForm.Dispose();
            }
        }
Esempio n. 9
0
        private LoginResultData showLoginForm()
        {
            DialogResult dialogResult = DialogResult.Retry;

            while (dialogResult == DialogResult.Retry)
            {
                m_LoginForm  = new LoginForm(m_loginClient);
                dialogResult = m_LoginForm.ShowDialog();
                m_LoginForm.Dispose();
            }

            LoginResultData loginResultData = new LoginResultData
            {
                LoginDialogResult = m_LoginForm.DialogResult,
                AccessToken       = m_LoginForm.AccessToken,
                User = m_LoginForm.User
            };

            return(loginResultData);
        }
Esempio n. 10
0
 public static void LoginOk()
 {
     loginForm.Close();
     loginForm.Dispose();
     mainWindow.LoginOk();
 }