Example #1
0
        private void Kaufen_Click(object sender, EventArgs e)
        {
            var button = sender as Button;
            var action = Actions.None;

            if (button == Cola)
            {
                action = Actions.SellCola;
            }
            else if (button == Limonade)
            {
                action = Actions.SellLimonade;
            }
            else if (button == Wasser)
            {
                action = Actions.SellWater;
            }
            else
            {
                return;
            }
            DisplayStatusAsync(_sender.SendCommandToServerEndpoint(action));
        }
        private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            txtConsole.Text = "Running...";
            try
            {
                var commands = txtCommand.Text.Split(' ');
                switch (commands.FirstOrDefault())
                {
                case "login":
                {
                    _securityService.SignOut();
                    var auth  = commands[1];
                    var token = _securityService.Authenticate(auth);
                    if (_securityService.IsAuthorized)
                    {
                        txtConsole.Text = $"Login successed.";
                    }
                    else
                    {
                        txtConsole.Text = $"Login failed.";
                    }

                    break;
                }

                case "isinrole":
                {
                    var role = commands[1];
                    txtConsole.Text = $"Is in role {role}: { _securityService.IsInRole(role)}";
                    break;
                }

                default:
                {
                    var result = _sender.SendCommandToServerEndpoint(txtCommand.Text);
                    txtConsole.Text = result.ToString();
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                txtConsole.Text = $"Something goes wrong. {ex.Message}";
            }
        }
Example #3
0
 private void Broadcast(object sender, RoutedEventArgs e)
 {
     _endpointCommandSender.SendCommandToServerEndpoint("broadcast");
 }