Esempio n. 1
0
        static void ShowLoginDialog()
        {
            var loginDialog = new LoginDialog();

            loginDialog.LoginSucceeded += (object sender, EventArgs e) =>
            {
                var passwordManagerForm = new PasswordManagerForm()
                {
                    M_secretkey  = loginDialog.keyData,
                    LoggedInUser = new Shared.Username(loginDialog.userName)
                    {
                        isAdmin = loginDialog.isAdmin
                    }
                };
                SocketManager.Instance.Disconnected += OnDisconnect;
                passwordManagerForm.Show();
            };
            loginDialog.FormClosed += (object sender, FormClosedEventArgs e) =>
            {
                if (!loginDialog.IsLoginSuccessful)
                {
                    // Assume that if we didn't log in that we're attempting to close the program.
                    Application.Exit();
                }
            };
            loginDialog.Show();
        }
Esempio n. 2
0
        public NewApplicationForm(String[] appTypes, byte[] key, PasswordManagerForm managerForm)
        {
            InitializeComponent();
            this.managerForm = managerForm;
            this.appTypeComboBox.SelectedIndex = 0;

            foreach (var appType in appTypes)
            {
                if (!this.appTypeComboBox.Items.Contains(appType))
                {
                    this.appTypeComboBox.Items.Insert(0, appType);
                }
            }
            secretKey = key;
        }