//按钮:输入训练结果 private void InputTrainingResults(object sender, RoutedEventArgs e) { InputTrainingResults inputTrainingResults = new ChildWin.InputTrainingResults { Owner = Window.GetWindow(this), ShowActivated = true, ShowInTaskbar = false, //WindowStartupLocation = WindowStartupLocation.CenterScreen }; User user = (User)UsersInfo.SelectedItem; if (user == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择用户再进行操作!", "Please Select A Subject!")); return; } if (string.IsNullOrEmpty(user.User_Phone) || string.IsNullOrEmpty(user.User_IDCard)) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("用户信息不完整!", "Subject information is incomplete!")); return; } inputTrainingResults.DataContext = user; inputTrainingResults.ShowDialog(); Refresh_RecordFrame_Action(); }
private void click1(object sender, RoutedEventArgs e) { MessageBoxX.Info("我里边的值随便写"); MessageBoxX.Error("我里边的值真随便写"); MessageBoxX.Warning("我里边的值真真随便写"); MessageBoxX.Question("我里边的值真真真随便写"); }
/// <summary> /// 打印预览功能 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Button_Click_Print_View(object sender, RoutedEventArgs e) { try { if (is_comprehensiv.IsChecked == true)//训练报告 { GenerateTrainReport(); } else if (is_detail.IsChecked == true)//详细报告 { GenerateDetailReport(); } else if (is_nurse.IsChecked == true)//看护记录报告 { GenerateNurseReport(); } else { return; } } catch (IOException ex) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("文件可能被占用,请关闭相关文件", "The file may be occupied. Please close the relevant file")); return; } catch (Exception ex) { //Console.WriteLine("生成Excel异常"); logger.Error("生成Excel异常"); return; } try { //打印 PdfViewer pDF = new PdfViewer(); if (DocumentInput_Check.IsChecked == true) { if (text_output_document.Text != "") { pDF.SaveToPath = text_output_document.Text; } } pDF.Left = 200; pDF.Top = 10; pDF.Show(); } catch (Exception ex) { //Console.WriteLine("打印界面展示异常"); logger.Error("打印界面展示异常"); } }
//按钮:更新 private void UserUpdata(object sender, RoutedEventArgs e) { // 切换用户图片的显示,解决线程占用问题 BitmapImage bitmap = new BitmapImage(new Uri(@"\view\images\NoPhoto.png", UriKind.Relative)); UserPhoto.Source = bitmap; //检查是否选中 if ((User)UsersInfo.SelectedItem == null) //if (selectUser == null)//4.7 lzh { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择用户再进行操作!", "Please Select A Subject!")); // MessageBox.Show(LanguageUtils.ConvertLanguage("请选择用户再进行操作!", "Please Select A Subject!")); return; } UserUpdata userUpdata = new UserUpdata { Owner = Window.GetWindow(this), ShowActivated = true, ShowInTaskbar = false, WindowStartupLocation = WindowStartupLocation.CenterScreen }; //类中使用 User user = (User)UsersInfo.SelectedItem; userUpdata.SelectUser = user; //UI中使用 userUpdata.selectUser.DataContext = user; //Console.WriteLine("123123: " + user.User_Privateinfo); userUpdata.noPublicInfoText.Text = user.User_Privateinfo; //Console.WriteLine("123123aaaaa: " + userUpdata.noPublicInfoText.Text); userUpdata.ShowDialog(); //关闭后刷新界面 users = userService.GetAllUsers(); UsersInfo.ItemsSource = users; // 加载用户头像 string photoUrl = CommUtil.GetUserPic() + selectUser.User_PhotoLocation; if (selectUser.User_PhotoLocation != null) { try { BitmapImage b = new BitmapImage(new Uri(photoUrl, UriKind.Absolute)); //打开图片 UserPhoto.Source = b.Clone(); //将控件和图片绑定 } catch (Exception ee) { } } //更新之后,刷新左下角 Refresh_RecordFrame_Action(); }
private void NavigationService_LoadCompleted(object sender, NavigationEventArgs e) { if (e.ExtraData != null) { // Do something here... // System.Windows.MessageBox.Show(this,string.Format("Capture Page Skip Message:{0}",e.ExtraData),"Capture",MessageBoxButton.OK,MessageBoxImage.Information,MessageBoxResult.OK); MessageBoxX.Info(string.Format("Capture Page Skip Message:{0}", e.ExtraData)); MessageBoxX.Error(string.Format("Capture Page Skip Message:{0}", e.ExtraData)); MessageBoxX.Warning(string.Format("Capture Page Skip Message:{0}", e.ExtraData)); MessageBoxX.Question(string.Format("Capture Page Skip Message:{0}", e.ExtraData)); } }
//结束时间 private void end_date_SelectedDateChanged(object sender, SelectionChangedEventArgs e) { //时间范围 - 开始时间 DateTime endTime = Convert.ToDateTime(end_date.Text); DateTime?startTime = getDateByStr(start_date.Text); if (startTime != null) { if (DateTime.Compare(endTime, (DateTime)startTime) < 0) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("终止时间不能小于起始时间", "The termination time cannot be less than the start time")); } } datalist.DataContext = listBeansByStartToEndTime(startTime, endTime); }
/// <summary> /// 定时任务的回调方法 /// </summary> /// <param name="state"></param> public void ReissueThreeTimes(Object state) { if (times < 3 && !isReceive) { byte[] send = (byte[])state; if (serialPort != null) { if (!serialPort.IsOpen) { try { serialPort.Open(); } catch (UnauthorizedAccessException ex) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("串口被占用", "Serial port is occupied")); return; } catch (IOException ex) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("串口不存在", "Serial port does not exist")); return; } } serialPort.Write(send, 0, send.Length); } times++; } else if (times >= 3 && !isReceive) { threadTimer.Dispose(); //关闭串口 SerialPortUtil.ClosePort(ref serialPort); Dispatcher.Invoke(new Action(() => { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("设备长时间未应答,请查看是否选对串口,或设备未启动", "The device has not answered for a long time. Check whether the serial port is selected or the device is not started.")); this.Close(); })); } else { threadTimer.Dispose(); } }
private void ButtonBase_OnClick(object sender, RoutedEventArgs e) { Object o = record.Content; User user = (User)UsersInfo.SelectedItem; if (user == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择用户再进行操作!", "Please Select A Subject!")); return; } if (is_signinformationrecord.IsChecked == false || record.Content == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择症状信息再进行操作!", "Please Select A Symptom Info!")); return; } DataGrid dataGrid = ((SignInformationRecord_Frame)record.Content).SignInformationRecord; SymptomInfoDTO symptomInfoDto = (SymptomInfoDTO)dataGrid.SelectedItem; if (symptomInfoDto == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择症状信息再进行操作!", "Please Select A Symptom Info!")); return; } UpdateSymptominfo w2 = new UpdateSymptominfo { Owner = Window.GetWindow(this), ShowActivated = true, ShowInTaskbar = false, WindowStartupLocation = WindowStartupLocation.CenterScreen }; Dictionary <string, Object> dic = new Dictionary <string, object>(); dic.Add("user", user); dic.Add("symptom", symptomInfoDto); w2.DataContext = dic; w2.ShowDialog(); Refresh_RecordFrame_Action(); }
//按钮:删除 private void Delete_User(object sender, RoutedEventArgs e) { //检查是否选中 if (selectUser == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择用户再进行操作!", "Please Select A Subject!")); return; } Boolean dr = MessageBoxX.Question(LanguageUtils.ConvertLanguage("您确定删除该使用者信息?\n 使用者:", "Do You Want Delete The Subject?\n Subject:") + ((User)UsersInfo.SelectedItem).User_Name); if (dr == true) { //删除 userService.DeleteUser(selectUser); //致空 selectUser = null; //刷新界面 users = userService.GetAllUsers(); UsersInfo.ItemsSource = users; } }
//按钮:输入体力评价 private void InputManualMvaluation(object sender, RoutedEventArgs e) { InputManualMvaluation inputManualMvaluation = new InputManualMvaluation { Owner = Window.GetWindow(this), ShowActivated = true, ShowInTaskbar = false, WindowStartupLocation = WindowStartupLocation.CenterScreen }; if (selectUser != null) { inputManualMvaluation.Pk_User_Id.Content = selectUser.Pk_User_Id; inputManualMvaluation.User_Name.Content = selectUser.User_Name; inputManualMvaluation.Current_User = selectUser; inputManualMvaluation.ShowDialog(); Refresh_RecordFrame_Action(); } else { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择用户再进行操作!", "Please Select A Subject!")); } }
//按钮:文档输出 private void Output_Document(object sender, RoutedEventArgs e) { Microsoft.Win32.SaveFileDialog sfd = new Microsoft.Win32.SaveFileDialog { Filter = LanguageUtils.ConvertLanguage("Excel表格(*.xlsx)|*.xlsx", "Excel Sheet (*.xlsx)|*.xlsx") }; //设置默认文件类型显示顺序 sfd.FilterIndex = 1; //保存对话框是否记忆上次打开的目录 sfd.RestoreDirectory = true; if (selectUser != null) { if (is_signinformationrecord.IsChecked == true) { sfd.FileName = selectUser.User_Name + "-" + LanguageUtils.GetCurrentLanuageStrByKey("SubjectInfoView.VitalHistory") + "-" + DateTime.Now.ToString("yyyyMMddHHmm") + ".xlsx"; } if (is_trainingrecord.IsChecked == true) { sfd.FileName = selectUser.User_Name + "-" + LanguageUtils.GetCurrentLanuageStrByKey("SubjectInfoView.TrainingHistory") + "-" + DateTime.Now.ToString("yyyyMMddHHmm") + ".xlsx"; } if (is_physicalevaluation.IsChecked == true) { sfd.FileName = selectUser.User_Name + "-" + LanguageUtils.GetCurrentLanuageStrByKey("SubjectInfoView.PhysicalEvaluationHistory") + "-" + DateTime.Now.ToString("yyyyMMddHHmm") + ".xlsx"; } } if (sfd.ShowDialog() == true) { //此处做你想做的事 ...=ofd.FileName; //获取当前 try { if (is_signinformationrecord.IsChecked == true) { //导出症状信息记录 if (selectUser != null) { //获取用户症状信息 List <SymptomInfo> lists = new SymptomService().GetByUserId(selectUser); if (lists.Count > 0) { List <object> symptomInfoDtos = new List <object>(); foreach (SymptomInfo symptomInfo in lists) { symptomInfoDtos.Add(new SymptomInfoExcelVO(symptomInfo)); } //存放信息导出的列名 if (LanguageUtils.IsChainese()) { string[] colNames = { "训练日期", "血压(前)", "脉搏(前)", "心率(前)", "体温(前)", "血压(后)", "脉搏(后)", "心率(后)", "体温(后)", "身体倦怠", "腹泻", "摇晃", "心跳、气喘", "咳嗽、有痰", "发烧", "胸部、肚子痛", "没有食欲", "持续便秘", "感到头晕", "头痛", "其他", "没有相关症状", "是否参加", "水分摄取", "看护记录" }; ExcelUtil.GenerateOrdinaryExcel(sfd.FileName.ToString(), selectUser, ExcelUtil.ToDataTable("症状信息记录", colNames, symptomInfoDtos)); } else { string[] colNames = { "Training date", "Blood pressure (front)", "Pulse (front)", "Heart rate (front)", "Body temperature (front)", "Blood pressure (after)", "Pulse (after)", "Heart rate (after)", "Body temperature (after)", "Physical exhaustion", "Diarrhea", "Shake", "Heartbeat, asthma", "Cough with phlegm", "Fever", "Chest and stomach pain", "No appetite", "Continuous constipation", "Feeling dizzy", "Headache", "Other", "No related symptoms", "Whether to participate", "Moisture intake", "Care record" }; ExcelUtil.GenerateOrdinaryExcel(sfd.FileName.ToString(), selectUser, ExcelUtil.ToDataTable("Symptom information record", colNames, symptomInfoDtos)); } } else { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("抱歉,没有数据", "Sorry, No Data!")); } } } else if (is_trainingrecord.IsChecked == true) { //导出训练记录 if (selectUser != null) { List <TrainComprehensive> lists = new ExcelService().ListTrainExcekVOByUserId(selectUser.Pk_User_Id); if (lists.Count > 0) { List <object> excelLists = new List <object>(); foreach (TrainComprehensive trainComprehensive in lists) { excelLists.Add(new TrainExcelVO(trainComprehensive)); } //Console.WriteLine(lists.ToString()); //存放信息导出的列名 if (LanguageUtils.IsChainese()) { string[] colNames = { "实施日期", "使用器械", "组数", "组的个数", "组间隔休息时间", " 砝码", "移乘方法", "自觉运动强度", "时间(秒)", " 距离(mm)", "总工作量(J)", "热量(cal)", "指数", "已完成组数", "时机、姿势", "备忘", "注意点", "利用者感想" }; ExcelUtil.GenerateOrdinaryExcel(sfd.FileName.ToString(), selectUser, ExcelUtil.ToDataTable("训练记录", colNames, excelLists)); } else { string[] colNames = { "Date", "Device name", "Groups", "Number", "Break time", " Weights", "Transfer method", "Conscious exercise intensity", "Time (seconds)", " Distance (mm)", "Total workload (J)", "Calories (cal)", "Index", "Completed groups", "Timing, posture", "Remark", "Be careful", "User feelings" }; ExcelUtil.GenerateOrdinaryExcel(sfd.FileName.ToString(), selectUser, ExcelUtil.ToDataTable("Training record", colNames, excelLists)); } } else { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("抱歉,没有数据", "Sorry, No Data!")); } } } else if (is_physicalevaluation.IsChecked == true) { //导出体力评价记录 if (selectUser != null) { List <PhysicalPower> lists = new ExcelService().ListPhysicalPowerExcelVO(selectUser.Pk_User_Id); if (lists.Count > 0) { List <object> excelLists = new List <object>(); foreach (PhysicalPower physicalPower in lists) { excelLists.Add(new PhysicaleExcelVO(physicalPower)); } //存放信息导出的列名 if (LanguageUtils.IsChainese()) { string[] colNames = { "日期", "身高", "体重", "握力", "睁眼单脚站立", "功能性前伸", "坐姿体前屈", "time&up go", "5m步行-通常", "5m步行-最快", "10m步行", "6分钟步行", "2分钟踏步", "2分钟抬腿", "使用用者感想", "工作人员感想" }; ExcelUtil.GenerateOrdinaryExcel(sfd.FileName.ToString(), selectUser, ExcelUtil.ToDataTable("体力评价记录", colNames, excelLists)); } else { string[] colNames = { "Date", "High", "Weight", "Grip", "Wink stand on one foot", "Functional reach", "Sitting body flexion", "time&up go", "5m walk - usually", "5m walk - fastest", "10m walk", "6 minutes walk", "2 String step", "2 minutes leg lift", "User experience", "Staff feelings" }; ExcelUtil.GenerateOrdinaryExcel(sfd.FileName.ToString(), selectUser, ExcelUtil.ToDataTable("Physical Assessment Record", colNames, excelLists)); } } else { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("抱歉,没有数据", "Sorry, No Data!")); } } } } catch (IOException ex) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("文件被占用,请先关闭文件", "The file is occupied. Please close the file first")); return; } catch (Exception ex) { Console.WriteLine("生成普通Excel异常"); return; } } }
/// <summary> ///3D扫描的构造函数 -byCQZ 2019.6.16 /// /// </summary> private void NuitrackCreate() { try { Nuitrack.Init(""); Console.WriteLine("Initialize succneed."); } catch (nuitrack.Exception exception) { Console.WriteLine("Cannot initialize Nuitrack."); //throw exception; MessageBoxX.Warning("3D摄像头初始化失败,请检查SDK配置和是否进行密钥认证。"); } try { // Create and setup all required modules _depthSensor = DepthSensor.Create(); _colorSensor = ColorSensor.Create(); _userTracker = UserTracker.Create(); _skeletonTracker = SkeletonTracker.Create(); _handTracker = HandTracker.Create(); _gestureRecognizer = GestureRecognizer.Create(); } catch (nuitrack.Exception exception) { Console.WriteLine("Cannot create Nuitrack module."); //throw exception; MessageBoxX.Warning("3D摄像头初始化失败,请检查SDK配置和是否进行密钥认证。"); } _depthSensor.SetMirror(false); // Add event handlers for all modules _depthSensor.OnUpdateEvent += onDepthSensorUpdate; _colorSensor.OnUpdateEvent += onColorSensorUpdate; _userTracker.OnUpdateEvent += onUserTrackerUpdate; _skeletonTracker.OnSkeletonUpdateEvent += onSkeletonUpdate; _handTracker.OnUpdateEvent += onHandTrackerUpdate; _gestureRecognizer.OnNewGesturesEvent += onNewGestures; // Add an event handler for the IssueUpdate event Nuitrack.onIssueUpdateEvent += onIssueDataUpdate; // Create and configure the Bitmap object according to the depth sensor output mode OutputMode mode = _depthSensor.GetOutputMode(); OutputMode colorMode = _colorSensor.GetOutputMode(); if (mode.XRes < colorMode.XRes) { mode.XRes = colorMode.XRes; } if (mode.YRes < colorMode.YRes) { mode.YRes = colorMode.YRes; } Console.WriteLine(mode.XRes + "=====================" + mode.YRes); _bitmap = new DirectBitmap(mode.XRes, mode.YRes); for (int y = 0; y < mode.YRes; ++y) { for (int x = 0; x < mode.XRes; ++x) { _bitmap.SetPixel(x, y, Color.FromKnownColor(KnownColor.Aqua)); } } try { Nuitrack.Run(); Console.WriteLine("Start Nuitrack."); } catch (nuitrack.Exception exception) { Console.WriteLine("Cannot start Nuitrack."); //throw exception; MessageBoxX.Warning("3D摄像头启动失败,请检查SDK配置和是否进行密钥认证。"); } }
private void FButton_Click_Warning(object sender, RoutedEventArgs e) { MessageBoxX.Warning("架构之美、数学之美、.net 核心框架、异步编程的艺术、单元测试的艺术,代码,WPF"); }
//按钮:输入征状信息 private void InputSymptomInformation(object sender, RoutedEventArgs e) { Object o = record.Content; TrainDTO trainDto = null; User user = (User)UsersInfo.SelectedItem; if (o is TrainingRecord_Frame) { TrainingRecord_Frame trainingRecordFrame = (TrainingRecord_Frame)o; int index = trainingRecordFrame.TabControl1.SelectedIndex; switch (index) { case 0: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord1.SelectedItem; break; case 1: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord2.SelectedItem; break; case 2: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord3.SelectedItem; break; case 3: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord4.SelectedItem; break; case 4: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord5.SelectedItem; break; case 5: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord6.SelectedItem; break; } } if (user == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择用户再进行操作!", "Please Select A Subject!")); return; } //if (trainDto == null) //{ // //判断是否选择了训练信息 // MessageBox.Show(LanguageUtils.ConvertLanguage("请选择训练信息再进行操作!", "Please Select A Train Info!")); // return; //} InputSymptomInformation w2 = new InputSymptomInformation { Owner = Window.GetWindow(this), ShowActivated = true, ShowInTaskbar = false, WindowStartupLocation = WindowStartupLocation.CenterScreen }; Dictionary <string, Object> dic = new Dictionary <string, object>(); dic.Add("user", user); //dic.Add("trainDto", trainDto); w2.DataContext = dic; w2.ShowDialog(); Refresh_RecordFrame_Action(); }
/// <summary> /// 异步进程与UI更新 /// </summary> #region 绑定通知公告 private void BindNotice() { System.Threading.Tasks.Task.Factory.StartNew(() => { try { //如果用户没有被上传则return,不允许发心跳,否则就按照不合法冻结了 if (new UploadManagementDAO().CheckExistAuth() != null) { return; } HeartBeatOffice heartBeatOffice = new HeartBeatOffice(); HttpHeartBeat result = heartBeatOffice.GetHeartBeatByCurrent(); //心跳直接上传 !HttpSender.Ping() || if (result == null) { //如果没有取到值 return; } string jsonStr = HttpSender.POSTByJsonStr("communicationController/analysisJson", JsonTools.Obj2JSONStrNew <HttpHeartBeat>(result)); HttpHeartBeat webResult = JsonTools.DeserializeJsonToObject <HttpHeartBeat>(jsonStr); //本地数据更改 if (webResult == null) { return; } heartBeatOffice.SolveHeartbeat(webResult); Dispatcher.Invoke(new Action(() => { if (webResult.authStatus == 0) { //正常心跳不处理 } else if (webResult.authStatus == 1) { //冻结,弹窗,然后关闭窗口 // 程序强制退出 authDao.UpdateByUserName(webResult.username, 1); // 停止定时器 timerNotice.Stop(); MessageBoxX.Warning(LanguageUtils.ConvertLanguage("用户被冻结,即将退出,请联系宝德龙管理员解冻!", "The user is frozen, will exit, please contact the administrator thaw!")); Environment.Exit(0); } else if (webResult.authStatus == 2) { //解冻,只需要更改数据库。界面无反馈,不处理 //authDao.UpdateByUserName(webResult.username, 2); } else if (webResult.authStatus == 3) { //永久离线,只需要更改数据库。界面无反馈,不处理 //authDao.UpdateByUserName(webResult.username, 3); } else if (webResult.authStatus == 4) { //已删除,按照冻结处理 //authDao.UpdateByUserName(webResult.username, 1); timerNotice.Stop(); MessageBoxX.Warning(LanguageUtils.ConvertLanguage("用户被删除,即将退出,请联系宝德龙管理员恢复!", "The user is removed, will exit, please contact the administrator to restore!")); Environment.Exit(0); } })); } catch { } }); }
//按钮:查看详细信息 private void ViewDetails(object sender, RoutedEventArgs e) { //查看征状详细信息 if (is_signinformationrecord.IsChecked == true) { ViewSymptomInformation viewSymptomInformation = new ViewSymptomInformation { Owner = Window.GetWindow(this), ShowActivated = true, ShowInTaskbar = false, WindowStartupLocation = WindowStartupLocation.CenterScreen }; List <TrainInfo> list = new List <TrainInfo>(); TrainInfo trainInfo = new TrainInfo { Gmt_Create = new DateTime(2012, 01, 02) }; list.Add(trainInfo); Console.WriteLine(trainInfo.Gmt_Create); list.Add(trainInfo); if (record.Content == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择症状信息再进行操作!", "Please Select A Symptom Info!")); return; } DataGrid dataGrid = ((SignInformationRecord_Frame)record.Content).SignInformationRecord; SymptomInfoDTO symptomInfoDto = (SymptomInfoDTO)dataGrid.SelectedItem; User user = (User)UsersInfo.SelectedItem; if (user == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择用户再进行操作!", "Please Select A Subject!")); return; } if (symptomInfoDto == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择症状信息再进行操作!", "Please Select A Symptom Info!")); return; } Dictionary <string, Object> dictionary = new Dictionary <string, object>(); dictionary.Add("user", user); dictionary.Add("symptomInfoDto", symptomInfoDto); viewSymptomInformation.DataContext = dictionary; viewSymptomInformation.ShowDialog(); } //打开训练详细信息 else if (is_trainingrecord.IsChecked == true) { ViewTrainingResults viewTrainingResults = new ViewTrainingResults { Owner = Window.GetWindow(this), ShowActivated = true, ShowInTaskbar = false, WindowStartupLocation = WindowStartupLocation.CenterScreen }; Object o = record.Content; TrainDTO trainDto = null; User user = (User)UsersInfo.SelectedItem; if (o is TrainingRecord_Frame) { TrainingRecord_Frame trainingRecordFrame = (TrainingRecord_Frame)o; int index = trainingRecordFrame.TabControl1.SelectedIndex; switch (index) { case 0: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord1.SelectedItem; break; case 1: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord2.SelectedItem; break; case 2: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord3.SelectedItem; break; case 3: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord4.SelectedItem; break; case 4: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord5.SelectedItem; break; case 5: trainDto = (TrainDTO)trainingRecordFrame.TrainingRecord6.SelectedItem; break; } } if (user == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择用户再进行操作!", "Please Select A Subject!")); return; } if (trainDto == null) {//判断是否选择了训练信息 MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择训练信息再进行操作!", "Please Select A Train Info!")); return; } Dictionary <string, Object> dic = new Dictionary <string, object>(); dic.Add("user", user); dic.Add("trainDto", trainDto); viewTrainingResults.DataContext = dic; viewTrainingResults.ShowDialog(); } //打开体力评价详细信息 else if (is_physicalevaluation.IsChecked == true) { ViewManualMvaluation viewManualMvaluation = new ViewManualMvaluation { Owner = Window.GetWindow(this), ShowActivated = true, ShowInTaskbar = false, WindowStartupLocation = WindowStartupLocation.CenterScreen }; Object o = record.Content; PhysicaleDTO physicaleDto = null; User user = (User)UsersInfo.SelectedItem; if (o is PhysicaleValuation_Frame) { PhysicaleValuation_Frame physicaleValuationFrame = (PhysicaleValuation_Frame)o; physicaleDto = (PhysicaleDTO)physicaleValuationFrame.PhysicaleValuation.SelectedItem; } if (user == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择用户再进行操作!", "Please Select A Subject!")); return; } if (physicaleDto == null) {//判断是否选择了训练信息 MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择体力评价再进行操作!", "Please Select A Physical Evalution!")); return; } Dictionary <string, Object> dic = new Dictionary <string, object>(); dic.Add("user", user); dic.Add("physicaleDto", physicaleDto); viewManualMvaluation.DataContext = dic; viewManualMvaluation.ShowDialog(); } }
//按钮:制作报告,报表 private void MakeReport(object sender, RoutedEventArgs e) { User user = (User)UsersInfo.SelectedItem; if (user == null) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请选择用户再进行操作!", "Please Select A Subject!")); return; } //打开训练报告 if (is_signinformationrecord.IsChecked == true || is_trainingrecord.IsChecked == true) { TrainingReport trainingReport = new TrainingReport { Owner = Window.GetWindow(this), ShowActivated = true, ShowInTaskbar = false, WindowStartupLocation = WindowStartupLocation.CenterScreen, MaxHeight = SystemParameters.WorkArea.Size.Height, MaxWidth = SystemParameters.WorkArea.Size.Width }; //设置用户信息 if (selectUser != null) { trainingReport.Pk_User_Id.Content = selectUser.Pk_User_Id; trainingReport.User_Name.Content = selectUser.User_Name; trainingReport.Current_User = selectUser; List <TrainingAndSymptomBean> list = excelService.ListTrainingAndSymptomByUserId(selectUser.Pk_User_Id); trainingReport.datalist.DataContext = list; trainingReport.trainingAndSymptomBeans = list;//赋值全局变量 List <DateTime?> dateTimes = new List <DateTime?>(); foreach (TrainingAndSymptomBean tas in list) { dateTimes.Add(tas.Gmt_Create); } trainingReport.selectedDate = dateTimes; if (list.Count != 0) { trainingReport.start_date.SelectedDate = list[0].Gmt_Create; //起始时间 trainingReport.end_date.SelectedDate = list[list.Count - 1].Gmt_Create; //终止时间 } else { trainingReport.start_date.SelectedDate = DateTime.Now; trainingReport.end_date.SelectedDate = DateTime.Now; } trainingReport.ShowDialog(); } } //打开训练报告页面 //else if (is_trainingrecord.IsChecked == true) //{ // TrainingReport trainingReport = new TrainingReport // { // Owner = Window.GetWindow(this), // ShowActivated = true, // ShowInTaskbar = false, // WindowStartupLocation = WindowStartupLocation.CenterScreen // }; // List<TrainInfo> list = new List<TrainInfo>(); // TrainInfo trainInfo = new TrainInfo // { // Gmt_Create = new DateTime(2012, 01, 02) // }; // list.Add(trainInfo); // Console.WriteLine(trainInfo.Gmt_Create); // list.Add(trainInfo); // trainingReport.datalist.DataContext = list; // trainingReport.ShowDialog(); //} //打开体力评价报告页面 else { PhysicalAssessmentReport physicalAssessmentReport = new PhysicalAssessmentReport { Owner = Window.GetWindow(this), ShowActivated = true, ShowInTaskbar = false, WindowStartupLocation = WindowStartupLocation.CenterScreen, MaxHeight = SystemParameters.WorkArea.Size.Height, MaxWidth = SystemParameters.WorkArea.Size.Width }; //设置用户信息 if (selectUser != null) { physicalAssessmentReport.Pk_User_Id.Content = selectUser.Pk_User_Id; physicalAssessmentReport.User_Name.Content = selectUser.User_Name; physicalAssessmentReport.Current_User = selectUser; List <PhysicalPowerExcekVO> list = excelService.ListPhysicalPowerExcekVOByUserId(selectUser.Pk_User_Id); physicalAssessmentReport.datalist.DataContext = list; physicalAssessmentReport.physicalPowerExcekVOs = list; List <DateTime?> dateTimes = new List <DateTime?>(); foreach (PhysicalPowerExcekVO tas in list) { dateTimes.Add(tas.Gmt_Create); } physicalAssessmentReport.selectedDate = dateTimes; if (list.Count != 0) { physicalAssessmentReport.start_date.SelectedDate = list[0].Gmt_Create; //起始时间 physicalAssessmentReport.end_date.SelectedDate = list[list.Count - 1].Gmt_Create; //终止时间 } else { physicalAssessmentReport.start_date.SelectedDate = DateTime.Now; physicalAssessmentReport.end_date.SelectedDate = DateTime.Now; } physicalAssessmentReport.ShowDialog(); } //List<TrainInfo> list = new List<TrainInfo>(); //TrainInfo trainInfo = new TrainInfo //{ // Gmt_Create = new DateTime(2012, 01, 02) //}; //list.Add(trainInfo); //Console.WriteLine(trainInfo.Gmt_Create); //list.Add(trainInfo); } ////List<String> list = new List<string>(); ////for (int i = 0; i < 100; i++) ////{ //// list.Add("sas" + i); ////} }
//确定按钮 private void Determine(object sender, RoutedEventArgs e) { String password = NonPublicInformationPassword.Password; if ("111" == password) { try { //与U盘交互 //1.打包协议到result; byte[] send = null; //获取电脑的uuid字节数组-即加密狗的内容 ProtocolConstant.USB_DOG_CONTENT = Encoding.UTF8.GetBytes(Get_UUID()); new MakerUSBDogFrame().PackData(ref send, new byte[] { 0xF0 }, ProtocolConstant.USB_DOG_CONTENT); //Console.WriteLine("加密后的报文" + ProtocolUtil.ByteToStringOk(send)); //byte[] test = null; //new MakerUSBDogFrame().PackData(ref test, new byte[] { 0xF0 }, Encoding.UTF8.GetBytes("hello")); logger.Debug("激活:" + ProtocolUtil.ByteToStringOk(send)); //2.判断当前是否已经连接过串口 SerialPortUtil.CheckPort(); if (SerialPortUtil.portName == "") { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("请先连接串口", "Please connect the serial port first")); return; } if (SerialPortUtil.SerialPort != null) { SerialPortUtil.SerialPort = null; } if (serialPort == null) { serialPort = SerialPortUtil.ConnectSerialPort(OnPortDataReceived); try { serialPort.Open(); } catch (UnauthorizedAccessException ex) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("串口被占用", "Serial port is occupied")); return; } catch (IOException ex) { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("串口不存在", "Serial port does not exist")); this.Close(); return; } serialPort.Write(send, 0, send.Length); //发送的定时器 threadTimer = new System.Threading.Timer(new System.Threading.TimerCallback(ReissueThreeTimes), send, 500, 500); } } catch (Exception ex) { logger.Error("激活异常"); //Console.WriteLine("激活异常"); } //else //{ // if (!serialPort.IsOpen) // { // try // { // serialPort.Open(); // } // catch (UnauthorizedAccessException ex) // { // MessageBoxX.Warning("串口被占用", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); // return; // } // catch (IOException ex) // { // MessageBoxX.Warning("串口不存在", "温馨提示", MessageBoxButton.OK, MessageBoxImage.Warning); // return; // } // } //} } else { MessageBoxX.Warning(LanguageUtils.ConvertLanguage("密码错误,请重新输入", "Password error, please retype")); } }