示例#1
0
        private void ImgButton_Click(object sender, RoutedEventArgs e)
        {
            var userName = txt_userName.Text;
            var userPwd  = txt_pwd.Password;

            if (string.IsNullOrEmpty(userName))
            {
                MessageBoxEx.ShowInfo("用户名不能为空!");
                return;
            }
            if (string.IsNullOrEmpty(userName))
            {
                MessageBoxEx.ShowInfo("密码不能为空!");
                return;
            }

            WaitingWinBox.ShowDialog(new Action(() =>
            {
                var orgList = ivmViewModel.GetDeviceTreeList(userName, userPwd, 1);
                if (!"200".Equals(orgList.ErrorCode))
                {
                    Dispatcher.BeginInvoke(new Action(() =>
                    {
                        MessageBoxEx.ShowError(orgList.Message);
                    }));
                    return;
                }
                DeviceTreeList = orgList.Data;
            }), "获取组织机构...");
        }
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     WaitingWinBox.ShowDialog(new Action(() =>
     {
         Thread.Sleep(5000);
     }));
 }
示例#3
0
        private void btn_login_Click(object sender, RoutedEventArgs e)
        {
            userContext.LoginPwd = txt_pwd.Password;
            //if (String.IsNullOrEmpty(userContext.LoginName))
            //{
            //    MessageBoxEx.ShowInfo("请输入用户名!");
            //    return;
            //}
            //if (String.IsNullOrEmpty(userContext.LoginPwd))
            //{
            //    MessageBoxEx.ShowInfo("请输入密码!");
            //    return;
            //}
            //if (String.IsNullOrEmpty(txt_hostIP.SelectedItem.ToString()))
            //{
            //    MessageBoxEx.ShowInfo("请输入本机IP!");
            //    return;
            //}
            //if (String.IsNullOrEmpty(userContext.ServerIP))
            //{
            //    MessageBoxEx.ShowInfo("请输入服务器IP!");
            //    return;
            //}

            WaitingWinBox.ShowDialog(new Action(() =>
            {
                //Thread.Sleep(TimeSpan.FromSeconds(1));
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    //登录成功后,保存用户信息
                    XMLHelper <UserViewModel> .SerializeAndSave(userContext, xmlPath);
                    //缓存用户信息
                    SysVars.UserInfo = userContext;
                    var mainWin      = new MainWindow();
                    mainWin.Show();
                    this.Close();
                }));
            }));
        }
示例#4
0
 private void ImgButton_Click_1(object sender, RoutedEventArgs e)
 {
     try
     {
         var issueModel = new IssueViewModel();
         WaitingWinBox.ShowDialog(new Action(() =>
         {
             var result = issueModel.GetIssueList();
             if (!result.success)
             {
                 Dispatcher.BeginInvoke(new Action(() =>
                 {
                     MessageBoxEx.ShowError(result.message);
                 }));
                 return;
             }
             IssueList = result.data;
         }), "获取数据...");
     }catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }