示例#1
0
 private void RegistarionPage_Cliclk(object sender, RoutedEventArgs e)
 {
     LoginBoxAuth.Clear();
     PasswordBoxAuth.Clear();
     MainFrame.Visibility = Visibility.Visible;
     MainFrame.Navigate(new Uri("/Pages/RegistrationPage.xaml", UriKind.Relative));
 }
示例#2
0
        private async void Authorization_Click(object sender, RoutedEventArgs e)
        {
            Workspace workspace = new Workspace();
            var       auth      = new Auth(LoginBoxAuth.Text, PasswordBoxAuth.Password);
            var       role      = await auth.SearchUserRoleAsync();

            switch (role)
            {
            case 1:
                workspace.WorkspaceFrame.NavigationService.Navigate(new Uri("/Pages/BuyerPage.xaml", UriKind.Relative));
                OpenWorkspace(workspace);
                break;

            case 2:
                workspace.WorkspaceFrame.NavigationService.Navigate(new Uri("/Pages/AdminPage.xaml", UriKind.Relative));
                OpenWorkspace(workspace);
                break;

            default:
                MessageBox.Show("Пользователь не найден.\nПоробуйте снова.", "Ошибка!", MessageBoxButton.OK, MessageBoxImage.Error);
                LoginBoxAuth.Clear();
                PasswordBoxAuth.Clear();
                break;
            }
        }
示例#3
0
 /// <summary>
 ///     Событие при закритии окна с товарами.
 /// </summary>
 /// <param name="window">Окно.</param>
 private void ClosedWindow(Window window)
 {
     window.Closed += (object s, EventArgs args) =>
     {
         MessageBox.Show("До свидания!", "Выход", MessageBoxButton.OK, MessageBoxImage.Information);
         this.Show();
         LoginBoxAuth.Clear();
         PasswordBoxAuth.Clear();
     };
 }