Пример #1
0
 public Dashboard()
 {
     InitializeComponent();
     client = new HumanityServiceClient();
     DashboardPanel_TreeView.Focus();
     HideAll();
 }
Пример #2
0
 public Menu()
 {
     client = new HumanityServiceClient();
     InitializeComponent();
     transportationType.Add("Car", "driving-car");
     transportationType.Add("Walking", "cycling-regular");
     transportationType.Add("Cycling", "foot-walking");
 }
Пример #3
0
        private async void SigninButton_ClickAsync(object sender, EventArgs e)
        {
            var loginRequest = new LoginRequest
            {
                Username = UsernameTextBox.Text,
                Password = PasswordTextBox.Text
            };
            HumanityServiceClient client = new HumanityServiceClient();
            string message;

            if (UserType == "Contributor")
            {
                var authenticationResult = await client.LoginUser(loginRequest);

                if (authenticationResult.LoginValidated)
                {
                    Properties.Settings.Default["Username"] = UsernameTextBox.Text;
                    Properties.Settings.Default.Save();
                    Menu menu = new Menu();
                    this.Hide();
                    menu.Show();
                }
                else
                {
                    message = "Wrong username or password. Please try again.";
                    MessageBox.Show(message);
                }
            }
            else
            {
                var authenticationResult = await client.LoginNgo(loginRequest);

                if (authenticationResult.LoginValidated)
                {
                    Properties.Settings.Default["Username"] = UsernameTextBox.Text;
                    Properties.Settings.Default.Save();
                    Dashboard dashboard = new Dashboard();
                    this.Hide();
                    dashboard.Show();
                }
                else
                {
                    message = "Wrong username or password. Please try again.";
                    MessageBox.Show(message);
                }
            }
        }