Exemplo n.º 1
0
        private void menuItemLogin_Click(object sender, EventArgs e)
        {
            this.notifyIcon.Icon = Resource.media_white;
            AuthorizeForm loginDialog = new AuthorizeForm(AuthorizeForm.FormTypes.Login);

            if (loginDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    this.User = this.ServiceClient.Login(loginDialog.Login, loginDialog.Password);
                    if (this.IsLoggedIn())
                    {
                        this.SetLoggedInState(true);
                        MessageBox.Show("Logged in!");
                    }
                    else
                    {
                        MessageBox.Show("Invalid credentials.");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Connection failed.");
                }
            }
            this.notifyIcon.Icon = Resource.media_black;
        }
Exemplo n.º 2
0
        private void menuItemSignUp_Click(object sender, EventArgs e)
        {
            this.notifyIcon.Icon = Resource.media_white;
            AuthorizeForm signUpDialog = new AuthorizeForm(AuthorizeForm.FormTypes.SignUp);

            if (signUpDialog.ShowDialog() == DialogResult.OK)
            {
                if (this.ServiceClient.CreateUser(signUpDialog.Login, signUpDialog.Password))
                {
                    MessageBox.Show("Registered, please login.");
                }
                else
                {
                    MessageBox.Show("Not success, try again.");
                }
            }
            this.notifyIcon.Icon = Resource.media_black;
        }