using KGIS.Framework.Utils; using Kingo.PluginServiceInterface; using Kingo.PluginServiceInterface.Helper; using System; using System.IO; using System.Windows; namespace Kingo.DataDTBJK { /// /// UCUserLogin.xaml 的交互逻辑 /// public partial class UCUserLogin : Window { public UCUserLogin() { InitializeComponent(); } private void btnCancel_Click(object sender, System.Windows.Input.MouseButtonEventArgs e) { this.Close(); } private void BtnLogin_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { try { if (string.IsNullOrEmpty(txtUser.Text.Trim())) { MessageBox.Show("用户名为空。", "提示信息", MessageBoxButton.OK); return; } if (string.IsNullOrEmpty(txtPassword.Password.Trim())) { MessageBox.Show("密码为空。", "提示信息", MessageBoxButton.OK); return; } IUserLogin uLogin = new UserLoginHelper(); if (uLogin.UserLogin(txtUser.Text.Trim(), txtPassword.Password.Trim())) { //设置下次不再登录 CommonHelper.UpdateAppsettingValueByKey("IsNeedLogin", "false", "SystemConfig"); CommonHelper.DelectDir(Path.Combine(SysAppPath.GetCurrentAppPath(), "DTBProject")); this.DialogResult = true; return; } else { MessageBox.Show("用户名或密码不正确。", "提示信息", MessageBoxButton.OK); return; } } catch (Exception ex) { LogAPI.Debug(ex.Message); LogAPI.Debug(ex.StackTrace); } } private void TxtPassword_PasswordChanged(object sender, RoutedEventArgs e) { try { if (string.IsNullOrWhiteSpace(txtPassword.Password)) { txtPwd.Visibility = Visibility.Visible; } else { txtPwd.Visibility = Visibility.Collapsed; } } catch (Exception) { } } } }