Beispiel #1
0
        public MainWindow()
        {
            InitializeComponent();
            string token = MisoraCore.LoadToken();

            if (!string.IsNullOrWhiteSpace(token))
            {
                tokenBox.Text = token;
                LoginButton_Click(null, null);
            }
        }
Beispiel #2
0
        private async void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            if (_isLoggedIn)
            {
                await MisoraCore.Logout();

                tokenBox.IsEnabled  = true;
                LoginButton.Content = "Login";
            }
            else
            {
                if (_isLoggedIn = await MisoraCore.Login(tokenBox.Text))
                {
                    tokenBox.IsEnabled  = false;
                    LoginButton.Content = "Logout";
                }
                else
                {
                    MessageBox.Show("Login Failed", "Error");
                }
            }
        }