コード例 #1
0
        private void OnLogin(object sender, RoutedEventArgs e)
        {
            //触发验证
            ValidationToolkit toolkit = new ValidationToolkit(this);
            if (toolkit.Validate() == false)
            {
                toolkit.ReportError(this);
                return;
            }

            InvokeUtils.ThreadProc(this, () =>
            {
                WaittingDialog.Show(this);
                if (SilverlightTest.UserClient.Login(_model.Username, _model.Password) == false)
                {

                    MsgBox.Error(this, "用户名,密码错误");
                    return;
                }

                InvokeUtils.SyncInvoke(this, () =>
                {
                     this.Content = new Menu(_model.Username);
                });
            });
        }
コード例 #2
0
        private void OnCommit(object sender, RoutedEventArgs e)
        {
            EditEmployee();
            ValidationToolkit toolkit = new ValidationToolkit(this);
            if (toolkit.Validate() == false)
            {
                return;
            }

            if (this.Tag.ToString() == "add")
            {
                InvokeUtils.ThreadProc(this, () =>
                {
                    WaittingDialog.Show(this);
                    Models.EmployeeInfo.Add(_modle);
                    InvokeUtils.SyncInvoke(this, () =>
                    {
                        this.DialogResult = true;
                        this.Close();
                    });
                });
            }
            else
            {
                InvokeUtils.ThreadProc(this, () =>
                {
                    WaittingDialog.Show(this);
                    Models.EmployeeInfo.Modify(_modle);
                    InvokeUtils.SyncInvoke(this, () =>
                    {
                        this.DialogResult = true;
                        this.Close();
                    });
                });
            }
        }