Exemplo n.º 1
0
        private bool GetError(HttpStatusCode httpStatus, bool isRequiredLogIn)
        {
            switch (httpStatus)
            {
            case HttpStatusCode.Unauthorized:
                MessageBox.Show("Your session have ended\nPlease Log In again", "Error");
                if (isRequiredLogIn)
                {
                    validateToken = false;
                    var window = new RegisterWindow();
                    window.Show();
                    Close();
                    return(false);
                }
                break;

            case HttpStatusCode.MethodNotAllowed:
                MessageBox.Show("Your security level less than required level", "Error");
                return(false);

            case HttpStatusCode.Forbidden:
                MessageBox.Show("Server do not accept this method", "Error");
                return(false);

            case HttpStatusCode.InternalServerError:
                return(false);
            }
            return(true);
        }
Exemplo n.º 2
0
 private void Logout_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var window = new RegisterWindow();
         window.Show();
         Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, ex.GetType().Name);
     }
 }