Ejemplo n.º 1
0
        private static void StartNewInstance(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            MainForm mainForm = new MainForm();
            mainForm.StartPosition = FormStartPosition.CenterScreen;

            LoginForm loginForm = new LoginForm();
            loginForm.StartPosition = FormStartPosition.CenterParent;
            if (loginForm.ShowDialog() != DialogResult.OK)
            {
                goto LABEL_EXIT_APP;
            }
            loginForm.Dispose();
            mainForm.SwitchSystemUser(loginForm.LoginUser);

            if (mainForm == null || mainForm.IsDisposed)
                Application.Exit();
            else
                Application.Run(mainForm);

            LABEL_EXIT_APP:
            mainForm.Dispose();
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            SwitchSystemUser(loginForm.LoginUser);
            LoginForm loginForm = new LoginForm();
            loginForm.StartPosition = FormStartPosition.CenterParent;
            loginForm.ShowInTaskbar = false;
            if (loginForm.ShowDialog() != DialogResult.OK)
                return;

            loginForm.Dispose();
        }