private void btnTools_Click(object sender, RoutedEventArgs e) { try { ToogleButton(btnTools); ucToolsPreview oucToolsPreview = new ucToolsPreview(); mainGrid.Children.Clear(); mainGrid.Children.Add(oucToolsPreview); } catch (Exception) { MessageBox.Show("Can not load all tools data"); } }
private void btnLogIn_Click(object sender, RoutedEventArgs e) { try { //txtUserName.Text = "Admin"; //pwbPassword.Password = "******"; List <User> oUserList = App.oAllUser; var currentUser = from oUser in oUserList where oUser.UserId == txtUserName.Text select oUser; if (currentUser.Count <User>() == 0) { txtErrorMsg.Text = "Invalid UserID or password"; } else { User oUser = (User)currentUser.First <User>(); if (oUser.Password == pwbPassword.Password) { App.currentUser = oUser; /// login verify logic goes here /// App.grdMain.Children.Clear(); App.menus.Visibility = Visibility.Visible; App.grdLeft.Visibility = Visibility.Visible; App.mainWindow.SizeToContent = SizeToContent.Manual; App.mainWindow.WindowStyle = WindowStyle.ThreeDBorderWindow; App.mainWindow.WindowState = WindowState.Maximized; ucToolsPreview oucToolsPreview = new ucToolsPreview(); App.grdMain.Children.Add(oucToolsPreview); } else { txtErrorMsg.Text = "Invalid UserID or password"; } } } catch (Exception) { MessageBox.Show("Can not Login now."); } }
private void btnLogIn_Click(object sender, RoutedEventArgs e) { try { //txtUserName.Text = "Admin"; //pwbPassword.Password = "******"; List<User> oUserList = App.oAllUser; var currentUser = from oUser in oUserList where oUser.UserId == txtUserName.Text select oUser; if (currentUser.Count<User>() == 0) { txtErrorMsg.Text = "Invalid UserID or password"; } else { User oUser = (User)currentUser.First<User>(); if (oUser.Password == pwbPassword.Password) { App.currentUser = oUser; /// login verify logic goes here /// App.grdMain.Children.Clear(); App.menus.Visibility = Visibility.Visible; App.grdLeft.Visibility = Visibility.Visible; App.mainWindow.SizeToContent = SizeToContent.Manual; App.mainWindow.WindowStyle = WindowStyle.ThreeDBorderWindow; App.mainWindow.WindowState = WindowState.Maximized; ucToolsPreview oucToolsPreview = new ucToolsPreview(); App.grdMain.Children.Add(oucToolsPreview); } else { txtErrorMsg.Text = "Invalid UserID or password"; } } } catch (Exception) { MessageBox.Show("Can not Login now."); } }