Exemplo n.º 1
0
        public async Task  GetName()
        {
            SnakeOnlineClient Geter = new SnakeOnlineClient();

            User = await Geter.GetNameAsync(Token);

            if (User == null)
            {
                throw new ArgumentException("No access to server");
            }
        }
Exemplo n.º 2
0
        public async void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            string            Token  = txtToken.Text;
            SnakeOnlineClient Getter = new SnakeOnlineClient();
            string            resp   = await Getter.GetNameAsync(Token);

            if (resp == "Unauthorized") // Check if token exists
            {
                MessageBox.Show("Invalid Token");
            }
            else
            {
                MainWindow main = new MainWindow(Token);
                App.Current.MainWindow = main;
                this.Close();
                main.Show();
            }
        }