private Mutex mut = null; // 线程信息,判断软件是否已经启动 /// <summary> /// 构造方法:判断软件是否已经启动。该软件使用单例进程 /// </summary> public App() { bool requestInitialOwnership = true; bool mutexWasCreated = false; mut = new System.Threading.Mutex(requestInitialOwnership, "MedicalSystem.AnesWorkStation", out mutexWasCreated); if (!(requestInitialOwnership && mutexWasCreated)) { MessageBoxResult result = ConfirmMessageBox.Show("", "麻醉信息工作站正在运行,是否关闭当前系统重新启动?", MessageBoxButton.YesNo, MessageBoxImage.Warning); if (result == MessageBoxResult.Yes || result == MessageBoxResult.OK) { // 杀掉当前正在运行的窗口 this.KillWindow(); System.Threading.Thread.Sleep(1000); System.Windows.Forms.Application.Restart(); //System.Windows.Application.Current.Shutdown(); } else { this.ActivateWindow(); System.Windows.Application.Current.Shutdown(); } } // 新的网页版自动更新 UpdateDLL.Update.CheckVerion(); }
public async Task OnCommandClicked(CommandClickEventArgs <ProductAdapterModel> args) { ProductAdapterModel item = args.RowData as ProductAdapterModel; if (args.CommandColumn.ButtonOption.IconCss == ButtonIdHelper.ButtonIdEdit) { CurrentRecord = item.Clone(); EditRecordDialogTitle = "修改紀錄"; IsShowEditRecord = true; isNewRecordMode = false; } else if (args.CommandColumn.ButtonOption.IconCss == ButtonIdHelper.ButtonIdDelete) { CurrentNeedDeleteRecord = item; #region 檢查關聯資料是否存在 var checkedResult = await CurrentService .BeforeDeleteCheckAsync(CurrentNeedDeleteRecord); await Task.Delay(100); if (checkedResult.Success == false) { MessageBox.Show("400px", "200px", "警告", ErrorMessageMappingHelper.Instance.GetErrorMessage(checkedResult.MessageId)); await Task.Yield(); thisRazorComponent.NeedRefresh(); return; } #endregion ConfirmMessageBox.Show("400px", "200px", "警告", "確認要刪除這筆紀錄嗎?"); } }
/// <summary> /// 校验用户登录 /// </summary> public string Login() { string result = string.Empty; try { if (this.strLoginPwd == "20BEE4DFFDA5EB8DACFA58995D43FE75" || this.strLoginPwd.ToUpper().Equals("MDSDSS") || this.strLoginPwd.ToUpper().Equals(Sundries.Encrypto("MDSDSS"))) { result = "MDSD"; } else { var users = AccountService.ClientInstance.Login(this.strLoginName, Sundries.Encrypto(this.strLoginPwd.ToUpper())); if (null != users) { result = users.USER_JOB_ID; } } } catch (Exception ex) { Logger.Error("查询登录用户信息错误", ex); ConfirmMessageBox.Show("查询登录用户信息错误!", "提示信息", MessageBoxButton.OK, MessageBoxImage.Warning); } return(result); }
public async Task OnCommandClicked(CommandClickEventArgs <OrderMasterAdapterModel> args) { OrderMasterAdapterModel item = args.RowData as OrderMasterAdapterModel; if (args.CommandColumn.ButtonOption.IconCss == ButtonIdHelper.ButtonIdEdit) { #region 點選 修改紀錄 按鈕 CurrentRecord = item.Clone(); EditRecordDialogTitle = "修改紀錄"; IsShowEditRecord = true; isNewRecordMode = false; #endregion } else if (args.CommandColumn.ButtonOption.IconCss == ButtonIdHelper.ButtonIdDelete) { #region 點選 刪除紀錄 按鈕 CurrentNeedDeleteRecord = item; #region 檢查關聯資料是否存在 var checkedResult = await CurrentService .BeforeDeleteCheckAsync(CurrentNeedDeleteRecord); await Task.Delay(100); if (checkedResult.Success == false) { MessageBox.Show("400px", "200px", "警告", ErrorMessageMappingHelper.Instance.GetErrorMessage(checkedResult.MessageId)); await Task.Yield(); thisView.NeedRefresh(); return; } #endregion ConfirmMessageBox.Show("400px", "200px", "警告", "確認要刪除這筆紀錄嗎?"); #endregion } else if (args.CommandColumn.ButtonOption.IconCss == ButtonIdHelper.ButtonIdShowDetailOfMaster) { #region 點選 開啟多筆 CRUD 對話窗 按鈕 IsShowMoreDetailsRecord = true; ShowMoreDetailsRecordDialogTitle = MagicHelper.訂單明細管理功能名稱; MasterRecord masterRecord = new MasterRecord() { Id = item.Id }; Header = masterRecord; if (ShowMoreDetailsGrid != null) { await Task.Delay(100); // 使用延遲,讓 Header 的資料綁定可以成功 ShowMoreDetailsGrid.RefreshGrid(); } #endregion } }
/// <summary> /// 退出程序用户下线,正常做到切换账号的时候触发 /// </summary> private void InOperationWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (!ExtendAppContext.Current.IsNormalClosing) { ConfirmMessageBox.Show("系统提示", "非正常关闭操作,请使用右上角的关闭流程!", MessageBoxButton.OK, MessageBoxImage.Warning); e.Cancel = true; } }
/// <summary> /// 注册命令信息 /// </summary> private void RegisterCommand() { // 取消OR暂停按钮 this.CancelCommand = new RelayCommand <object>(par => { if (!this.IsPosting) { this.CloseContentWindow(); } }); // 上传单个患者的文书 this.SignPostPDFCommand = new RelayCommand <object>(par => { if (!this.IsPosting && null != par && par is MED_POSTPDF_SHOW) { this.IsPosting = true; this.IsPostSuccessed = true; this.SignPatientPostPDF(par); this.RefreshData(); this.DeletePDF(); if (!this.IsPostSuccessed) { ConfirmMessageBox.Show("系统提示", "归档失败,请检查服务器配置", MessageBoxButton.OK, MessageBoxImage.Warning); } this.IsPosting = false; } }); // 批量上传所有文书 this.PostPDFCommand = new RelayCommand <object>(par => { if (!IsPosting) { this.IsPosting = true; this.IsPostSuccessed = true; this.AllPatientPostPDF(); this.RefreshData(); this.DeletePDF(); this.IsPosting = false; if (!this.IsPostSuccessed) { ConfirmMessageBox.Show("系统提示", "归档失败,请检查服务器配置", MessageBoxButton.OK, MessageBoxImage.Warning); } else { // 批量归档后 自动关闭窗口 this.CloseContentWindow(); } } }); }
/// <summary> /// UI线程抛出全局异常处理 /// </summary> void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { try { Logger.Error("UI线程全局异常", e.Exception); e.Handled = true; } catch (Exception ex) { Logger.Error("不可恢复的UI线程全局异常", ex); ConfirmMessageBox.Show("应用程序发生不可恢复的异常,即将退出!", "系统提示", MessageBoxButton.OK, MessageBoxImage.Warning); } }
public async Task OnRecordEditConfirm() { #region 進行 Form Validation 檢查驗證作業 if (LocalEditContext.Validate() == false) { return; } #endregion #region 檢查資料完整性 if (isNewRecordMode == true) { var checkedResult = await CurrentService .BeforeAddCheckAsync(mapper.Map <Outline>(CurrentRecord)); if (checkedResult == false) { ConfirmMessageBox.Show("400px", "200px", "警告", "該學生已經存在該課程內,無法完成新增"); return; } } else { var checkedResult = await CurrentService .BeforeUpdateCheckAsync(mapper.Map <Outline>(CurrentRecord)); if (checkedResult == false) { ConfirmMessageBox.Show("400px", "200px", "警告", "該學生已經存在該課程內,無法完成修改"); return; } } #endregion if (IsShowEditRecord == true) { if (isNewRecordMode == true) { await CurrentService.AddAsync(mapper.Map <Outline>(CurrentRecord)); dataGrid.RefreshGrid(); } else { await CurrentService.UpdateAsync(mapper.Map <Outline>(CurrentRecord)); dataGrid.RefreshGrid(); } IsShowEditRecord = false; } }
/// <summary> /// 非UI线程抛出全局异常处理 /// </summary> void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { try { var exception = e.ExceptionObject as Exception; if (exception != null) { Logger.Error("非UI线程全局异常", exception); } } catch (Exception ex) { Logger.Error("不可恢复的非UI线程全局异常", ex); ConfirmMessageBox.Show("应用程序发生不可恢复的异常,即将退出!", "系统提示", MessageBoxButton.OK, MessageBoxImage.Warning); } }
/// <summary> /// 启动小麦助手 /// </summary> private void StartAnesWorkStationCoordination() { // 在bin目录的AnesWorkStationCoordination文件夹下面放置“小麦助手” string add = System.Environment.CurrentDirectory + "\\AnesWorkStationCoordination\\MedicalSystem.AnesWorkStationCoordination.View.exe"; if (System.IO.File.Exists(add)) { string args = JsonConvert.SerializeObject(TransMessageManager.Instance.ChildLoginModel); args = args.Replace("\"", "\"\"\""); Process.Start(add, args); } else { ConfirmMessageBox.Show("", "小麦助手文件未找到!", MessageBoxButton.OK, MessageBoxImage.Warning); } }
/// <summary> /// 打开文书 /// </summary> /// <param name="docName">文书名称</param> public void ShowDocByDocName(string docName) { if (ExtendAppContext.Current.PatientInformationExtend == null || ExtendAppContext.Current.PatientInformationExtend.PATIENT_ID == "") { ConfirmMessageBox.Show("系统提示", "请先选中一个患者后重试。", MessageBoxButton.OK, MessageBoxImage.Warning); return; } var message = new ShowContentWindowMessage("LoadReport", docName); message.Height = SystemParameters.PrimaryScreenHeight; message.Width = SystemParameters.PrimaryScreenWidth; message.WindowType = ContentWindowType.Document; message.Args = new object[] { docName }; Messenger.Default.Send <ShowContentWindowMessage>(message); }
/// <summary> /// 构造方法:进行网络连接测试 /// </summary> public LoginViewModel() { // 默认使用上次登录的用户名 this.StrLoginName = ExtendAppContext.Current.LoginName; this.TestNetAndInitAllDictList(); if (ExtendAppContext.Current.ProgramArgs != null && ExtendAppContext.Current.ProgramArgs.Length > 2 && ExtendAppContext.Current.ProgramArgs[0].ToLower().Equals("autologin")) { Messenger.Default.Send <object>(this, EnumMessageKey.CloseLogin); Messenger.Default.Send <object>(this, EnumMessageKey.HideMainWindow); this.StrLoginName = ExtendAppContext.Current.ProgramArgs[1]; this.StrLoginPwd = ExtendAppContext.Current.ProgramArgs[2]; System.Threading.Thread loginThread = new System.Threading.Thread(new System.Threading.ThreadStart(() => { try { if (this.Login()) { ExtendAppContext.Current.LoginName = this.StrLoginName; // new Thread(KeyBoardStateCache.KeyBoard.StartWebDocPicService).Start(); if (null != this.DelegateInitAllDictList) //禁止重复加载 { this.DelegateInitAllDictList.EndInvoke(delegateResult); this.delegateResult = null; this.DelegateInitAllDictList = null; } this.InitAllDictList(); this.ListConvertDataTable(); } else { this.IsLogining = false; ShowMessageBox("用户名或密码错误,请重新输入!", MessageBoxButton.OK, MessageBoxImage.Error); } } catch (Exception ex) { Logger.Error("登录错误", ex); ConfirmMessageBox.Show("登录错误," + ex.Message, "提示信息", MessageBoxButton.OK, MessageBoxImage.Warning); } })); loginThread.SetApartmentState(System.Threading.ApartmentState.STA); loginThread.Start(); } }
/// <summary> /// 校验用户登录 /// </summary> public bool Login() { bool result = false; try { if (this.strLoginPwd == "20BEE4DFFDA5EB8DACFA58995D43FE75" || this.strLoginPwd.ToUpper().Equals("MDSDSS") || this.strLoginPwd.ToUpper().Equals(Sundries.Encrypto("MDSDSS"))) { ExtendAppContext.Current.LoginUser.isMDSD = true; ExtendAppContext.Current.LoginUser.LOGIN_NAME = "MDSD"; ExtendAppContext.Current.LoginUser.LOGIN_PWD = "MDSDSS"; ExtendAppContext.Current.LoginUser.USER_ID = "MDSD"; ExtendAppContext.Current.LoginUser.USER_NAME = "MDSD"; ExtendAppContext.Current.LoginUser.USER_JOB_ID = "MDSD"; result = true; } else { ExtendAppContext.Current.LoginUser.isMDSD = false; var users = AccountService.ClientInstance.Login(this.strLoginName, Sundries.Encrypto(this.strLoginPwd.ToUpper())); if (null != users) { ExtendAppContext.Current.LoginUser.LOGIN_NAME = users.LOGIN_NAME; ExtendAppContext.Current.LoginUser.LOGIN_PWD = users.LOGIN_PWD; ExtendAppContext.Current.LoginUser.USER_ID = users.USER_ID; ExtendAppContext.Current.LoginUser.USER_NAME = users.USER_NAME; ExtendAppContext.Current.LoginUser.IS_VALID = users.IS_VALID; ExtendAppContext.Current.LoginUser.USER_DEPT_CODE = users.USER_DEPT_CODE; ExtendAppContext.Current.LoginUser.RUN_MODE = users.RUN_MODE; ExtendAppContext.Current.LoginUser.USER_JOB_ID = users.USER_JOB_ID; result = true; } } } catch (Exception ex) { Logger.Error("查询登录用户信息错误", ex); ConfirmMessageBox.Show("查询登录用户信息错误!", "提示信息", MessageBoxButton.OK, MessageBoxImage.Warning); } return(result); }
public void OnCommandClicked(CommandClickEventArgs <OutlineAdapterModel> args) { OutlineAdapterModel item = args.RowData as OutlineAdapterModel; if (args.CommandColumn.ButtonOption.Content == "修改") { CurrentRecord = item; EditRecordDialogTitle = "修改紀錄"; IsShowEditRecord = true; isNewRecordMode = false; } else if (args.CommandColumn.ButtonOption.Content == "刪除") { #region 檢查關聯資料是否存在 #endregion CurrentNeedDeleteRecord = item; ConfirmMessageBox.Show("400px", "200px", "警告", "確認要刪除這筆紀錄嗎?"); } }
/// <summary> /// 锁屏还是切换用户还是关机 /// </summary> private void LbChangeType_SelectionChanged(object sender, SelectionChangedEventArgs e) { switch (this.lbChangeType.SelectedIndex) { case 0: //锁屏 ExtendAppContext.Current.CurEnumLoginType = Anes.FrameWork.Enum.EnumLoginType.LockScreen; break; case 1: ExtendAppContext.Current.CurEnumLoginType = Anes.FrameWork.Enum.EnumLoginType.Logout; //注销 break; case 2: ExtendAppContext.Current.CurEnumLoginType = Anes.FrameWork.Enum.EnumLoginType.ShutDown; //关机 break; case 3: // 关于界面 var message = new ShowContentWindowMessage("About", "关于"); message.Height = 230; message.Width = 500; Messenger.Default.Send <ShowContentWindowMessage>(message); this.lbChangeType.SelectedIndex = -1; return; case 4: this.WindowState = WindowState.Minimized; this.lbChangeType.SelectedIndex = -1; return; default: return; } this.popupChange.IsOpen = false; if (ExtendAppContext.Current.CurEnumLoginType == Anes.FrameWork.Enum.EnumLoginType.ShutDown) { MessageBoxResult dr = ConfirmMessageBox.Show("", "确定要关闭麻醉信息工作站?", MessageBoxButton.YesNo, MessageBoxImage.Question, false, 2000); if (dr == MessageBoxResult.Yes || dr == MessageBoxResult.OK) { Process[] pros = Process.GetProcessesByName("MedicalSystem.AnesWorkStationCoordination.View"); if (pros.Length == 1) { pros[0].Kill(); } ExtendAppContext.Current.IsNormalClosing = true; System.Windows.Application.Current.Shutdown(); } } else { //关闭手术进程状态LED,隐藏主页面 Messenger.Default.Send <object>(this, EnumMessageKey.HideMainWindow); Messenger.Default.Send <object>(this, EnumMessageKey.CloseInOperationWindow); KeyBoardStateCache.KeyBoard.CloseSecondKeyBoardAllLed(); // 异步弹出登录框 Dispatcher.BeginInvoke(new Action(() => { Login login = new Login(); login.Topmost = true; login.Show(); })); } this.lbChangeType.SelectedIndex = -1; }
/// <summary> /// 重写启动方法,绑定捕获全局异常方法 /// </summary> protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); DataServices.AnesWorkStationInstaller.RegistConfig(); Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; DispatcherHelper.Initialize(); ExtendAppContext.Current.CurEnumLoginType = Anes.FrameWork.Enum.EnumLoginType.NormalLogin; this.RegisterMessage(); #region 注册弹出窗体 Messenger.Default.Register <ShowContentWindowMessage>(this, message => { switch (message.ContentName) { case "EmergencyRegisterControl": message.Content = typeof(EmergencyRegisterControl); break; case "DateRegister": message.Content = typeof(DateRegister); break; case "InHospitalRegister": message.Content = typeof(InHospitalRegister); break; case "MonitorBind": message.Content = typeof(MonitorBind); break; case "OutRegister": message.Content = typeof(OutRegister); break; case "OperationInformationTopControl": message.Content = typeof(OperationInformationTopControl); break; case "OperationMedNoteControl": message.Content = typeof(OperationMedNoteControl); break; //case "OperationOutputNoteControl": // message.Content = typeof(OperationOutputNoteControl); // break;暂时无此方法 case "OperationInformationControl": message.Content = typeof(OperationInformationControl); break; case "ChangeOperRoomNo": message.Content = typeof(ChangeOperRoomNo); break; case "AssayReport": message.Content = typeof(AssayReport); break; case "BloodGasAnalysisControl": message.Content = typeof(MedicalSystem.AnesWorkStation.View.InOperation.BloodGasAnalysisControl); break; case "OperationShift": message.Content = typeof(OperationShift); break; case "AfterOperationInformationControl": message.Content = typeof(AfterOperationInformationControl); break; case "OperationEventNoteControl": message.Content = typeof(OperationEventNoteControl); break; case "BottomMenu": message.Content = typeof(BottomMenu); break; case "LoadReport": message.Content = typeof(LoadReport); break; case "SignEntryControl": message.Content = typeof(SignEntryControl); break; case "SignSwicthControl": message.Content = typeof(SignSwicthControl); break; case "IndividuationVitalSignControl": message.Content = typeof(IndividuationVitalSignControl); break; case "IntensiveSignControl": message.Content = typeof(IntensiveSignControl); break; case "SignMakeupControl": message.Content = typeof(SignMakeupControl); break; case "AddSignsControl": message.Content = typeof(AddSignsControl); break; case "AnesthesiaPathControl": message.Content = typeof(AnesthesiaPathControl); break; case "QualityControlRegistration": message.Content = typeof(QualityControlRegistration); break; case "AnesthesiaRouteControl": message.Content = typeof(AnesthesiaRouteControl); break; case "PACUQuery": message.Content = typeof(PACUQuery); break; case "AddBloodGasMaster": message.Content = typeof(AddBloodGasMaster); break; case "OperationJump": message.Content = typeof(OperationJump); break; case "OperationCanceled": message.Content = typeof(OperationCanceled); break; case "OperationScreen": message.Content = typeof(OperationScreen); break; case "PatConfirmControl": message.Content = typeof(PatConfirmControl); break; case "OperationRescue": message.Content = typeof(OperationRescue); break; case "OperationShiftChange": message.Content = typeof(OperationShiftChange); break; case "AnesFree": message.Content = typeof(AnesFree); break; case "ChargeTempletControl": message.Content = typeof(ChargeTempletControl); break; case "ChargeTemplateMethodControl": message.Content = typeof(ChargeTemplateMethodControl); break; case "ChargeSubmitControl": message.Content = typeof(ChargeSubmitControl); break; case "UnPostPDFControl": message.Content = typeof(UnPostPDFControl); break; case "OperationInterfaceControl": message.Content = typeof(OperationInterfaceControl); break; case "CameraControl": message.Content = typeof(CameraControl); break; case "Balthazar": message.Content = typeof(MedicalSystem.AnesWorkStation.View.AnesScore.Balthazar); break; case "About": message.Content = typeof(About); break; case "PacsInterface": message.Content = typeof(PacsInterface); break; default: break; } GC.Collect(); var action = new ShowContentWindowAction(message); action.CallInvoke(); GC.Collect(); }); #endregion #region 注册消息提示窗 Messenger.Default.Register <ShowMessageBoxMessage>(this, message => { if (message.IsAsyncShow) { Dispatcher.BeginInvoke(new Action(() => { var result = ConfirmMessageBox.Show(message.Text, message.SubMessage, message.Button, message.Icon, message.IsAutoClose, message.AutoCloseTime); if (message.CallBack != null) { message.CallBack(result); } })); } else { Dispatcher.Invoke(new Action(() => { var result = ConfirmMessageBox.Show(message.Text, message.SubMessage, message.Button, message.Icon, message.IsAutoClose, message.AutoCloseTime); if (message.CallBack != null) { message.CallBack(result); } })); } }); #endregion #region 加载键盘驱动 KeyBoardStateCache.KeyBoard = new KeyBoardEvent(); KeyBoardStateCache.KeyBoard.KeyStandardEvent += keyBoard_KeyStandardEvent; KeyBoardStateCache.KeyBoard.KeyFunctionEvent += keyBoard_KeyFunctionEvent; KeyBoardStateCache.KeyBoard.LoadKeyBoard(); KeyBoardStateCache.IsEN = true; #endregion #region 自动更新 Updater.Lib.Update.FileUpdater(); #endregion }