/// <summary> /// showLoginLocationSelect /// </summary> /// <param name="viewParam"></param> private void showLoginLocationSelect(OpenNewViewParam viewParam) { if (viewParam == null) { return; } // OpenNewView targetView = new OpenNewView(viewParam.NewViewType); // LoginLocationSelectUIViewModel loginLocSelectVM = targetView.GetViewDataContext <LoginLocationSelectUIViewModel>(); if (loginLocSelectVM != null) { loginLocSelectVM.LoginType = viewParam.ParamValueFromCurrentView as string; } // if (targetView.ShowDialog(viewParam.CurrentView) == true) { // LoginLocationCode = loginLocSelectVM.SelectedUserAccess.LocationCode; // LoginLocationType = loginLocSelectVM.SelectedUserAccess.ShopNature; // Global.CurrentLoginCompanyCode = loginLocSelectVM.SelectedUserAccess.CompanyCode; } }
/// <summary> /// loginBtnClick /// </summary> /// <param name="viewParam"></param> private void loginBtnClick(OpenNewViewParam viewParam) { MainWindow m = new MainWindow(); m.ShowDialog(); return; //var v = DialogParticipation.GetRegister(viewParam.CurrentView); //FooMessage();// FooProgress(); (viewParam.CurrentView as MahApps.Metro.Controls.MetroWindow).ShowDialogsOverTitleBar = false; (viewParam.CurrentView as MahApps.Metro.Controls.MetroWindow).ShowOverlayAsync(); return; if (viewParam == null) { return; } // try { OpenNewView targetView = new OpenNewView(viewParam.NewViewType); targetView.Show(); } catch (Exception ex) { WindowUI.NlogHelper.LogToFile(ex.ToString()); return; } // if (viewParam.CurrentView != null) { viewParam.CurrentView.Close(); } }
/// <summary> /// loginBtnClick /// </summary> /// <param name="viewParam"></param> private void loginBtnClick(OpenNewViewParam viewParam) { if (viewParam == null) { return; } // try { //var v=(System.Security.SecureString)(viewParam.NewViewInitValue); //IntPtr p = System.Runtime.InteropServices.Marshal.SecureStringToBSTR(v); //// 使用.NET内部算法把IntPtr指向处的字符集合转换成字符串 //string password = System.Runtime.InteropServices.Marshal.PtrToStringBSTR(p); string password = ""; System.Windows.Controls.PasswordBox pwdBox = viewParam.ParamValueFromCurrentView as System.Windows.Controls.PasswordBox; if (pwdBox != null) { password = pwdBox.Password; } // if ((this.userCode ?? "").Trim().Length == 0) { MessageBox.Show("用户名不能空白!"); //ModernDialog.ShowMessage("用户名不能空白!", "notice", System.Windows.MessageBoxButton.OK, viewParam.CurrentView); return; } // if ((this.LoginLocationCode ?? "").Trim().Length == 0 || (this.LoginLocationType ?? "").Trim().Length == 0) { MessageBox.Show("请选择登录店铺位置!"); //ModernDialog.ShowMessage("请选择登录店铺位置!", "notice", System.Windows.MessageBoxButton.OK, viewParam.CurrentView); return; } //check user UserObject userobj = RemoteApi.UserLogin(this.userCode, password); if (userobj == null || !string.Equals(userobj.UserCode, this.userCode, StringComparison.OrdinalIgnoreCase))//说明不成功 { MessageBox.Show("登录失败,请检查用户名和密码是否正确!"); //ModernDialog.ShowMessage("登录失败,请检查用户名和密码是否正确!", "notice", System.Windows.MessageBoxButton.OK, viewParam.CurrentView); return; } //说明成功,记录数据 OpenNewView newView = new OpenNewView(viewParam.NewViewType); newView.Show(); } catch (Exception ex) { CoreLibrary.NlogHelper.LogToFile(ex.ToString()); return; } // if (viewParam.CurrentView != null) { //viewParam.CurrentView.Close(); } }