private void Edit_Click(object sender, RoutedEventArgs e) { ToggleButton b = sender as ToggleButton; int id = Convert.ToInt32(b.CommandParameter); for (int i = WhiteListView.Items.Count - 1; i >= 0; i--) { if (whiteList[i].ID == id) { if (!whiteList[i].ReadOnly) { ListViewItem lvi = this.WhiteListView.ItemContainerGenerator.ContainerFromIndex(i) as ListViewItem; TextBox tb = FindVisualChild <TextBox>(lvi); tb.Focus(); tb.SelectionStart = tb.Text.Length; } else { if (String.IsNullOrWhiteSpace(whiteList[i].Number)) { MessageBoxX.Show("提示", "船舷号不能为空!"); whiteList[i].ReadOnly = !whiteList[i].ReadOnly; } else { try { WhiteShip ship = new WhiteShip(); ship.CallID = whiteList[i].CallSign; if (!String.IsNullOrWhiteSpace(whiteList[i].IMO)) { ship.IMO = uint.Parse(whiteList[i].IMO); } ship.MMSI = int.Parse(whiteList[i].MMSI); ship.ShipDepartment = whiteList[i].Department; ship.ShipName = whiteList[i].Name; ship.ShipUsage = whiteList[i].Usage; ship.ShipNumber = whiteList[i].Number; white.UpdateWhiteShip(ship); dataAna.WhiteListSync(); } catch (Exception ex) { MessageBoxX.Show("警告", "存在非法的数据!"); whiteList[i].ReadOnly = !whiteList[i].ReadOnly; } } } } } }
private void YES_MouseLeftButtonDown(object sender, RoutedEventArgs e) { App app = (App)App.Current; if (MapManage.opeartion == "删除") { app.chartCtrl.DeleteMap(MapManage.target); MessageBoxX.Show("提示", "海图文件删除成功!"); } else if (MapManage.opeartion == "预览") { app.chartCtrl.OverViewMap(MapManage.target); } this.Close(); }
private void playBtn_Click(object sender, RoutedEventArgs e)//开始播放 { try { if (TrackListView.SelectedItem == null) { MessageBoxX.Show("提示", "请先选择跟踪事件"); } if (videoState < 0) { SlectDevice = vidioType.Text; startPlay(); pause = 0; } if (videoState >= 0) { playBtn.IsEnabled = false; playBtn.Visibility = Visibility.Collapsed; pauseBtn.IsEnabled = true; pauseBtn.Visibility = Visibility.Visible; if (pause == 0) { ; } else if (pause == 1) { NVRCsharpDemo.DVRAPI.GetInstance().Playback_Restart(videoState); } else if (pause == 2) { NVRCsharpDemo.DVRAPI.GetInstance().Playback_Resume(videoState); } pause = 0; } else { playBtn.IsEnabled = true; playBtn.Visibility = Visibility.Visible; pauseBtn.IsEnabled = false; pauseBtn.Visibility = Visibility.Collapsed; telephotoPictureBox.change_Pic("..\\..\\Image\\video.png"); } } catch { MessageBoxX.Show("错误", "发生未知错误"); } }
private void Edit_Click(object sender, RoutedEventArgs e)//列表右侧按钮-编辑 { ToggleButton b = sender as ToggleButton; int id = Convert.ToInt32(b.CommandParameter); for (int i = UserListView.Items.Count - 1; i >= 0; i--) { if (userList[i].ID == id) { if (!userList[i].ReadOnly) { ListViewItem lvi = this.UserListView.ItemContainerGenerator.ContainerFromIndex(i) as ListViewItem; TextBox tb = FindVisualChild <TextBox>(lvi); tb.Focus(); tb.SelectionStart = tb.Text.Length; } else { if (String.IsNullOrWhiteSpace(userList[i].UserName) || String.IsNullOrWhiteSpace(userList[i].Password) || String.IsNullOrWhiteSpace(userList[i].Role)) { MessageBoxX.Show("提示", "用户名、密码、角色类型不能为空!"); userList[i].ReadOnly = !userList[i].ReadOnly; } else { try { dataAnadll.User us = new dataAnadll.User(); us.ID = int.Parse(userList[i].UserID); us.Name = userList[i].UserName; us.Password = userList[i].Password; us.RoleID = int.Parse(userList[i].Role); us.Department = userList[i].Department; us.Level = userList[i].Position; us.Email = userList[i].Mail; us.Phone = userList[i].Phone; userData.UpdateUser(us);//用户数据更新 } catch (Exception ex) { MessageBoxX.Show("警告", "存在非法的数据!"); userList[i].ReadOnly = !userList[i].ReadOnly; } } } } } }
private void changeToPageClick(object sender, RoutedEventArgs e)//跳转到某页 { if (allPage == 0) { MessageBoxX.Show("提示", "还没有进行查询"); return; } int toPage = 1; try { toPage = (int)double.Parse(pageNumber.Text);//跳转到的页码 } catch { MessageBoxX.Show("提示", "跳转的页码不合法"); pageNumber.Text = currectPage.ToString(); return; } if (toPage <= allPage && toPage >= 1) { currectPage = toPage; linkageList.Clear(); List <Capture> dataList = new List <Capture>(); captureData.GetPage(toPage, out dataList);//初始化对应页数据 for (int i = 0; i < dataList.Count; i++) { LinkageTarget lt = new LinkageTarget { ID = i, StartTime = dataList[i].linkage_start.ToString(), EndTime = dataList[i].linkage_end.ToString(), Target = dataList[i].target_Id.ToString(), Number = dataList[i].Ship_number, ImagePath = dataList[i].picture_path, }; linkageList.Add(lt); } LinkageListView.DataContext = linkageList; } else { MessageBoxX.Show("提示", "跳转的页码不合法"); pageNumber.Text = currectPage.ToString(); return; } currentPage.Text = toPage.ToString(); }
private void comfirmClick(object sender, RoutedEventArgs e)//确定播放 { //startPlay();//开始回放 if (LinkageListView.SelectedItem != null) { linkTargetStart = _linkStrartTimeStamp; linkTargetEnd = _linStopTimeStamp; // PictureShow w = new PictureShow(); //System.Windows.Application.Current.MainWindow = w; //w.ShowDialog(); } else { MessageBoxX.Show("提示", "尚未选择联动事件"); } }
private void comfirmClick(object sender, RoutedEventArgs e) { App app = (App)App.Current; int count = 0; for (int i = 0; i < app.chartCtrl.ForbiddenZoneList.Count; i++) { if (pipelineName.Text == app.chartCtrl.ForbiddenZoneList[i].Name) { count = 1; } } for (int j = 0; j < app.chartCtrl.PipelineList.Count; j++) { if (pipelineName.Text == app.chartCtrl.PipelineList[j].Name) { count = 1; } } if (count == 0) { pipelineNameText = pipelineName.Text; logText = log.Text; try { if (float.Parse(pipelineWidth.Text) > rule.Max || float.Parse(pipelineWidth.Text) < rule.Min) { MessageBoxX.Show("提示", "宽度超出范围!"); } else { pipelineWidthText = pipelineWidth.Text; this.Close(); } } catch (Exception ex) { MessageBoxX.Show("警告", "宽度数据非法或为空!"); } } else if (count == 1) { MessageBoxX.Show("提示", "名称已存在,请修改命名!"); } }
private void startPlay() //获取视频句柄 { connectPictureBoxHandle = connectPictureBox.Handle; //追踪 Thread Thread = new Thread(new ThreadStart(realPlay)); Thread.Start(); Thread.Join(); if (videoState < 0) { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { MessageBoxX.Show("光电视频提示", "视频无信号"); } )); return; } }
private void sure(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(filePath) || File.Exists(filePath) == false) { MessageBoxX.Show("舷号导入提示", "数据文件为空或不存在"); //this.Close(); return; } WinProgressBar wpb = new WinProgressBar() { BgWork = Update_ShipName, MaxRespTime = 30, BarTitle = "船舷号导入中" }; wpb.ShowDialog(); this.Close(); }
private void comfirmClick(object sender, RoutedEventArgs e) { if (String.IsNullOrWhiteSpace(userName.Text) || String.IsNullOrWhiteSpace(password.Text) || String.IsNullOrWhiteSpace(role.Text)) { MessageBoxX.Show("提示", "用户名、密码、角色类型不能为空!"); } else { try { dataAnadll.User us = new dataAnadll.User(); us.Name = userName.Text; us.Password = password.Text; us.RoleID = role.SelectedIndex; us.Department = department.Text; us.Level = position.Text; us.Email = mail.Text; us.Phone = phone.Text; userData.AddUser(us);//用户数据添加 List <dataAnadll.User> list = new List <dataAnadll.User>(); list = userData.GetAllUsers(); SystemUser su = new SystemUser() { ID = UserManagement.userList.Count, UserID = list[list.Count - 1].ID.ToString(), UserName = list[list.Count - 1].Name, Password = list[list.Count - 1].Password, Role = list[list.Count - 1].RoleID.ToString(), Position = list[list.Count - 1].Level, Department = list[list.Count - 1].Department, Phone = list[list.Count - 1].Phone, Mail = list[list.Count - 1].Email, ReadOnly = true }; UserManagement.userList.Add(su); this.Close(); } catch (Exception ex) { MessageBoxX.Show("警告", "存在非法的数据!"); } } }
void longFocusPointLeft(object sender, System.Windows.Forms.MouseEventArgs e)//追踪(开关) { if (MonitoringX.deviceControlState == 0) { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { MessageBoxX.Show("提示", "无光电控制权"); } )); } else { short x = (short)e.Location.X; short y = (short)e.Location.Y; int a = GetTimeStamp(); MonitoringX.photoPoint(a, x, y); startime = GetTime(GetTimeStamp().ToString()); } }
private void ButPie_Click1(object sender, RoutedEventArgs e) { Simon1.Children.Clear(); CreateChartPie1(title + "统计", strListx1, strListy1); int count = 0; for (int i = 0; i < strListy1.Count(); i++) { if (strListy1[i] != "0") { count = 1; } } if (count == 0) { MessageBoxX.Show("提示", "报警次数为零!"); } }
private SetConfig config = new SetConfig(); //配置文件实例 //管理员,工程师,操作员,观察员 public MainWindow() { InitializeComponent(); dbIP = config.read_string("dbsetting", "dbip"); dbUser = config.read_string("dbsetting", "dbuser"); dbPassword = config.read_string("dbsetting", "dbpassword"); dbName = config.read_string("dbsetting", "dbname"); WinProgressBar dialog = new WinProgressBar() { MaxRespTime = 2, BgWork = dataConnect, BarTitle = "正在加载系统" }; //主界面进度条 dialog.ShowDialog(); deviceIP = getDeviceIP(); try { //MessageBoxX("Info", GetProcess.ProcessManager.IsRunning("MaritimeSecurityMonitoring") == true) if (ProcessManager.IsRunning("MaritimeSecurityMonitoring") == true) { MessageBoxX.Show("启动警告", "检测到软件已运行,请关闭后重启"); System.Windows.Application.Current.Shutdown(); Environment.Exit(0);//强制退出 GC.Collect(); } } catch (Exception ee) { } try { loginData = new LoginManager(); OperationLogData = new OperationLogWriter(); opeation = new OperationLog(); } catch (Exception ee) { } }
private void ConfirmClick(object sender, RoutedEventArgs e) { if (startTime.Text == null || endTime.Text == null) { MessageBoxX.Show("提示", "时间不能为空!"); } else if (target.Text == "") { MessageBoxX.Show("提示", "查询目标不能为空!"); } else { System.DateTime time = Convert.ToDateTime(startTime.Text); //string转datatime(star) start = (long)GetTimeStamp(time); //datatime时间戳(star) System.DateTime timer = Convert.ToDateTime(endTime.Text); //string转datatime(end) end = (long)GetTimeStamp(timer); //datatime时间戳(end) if (trackType == "radar1") { targetInfor = (int)double.Parse(target.Text); MonitoringX.radarTrackBack(start, end, targetInfor, 1);//调用雷达航迹查询 } else if (trackType == "radar2") { targetInfor = (int)double.Parse(target.Text); MonitoringX.radarTrackBack(start, end, targetInfor, 2);//调用雷达航迹查询 } else if (trackType == "AIS") { targetInfor = (int)double.Parse(target.Text); MonitoringX.AISTrackBack(start, end, targetInfor);//调用AIS航迹查询 } else if (trackType == "Mix") { targetInfor = (int)double.Parse(target.Text); MonitoringX.mixTrackBack(start, end, targetInfor);//调用融合航迹查询 } this.Close(); } }
private void delete_Click(object sender, RoutedEventArgs e)//删除 { if (target != -1) { App app = (App)App.Current; opeartion = "删除"; MapMessage sp = new MapMessage(); System.Windows.Application.Current.MainWindow = sp; sp.ShowDialog(); MainWindow.opeation.OptionName = "海图删除";//日志入库 MainWindow.opeation.LogType = 2; MainWindow.opeation.OptionTime = GetTime(GetTimeStampS().ToString()); MainWindow.OperationLogData.WriteOperationLog(MainWindow.opeation); addMapsSelection.Items.Clear(); list = app.chartCtrl.GetMapList(); //获取海图名数组 for (int i = 0; i < list.Count; i++) //加载海图名列表 { int flag = list[i].IndexOf('\0'); if (flag > 0) { addMapsSelection.Items.Add(list[i].Substring(0, flag)); } else { addMapsSelection.Items.Add(list[i]); } } addMapsSelection.Items.Refresh(); } else { MessageBoxX.Show("提示", "没有选取海图目标!"); } }
private void comfirmClick(object sender, RoutedEventArgs e) { try { int linkageEnd = GetTimeStamp(); //WinProgressBar wpb = new WinProgressBar() { BgWork = Update_Pic, MaxRespTime = 10 }; //wpb.ShowDialog(); AutomaticLinkage.pic_Full_path = serverPath; AutomaticLinkage.boat_Name = boatNumber.Text; AutomaticLinkage.capTime = capTime; Update_Pic(); // Capture captureEvent = new Capture(); // captureEvent.capture_Time = capTime; // captureEvent.linkage_start = GetTime(AutomaticLinkage.linkageStar.ToString()); // captureEvent.linkage_end = GetTime(linkageEnd.ToString()); // captureEvent.picture_path = serverPath; // //captureEvent.remark=没有备注界面吧?; // captureEvent.Ship_number = boatNumber.Text; // captureEvent.target_Id = MonitoringX.nowTarget.ID; // //captureEvent.target_type=? // capture.WriteSeleCapture(captureEvent);//截图联动事件入库 // System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => // { // MessageBoxX.Show("联动事件", "入库成功"); // } //)); this.Close(); } catch (Exception ex) { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { MessageBoxX.Show("提示", "船舷号数据有误!"); } )); } }
private long[] dataTime()//获得时间控件的时间戳 { string start = StartTime.year.Text + StartTime.month.Text + StartTime.day.Text + " " + StartTime.hour.Text + StartTime.minute.Text + StartTime.second.Text; string end = EndTime.year.Text + EndTime.month.Text + EndTime.day.Text + " " + EndTime.hour.Text + EndTime.minute.Text + EndTime.second.Text; System.DateTime timer = Convert.ToDateTime(start); //string转datatime(end) long linkStart = (long)GetTimeStamp(timer); //datatime时间戳(end) System.DateTime timer1 = Convert.ToDateTime(end); //string转datatime(end) long linkEnd = (long)GetTimeStamp(timer1); //datatime时间戳(end) long[] times = { linkStart, linkEnd }; if (linkStart >= linkEnd) { if ((ErrorMessageBox % 2) == 0) { MessageBoxX.Show("数据导出提示", "时间设置错误"); } ErrorMessageBox++; } return(times); }
private void showInfo_Click(object sender, RoutedEventArgs e)//概览 { if (target != -1) { App app = (App)App.Current; mapInformations = app.chartCtrl.GetMapInfo(target);//获取海图信息类的数据 mapInformation[0] = mapInformations.OriginalScale.ToString(); mapInformation[1] = mapInformations.EditionNum.ToString(); mapInformation[2] = mapInformations.UpdateEdtNum.ToString(); mapInformation[3] = mapInformations.EditDate.ToString(); mapInformation[4] = mapInformations.LeftStrBndry.ToString(); mapInformation[5] = mapInformations.RightStrBndry.ToString(); mapInformation[6] = mapInformations.UpStrBndry.ToString(); mapInformation[7] = mapInformations.DownStrBndry.ToString(); measuring.Text = mapInformation[0]; edition.Text = mapInformation[1]; upgradedVersion.Text = mapInformation[2]; int flag = mapInformation[3].IndexOf('\0'); if (flag > 0) { memory.Text = mapInformation[3].Substring(0, flag); } else { memory.Text = mapInformation[3]; } rightBoundary.Text = mapInformation[4]; leftBoundary.Text = mapInformation[5]; topBoundary.Text = mapInformation[6]; bottomBoundary.Text = mapInformation[7]; } else { MessageBoxX.Show("提示", "没有选取海图目标!"); } }
//*********************************************************************************** //*******************************工具栏事件****************************************** //*********************************************************************************** private void doubleScreenShowClick(object sender, RoutedEventArgs e)//双屏显示 { //video1.Visibility = Visibility.Collapsed; //video2.Visibility = Visibility.Collapsed; //video3.Visibility = Visibility.Collapsed; try { /* Window28 w2 = new Window28(); * System.Windows.Application.Current.MainWindow = w2; * w2.Show(); * * //buju.ColumnDefinitions.RemoveAt(0); * * Window27 w1 = new Window27(); * System.Windows.Application.Current.MainWindow = w1; * w1.Show(); * this.Close();*/ } catch (Exception ex) { MessageBoxX.Show("异常信息", "未检测到扩展屏,请确定扩展屏正常连接!");//显示异常信息 } }
private void closeWindowClick(object sender, RoutedEventArgs e) { int linkageEnd = GetTimeStamp(); SeleCaptureManager capture = new SeleCaptureManager(); Capture captureEvent = new Capture(); captureEvent.capture_Time = capTime; captureEvent.linkage_start = CaptureImages.GetTime(AutomaticLinkage.linkageStar.ToString()); captureEvent.linkage_end = CaptureImages.GetTime(linkageEnd.ToString()); captureEvent.picture_path = pic_Full_path; captureEvent.Ship_number = boat_Name; captureEvent.target_Id = MonitoringX.nowTarget.ID; capture.WriteSeleCapture(captureEvent);//截图联动事件入库 System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { MessageBoxX.Show("联动事件", "入库成功"); } )); NVRCsharpDemo.DVRAPI.GetInstance().Stop_RealPlay(videoState); this.Close();//关闭窗口 }
private void Edit_Click(object sender, RoutedEventArgs e)//列表编辑 { ToggleButton b = sender as ToggleButton; int id = Convert.ToInt32(b.CommandParameter); for (int i = RoleListView.Items.Count - 1; i >= 0; i--) { if (roleList[i].ID == id) { if (!roleList[i].ReadOnly) { ListViewItem lvi = this.RoleListView.ItemContainerGenerator.ContainerFromIndex(i) as ListViewItem; TextBox tb = FindVisualChild <TextBox>(lvi); tb.Focus(); tb.SelectionStart = tb.Text.Length; } else { if (String.IsNullOrWhiteSpace(roleList[i].Name) || String.IsNullOrWhiteSpace(roleList[i].Right)) { MessageBoxX.Show("提示", "角色名称、权限不能为空!"); roleList[i].ReadOnly = !roleList[i].ReadOnly; } else { dataAnadll.User us = new dataAnadll.User(); us.ID = int.Parse(roleList[i].Code); us.Name = roleList[i].Name; us.RoleID = int.Parse(roleList[i].Right); us.Department = roleList[i].Description; user.UpdateUser(us);//用户数据更新 } } } } }
private void comfirmClick(object sender, RoutedEventArgs e)//确定 { try { if (int.Parse(Azimuth1.Text) > rule1.Max || int.Parse(Azimuth1.Text) < rule1.Min || int.Parse(Pitch1.Text) > rule2.Max || int.Parse(Pitch1.Text) < rule2.Min || int.Parse(Azimuth2.Text) > rule3.Max || int.Parse(Azimuth2.Text) < rule3.Min || int.Parse(Pitch2.Text) > rule4.Max || int.Parse(Pitch2.Text) < rule4.Min || float.Parse(Height.Text) > rule5.Max || float.Parse(Height.Text) < rule5.Min) { MessageBoxX.Show("提示", "数据超出范围!"); } else { MonitoringX.azimuthgyroDriveDriftCompensate(int.Parse(Azimuth1.Text)); MonitoringX.pitchgyroDriveDriftCompensate(int.Parse(Pitch1.Text)); MonitoringX.AzimuthDriveDriftCompensate(int.Parse(Azimuth2.Text)); MonitoringX.PitchDriveDriftCompensate(int.Parse(Pitch2.Text)); PhotoelectricParas data = new PhotoelectricParas(); data.AzimuthDriverCompensation = int.Parse(Azimuth2.Text); data.PitchDriveCompensation = int.Parse(Pitch2.Text); data.AzimuthGyroCompensation = int.Parse(Azimuth1.Text); data.PitchgGyroCompensation = int.Parse(Pitch1.Text); data.SetHeight = float.Parse(Height.Text); MonitoringX.photoHeight = float.Parse(Height.Text); photo.UpdatePhotoelectricPara(data); this.Close(); } } catch (Exception ex) { MessageBoxX.Show("警告", "存在非法或为空的数据!"); } }
private void comfirmClick(object sender, RoutedEventArgs e)//确定 { try { if (int.Parse(Angle1.Text) > rule1.Max || int.Parse(Angle1.Text) < rule1.Min || int.Parse(Angle2.Text) > rule2.Max || int.Parse(Angle2.Text) < rule2.Min || int.Parse(Percent.Text) > rule3.Max || int.Parse(Percent.Text) < rule3.Min) { MessageBoxX.Show("提示", "数据超出范围!"); } else { sp.angle1 = Angle1.Text; sp.angle2 = Angle2.Text; sp.percent = Percent.Text; this.Close(); rst = true; } } catch (Exception ex) { MessageBoxX.Show("警告", "数据非法或为空!"); rst = false; } }
private void yesClick(object sender, RoutedEventArgs e) { try { if ( float.Parse(xyzParameter.Text) > rule1.Max || float.Parse(xyzParameter.Text) < rule1.Min || float.Parse(abrDistance.Text) > rule2.Max || float.Parse(abrDistance.Text) < rule2.Min || float.Parse(abrAngle.Text) > rule3.Max || float.Parse(abrAngle.Text) < rule3.Min || long.Parse(radarDisappearTime.Text) > rule4.Max || long.Parse(radarDisappearTime.Text) < rule4.Min || long.Parse(AISDisappearTime.Text) > rule5.Max || long.Parse(AISDisappearTime.Text) < rule5.Min ) { MessageBoxX.Show("提示", "数据超出范围!"); } else { sc.write_string("fusion", "xyz", xyzParameter.Text); sc.write_string("fusion", "abrDistance", abrDistance.Text); sc.write_string("fusion", "abrAngle", abrAngle.Text); sc.write_string("fusion", "radarMiss", radarDisappearTime.Text); sc.write_string("fusion", "AISMiss", AISDisappearTime.Text); sc.write_string("fusion", "IM", IMParameter.Text); sc.write_string("fusion", "IN", INParameter.Text); sc.write_bool("fusionRadio", "prompt", (bool)prompt.IsChecked); sc.write_bool("fusionRadio", "warn", (bool)warn.IsChecked); sc.write_bool("fusionRadio", "optimal", (bool)RadioB3.IsChecked); sc.write_bool("fusionRadio", "weighted", (bool)RadioB4.IsChecked); sc.write_bool("fusionRadio", "SF", (bool)RadioB5.IsChecked); fXYZThreshold = (float)double.Parse(xyzParameter.Text); fDisThreshold = (float)double.Parse(abrDistance.Text); fAngleThreshold = (float)double.Parse(abrAngle.Text); if ((bool)prompt.IsChecked) { ucAlarmThreshold = 1; } else { ucAlarmThreshold = 2; } lRdDieTime = (long)double.Parse(radarDisappearTime.Text); lAISDieTime = (long)double.Parse(AISDisappearTime.Text); lM = (long)double.Parse(IMParameter.Text); lN = (long)double.Parse(INParameter.Text); if ((bool)RadioB3.IsChecked) { UcEstiArith = 1; } else if ((bool)RadioB4.IsChecked) { UcEstiArith = 2; } else if ((bool)RadioB5.IsChecked) { UcEstiArith = 3; } MonitoringX.FusionBack(); MainWindow.opeation.OptionName = "设置融合参数"; MainWindow.opeation.LogType = 2; MainWindow.opeation.OptionTime = GetTime(GetTimeStamp().ToString()); MainWindow.OperationLogData.WriteOperationLog(MainWindow.opeation);//操作入库 MessageBoxX.Show("提示信息", "参数保存成功!"); this.Close(); } } catch (Exception ex) { MessageBoxX.Show("警告", "输入数据有误!请重新输入!"); } }
private void comfirmClick(object sender, RoutedEventArgs e) { if (String.IsNullOrWhiteSpace(ip.Text) || String.IsNullOrWhiteSpace(name.Text)) { MessageBoxX.Show("提示", "IP与设备名不能为空!"); } else { Regex re = new Regex(@"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$"); if (!re.IsMatch(ip.Text)) { MessageBoxX.Show("警告", "设备IP非法"); } else { try { if ((string.IsNullOrWhiteSpace(port1.Text) || (int.Parse(port1.Text) > 1024 && int.Parse(port1.Text) <= 65536)) && (string.IsNullOrWhiteSpace(port2.Text) || (int.Parse(port2.Text) > 1024 && int.Parse(port2.Text) <= 65536)) && (string.IsNullOrWhiteSpace(port3.Text) || (int.Parse(port3.Text) > 1024 && int.Parse(port3.Text) <= 65536)) && (string.IsNullOrWhiteSpace(port4.Text) || (int.Parse(port4.Text) > 1024 && int.Parse(port4.Text) <= 65536))) { int[] port = new int[4]; if (string.IsNullOrWhiteSpace(port1.Text)) { port[0] = 0; } else { port[0] = int.Parse(port1.Text); } if (string.IsNullOrWhiteSpace(port2.Text)) { port[1] = 0; } else { port[1] = int.Parse(port2.Text); } if (string.IsNullOrWhiteSpace(port3.Text)) { port[2] = 0; } else { port[2] = int.Parse(port3.Text); } if (string.IsNullOrWhiteSpace(port4.Text)) { port[3] = 0; } else { port[3] = int.Parse(port4.Text); } device.AddDeviceInfo(name.Text, ip.Text, port[0], port[1], port[2], port[3]); List <DeviceInfo> list = device.GetAllDeviceInfo();//网络参数设置 NetDevice nd = new NetDevice() { ID = NetParameterSetting.deviceList.Count, IP = list[list.Count - 1].IP, Name = list[list.Count - 1].Name, Port1 = list[list.Count - 1].Port1.ToString(), Port2 = list[list.Count - 1].Port2.ToString(), Port3 = list[list.Count - 1].Port3.ToString(), Port4 = list[list.Count - 1].Port4.ToString(), ReadOnly = true, }; NetParameterSetting.deviceList.Add(nd); this.Close(); } else { MessageBoxX.Show("提示", "端口号超出范围!"); } } catch (Exception ex) { MessageBoxX.Show("警告", "端口号应为整数!"); } } } }
private void comfirmClick(object sender, RoutedEventArgs e) { if (String.IsNullOrWhiteSpace(mmsi.Text) || String.IsNullOrWhiteSpace(number.Text)) { MessageBoxX.Show("提示", "MMSI、船舷号不能为空!"); } else { WhiteListSetting.whiteList.Clear(); List <WhiteShip> whiteListStr = new List <WhiteShip>(); whiteListStr = white.GetAllWhiteShip();//初始化白名单列表 for (int i = 0; i < whiteListStr.Count(); i++) { WhiteTarget wt = new WhiteTarget { ID = i, MMSI = whiteListStr[i].MMSI.ToString(), Number = whiteListStr[i].ShipNumber, IMO = whiteListStr[i].IMO.ToString(), CallSign = whiteListStr[i].CallID, Name = whiteListStr[i].ShipName, Department = whiteListStr[i].ShipDepartment, Usage = whiteListStr[i].ShipUsage, ReadOnly = true, }; WhiteListSetting.whiteList.Add(wt); } int count; for (count = 0; count < WhiteListSetting.whiteList.Count; count++) { if (WhiteListSetting.whiteList[count].MMSI == mmsi.Text) { MessageBoxX.Show("提示", "已存在具有相同MMSI的船只!"); break; } } if (count == WhiteListSetting.whiteList.Count) { try { WhiteShip ship = new WhiteShip(); ship.CallID = callSign.Text; if (!String.IsNullOrWhiteSpace(imo.Text)) { ship.IMO = uint.Parse(imo.Text); } ship.MMSI = int.Parse(mmsi.Text);; ship.ShipDepartment = department.Text; ship.ShipName = name.Text; ship.ShipUsage = usage.Text; ship.ShipNumber = number.Text; white.AddWhiteShip(ship); //添加白名单入库 dataAna.WhiteListSync(); //白名单同步 MainWindow.opeation.OptionName = "添加白名单"; //日志入库 MainWindow.opeation.LogType = 2; MainWindow.opeation.OptionTime = WhiteListSetting.GetTime(WhiteListSetting.GetTimeStampS().ToString()); MainWindow.OperationLogData.WriteOperationLog(MainWindow.opeation); whiteListStr = white.GetAllWhiteShip(); WhiteTarget wt = new WhiteTarget { ID = WhiteListSetting.whiteList.Count, MMSI = whiteListStr[whiteListStr.Count - 1].MMSI.ToString(), Number = whiteListStr[whiteListStr.Count - 1].ShipNumber, IMO = whiteListStr[whiteListStr.Count - 1].IMO.ToString(), CallSign = whiteListStr[whiteListStr.Count - 1].CallID, Name = whiteListStr[whiteListStr.Count - 1].ShipName, Department = whiteListStr[whiteListStr.Count - 1].ShipDepartment, Usage = whiteListStr[whiteListStr.Count - 1].ShipUsage, ReadOnly = true, }; WhiteListSetting.whiteList.Add(wt); this.Close(); } catch (Exception ex) { MessageBoxX.Show("警告", "MMSI、IMO应为整数!"); } } } }
private void getList() { child.Clear();//刷新列表 startYear = StartTime.SelectedDate.Value.Year; startMonth = StartTime.SelectedDate.Value.Month; endYear = EndTime.SelectedDate.Value.Year; endMonth = EndTime.SelectedDate.Value.Month; if (endYear != startYear) { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { MessageBoxX.Show("提示", "不支持跨年查询!"); } )); } else if (endYear == startYear) { if (title == "圈层报警") { dic = count.CountCircleProtectAreaAlarm(startYear, startMonth, endMonth, type); foreach (string key in dic.Keys) { child.Add(key); } title = "圈层报警"; } else if (title == "多边形报警") { dic = count.CountPolygonAlarm(startYear, startMonth, endMonth, type); foreach (string key in dic.Keys) { child.Add(key); } title = "多边形报警"; } else if (title == "管道报警") { dic = count.CountPipelineAlarm(startYear, startMonth, endMonth, type); foreach (string key in dic.Keys) { child.Add(key); } title = "管道报警"; } else if (title == "平台报警") { list = count.CountPlantformAlarm(startYear, startMonth, endMonth, type); child.Add("平台中心"); title = "平台中心报警"; } else if (title == "所有区域") { list = count.CountAllAlarm(startYear, startMonth, endMonth, type); child.Add("所有区域"); title = "所有区域报警"; } } }
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { child.Clear();//刷新列表 ComboBox cb = sender as ComboBox; ComboBoxItem cbi = cb.SelectedItem as ComboBoxItem; startYear = StartTime.SelectedDate.Value.Year; startMonth = StartTime.SelectedDate.Value.Month; endYear = EndTime.SelectedDate.Value.Year; endMonth = EndTime.SelectedDate.Value.Month; if (endYear != startYear) { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { MessageBoxX.Show("提示", "不支持跨年查询!"); } )); } else if (endYear == startYear) { startYear = StartTime.SelectedDate.Value.Year; startMonth = StartTime.SelectedDate.Value.Month; endYear = EndTime.SelectedDate.Value.Year; endMonth = EndTime.SelectedDate.Value.Month; if (startYear == endYear && startMonth < endMonth) { if (cbi.HasContent && cbi.Content.ToString() == "圈层报警") { dic = count.CountCircleProtectAreaAlarm(startYear, startMonth, endMonth, type); foreach (string key in dic.Keys) { child.Add(key); } title = "圈层报警"; } else if (cbi.HasContent && cbi.Content.ToString() == "多边形报警") { dic = count.CountPolygonAlarm(startYear, startMonth, endMonth, type); foreach (string key in dic.Keys) { child.Add(key); } title = "多边形报警"; } else if (cbi.HasContent && cbi.Content.ToString() == "管道报警") { dic = count.CountPipelineAlarm(startYear, startMonth, endMonth, type); foreach (string key in dic.Keys) { child.Add(key); } title = "管道报警"; } else if (cbi.HasContent && cbi.Content.ToString() == "平台报警") { list = count.CountPlantformAlarm(startYear, startMonth, endMonth, type); child.Add("平台中心"); title = "平台中心报警"; } else if (cbi.HasContent && cbi.Content.ToString() == "所有区域") { list = count.CountAllAlarm(startYear, startMonth, endMonth, type); child.Add("所有区域"); title = "所有区域报警"; } } } }
private void statisticsClick(object sender, RoutedEventArgs e) { if (childBox.Text == "") { System.Windows.Application.Current.Dispatcher.Invoke(new Action(() => { MessageBoxX.Show("提示", "未选择对应子项!"); } )); } else { startYear = StartTime.SelectedDate.Value.Year; startMonth = StartTime.SelectedDate.Value.Month; endYear = EndTime.SelectedDate.Value.Year; endMonth = EndTime.SelectedDate.Value.Month; if (startMonth > endMonth) { MessageBoxX.Show("提示", "时间设置不正常"); return; } if (endYear != startYear) { MessageBoxX.Show("提示", "不支持跨年查询!"); } else if (endYear == startYear) { mouth.Clear(); //刷新 strListx1.Clear(); //清空 strListy1.Clear(); //清空 LsTime1.Clear(); //清除 startYear = StartTime.SelectedDate.Value.Year; startMonth = StartTime.SelectedDate.Value.Month; endYear = EndTime.SelectedDate.Value.Year; endMonth = EndTime.SelectedDate.Value.Month; if (startYear == endYear) { if (title == "圈层报警") { dic = count.CountCircleProtectAreaAlarm(startYear, startMonth, endMonth, type); tip = 1; } else if (title == "多边形报警") { dic = count.CountPolygonAlarm(startYear, startMonth, endMonth, type); tip = 2; } else if (title == "管道报警") { dic = count.CountPipelineAlarm(startYear, startMonth, endMonth, type); tip = 3; } else if (title == "平台中心报警") { list = count.CountPlantformAlarm(startYear, startMonth, endMonth, type); tip = 4; } else if (title == "所有区域报警") { list = count.CountAllAlarm(startYear, startMonth, endMonth, type); tip = 5; } } if (tip == 1) { for (int i = 0; i < dic[childBox.Text].Count; i++) { mouth.Add(dic[childBox.Text][i].ToString()); } ; } else if (tip == 2) { for (int i = 0; i < dic[childBox.Text].Count; i++) { mouth.Add(dic[childBox.Text][i].ToString()); } ; } else if (tip == 3) { for (int i = 0; i < dic[childBox.Text].Count; i++) { mouth.Add(dic[childBox.Text][i].ToString()); } ; } else if (tip == 4) { for (int i = 0; i < list.Count; i++) { mouth.Add(list[i].ToString()); } ; } else if (tip == 5) { for (int i = 0; i < list.Count; i++) { mouth.Add(list[i].ToString()); } ; } //数据层 for (int a = startMonth; a <= endMonth; a++) { strListx1.Add(mouthStr[a]); strListy1.Add(mouth[a - startMonth]); LsTime1.Add(new DateTime(startYear, a, 1)); } if (chartType.Text == "柱状图") { ButColumn1.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, ButColumn1)); } if (chartType.Text == "饼状图") { ButPie1.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, ButPie1)); } if (chartType.Text == "折线图") { ButSpline1.RaiseEvent(new RoutedEventArgs(Button.ClickEvent, ButSpline1)); } } } }
private void Edit_Click(object sender, RoutedEventArgs e)//行编辑 { ToggleButton b = sender as ToggleButton; int index = int.Parse(b.Tag.ToString()); if (!polygonBtn.IsEnabled) { polygonAreaList[index].ReadOnly = !(bool)b.IsChecked; if (!polygonAreaList[index].ReadOnly) { TextBox tb = FindName(PolygonDataGrid, 1, index, "name") as TextBox; tb.Focus(); tb.SelectionStart = tb.Text.Length; for (int i = 0; i < 5; i++) { if (index != i) { ToggleButton bt = FindName("tb" + i.ToString()) as ToggleButton; bt.IsChecked = false; polygonAreaList[i].ReadOnly = !(bool)bt.IsChecked; } } } else//区域同名检测 2017/6/5 14:45 { bool isNameSame = false; TextBox tb = FindName(PolygonDataGrid, 1, index, "name") as TextBox; for (int i = 0; !String.IsNullOrWhiteSpace(polygonAreaList[i].ID); i++) { if (index != i && polygonAreaList[i].Name == tb.Text) { isNameSame = true; break; } } for (int i = 0; !String.IsNullOrWhiteSpace(pipelineAreaList[i].ID); i++) { if (pipelineAreaList[i].Name == tb.Text) { isNameSame = true; break; } } if (isNameSame) { MessageBoxX.Show("提示", "名称已存在,请修改命名!"); polygonAreaList[index].ReadOnly = false; b.IsChecked = true; tb.Focus(); tb.SelectionStart = tb.Text.Length; } else { Update_Poly_ToDB(sender, e); } } } else { pipelineAreaList[index].ReadOnly = !(bool)b.IsChecked; if (!pipelineAreaList[index].ReadOnly) { TextBox tb = FindName(PipelineDataGrid, 1, index, "name") as TextBox; tb.Focus(); tb.SelectionStart = tb.Text.Length; for (int i = 0; i < 5; i++) { if (index != i) { ToggleButton bt = FindName("tb" + i.ToString()) as ToggleButton; bt.IsChecked = false; pipelineAreaList[i].ReadOnly = !(bool)bt.IsChecked; } } } else//区域同名检测 2017/6/5 14:45 { bool isNameSame = false; TextBox tb = FindName(PipelineDataGrid, 1, index, "name") as TextBox; for (int i = 0; !String.IsNullOrWhiteSpace(pipelineAreaList[i].ID); i++) { if (index != i && pipelineAreaList[i].Name == tb.Text) { isNameSame = true; break; } } for (int i = 0; !String.IsNullOrWhiteSpace(polygonAreaList[i].ID); i++) { if (polygonAreaList[i].Name == tb.Text) { isNameSame = true; break; } } if (isNameSame) { MessageBoxX.Show("提示", "名称已存在,请修改命名!"); pipelineAreaList[index].ReadOnly = false; b.IsChecked = true; tb.Focus(); tb.SelectionStart = tb.Text.Length; } else { TextBox tbw = FindName(PipelineDataGrid, 2, index, "width") as TextBox; float ftry; if (!String.IsNullOrWhiteSpace(tbw.Text) && float.TryParse(tbw.Text, out ftry)) { if (ftry > 0 && ftry <= 100) { Update_Pipe_ToDB(sender, e); } else { MessageBoxX.Show("提示", "宽度超出范围!"); pipelineAreaList[index].ReadOnly = false; b.IsChecked = true; tbw.Focus(); tbw.SelectionStart = tbw.Text.Length; } } else { MessageBoxX.Show("警告", "宽度数据非法!"); pipelineAreaList[index].ReadOnly = false; b.IsChecked = true; tbw.Focus(); tbw.SelectionStart = tbw.Text.Length; } } } } }