Beispiel #1
0
 private void ButtonLogin_Click(object sender, RoutedEventArgs e)
 {
     user.Passwd = passwd_box.Password;
     if (!_userService.IsExistUserWithThisLogin(user.Login))
     {
         MessageBox.Show("User not found!", "LogIn", MessageBoxButton.OK, MessageBoxImage.Error);
     }
     else
     {
         if (!_userService.IsExistsUserByLoginAndPassword(user.Login, user.Passwd))
         {
             MessageBox.Show("Wrong password", "LogIn", MessageBoxButton.OK, MessageBoxImage.Error);
         }
         else
         {
             user = _userService.GetUserByLoginAndPassword(user.Login, user.Passwd);
             var usertype = new BLLClass().GetUserType(user);
             if (usertype.Name == "Admin")
             {
                 AdminWindow adminWindow = new AdminWindow();
                 adminWindow.Show();
                 this.Close();
             }
             else
             {
                 UserWindow userWindow = new UserWindow(user);
                 userWindow.Show();
                 this.Close();
             }
             //open menu
         }
     }
 }
 void userListBox_DoubleClick(object sender, EventArgs e)
 {
     if (userListBox.SelectedItem != null)
     {
         UserWindow window = new UserWindow((User)userListBox.SelectedItem);
         //window.user = (User)userListBox.SelectedItem;
         this.Hide();
         window.Show();
     }
 }
Beispiel #3
0
        /// <summary>
        /// 编辑用户
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddUser()
        {
            //var ocr = new TesseractEngine("./tessdata", "eng", EngineMode.TesseractAndCube);
            //ocr.get
            //Test();
            //var  dm = new dmsoft();
            //var parent = dm.FindWindow("Chrome_WidgetWin_1", null);
            //var hwnd = dm.FindWindowEx(parent, "Chrome_WidgetWin_1", null);
            ////MessageBox.Show(hwnd + "");
            //dm.SetWindowText(parent, "hello");
            //dm.SendString(hwnd, "hello world");
            //dm.KeyPress(50);
            var win = new UserWindow(this);

            win.ShowDialog();
        }