private void LoginSystem(object logUser) { try { string msg = ""; LibraryService.UserEntity userInfo = new LibraryService.UserEntity(); bool log_result = false; LibraryService.ILibrary _service = new LibraryService.LibraryClient(); try { log_result = _service.LoginSys(out msg, out userInfo, (logUser as LibraryService.UserEntity).LoginName, (logUser as LibraryService.UserEntity).Pwd); } catch (Exception ex) { msg = "无法连接服务器!"; } this.Dispatcher.BeginInvoke((Action) delegate() { loginBtn.Content = "登录"; if (log_result) { CommonConfig.Current.LoginUserInfo = userInfo; this.DialogResult = true; this.Close(); } else { label_msg.Content = msg; return; } }); } catch (Exception ex) { } }
/// <summary> /// 点击图标按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void imgBtnCheck(object sender, MouseButtonEventArgs e) { //先还原所有按钮的背景色 Color unChecekdColor = Color.FromRgb(220, 25, 25); btnLibrary.Background = new SolidColorBrush(unChecekdColor); btnBookShell.Background = new SolidColorBrush(unChecekdColor); //设置选中背景色 Color checekdColor = Color.FromRgb(164, 12, 12); (sender as Grid).Background = new SolidColorBrush(checekdColor); LibraryService.ILibrary _service = new LibraryService.LibraryClient(); LibraryService.ResEntity[] resList = _service.ResPagerList(1, 30, null, null); this.DataContext = new MainViewModel(resList); //mainContent.Content = new ListBox(); //leftContent.Content = new LeftView(); //MessageBox.Show((sender as Grid).Tag.ToString()); }