private async Task GetDeviceRunInfo(DeviceRunInfo device, DateTime start, int day) { List <Guid> guids = new List <Guid>(); foreach (var child in device.DeviceTreeItemViewModel.Children) { if (child is ItemTreeItemViewModel) { ItemTreeItemViewModel itemTree = child as ItemTreeItemViewModel; if (itemTree.T_Item != null && itemTree.BaseAlarmSignal is BaseWaveSignal) { guids.Add(itemTree.T_Item.Guid); } } } //htzk123,这个地方需要修改,如果新接口没有问题,那么可以不修改 var result = await _databaseComponent.GetHistoryData <D_WirelessVibrationSlot>(device.DeviceTreeItemViewModel.ServerIP, guids.ToArray(), new string[] { "T_Item_Guid", "ACQDatetime", "Result", "Unit", "AlarmGrade", "RPM", "RecordLab", "IsValidWave", "ExtraInfoJSON" }, start, start.AddDays(day), null, null); if (result == null || result.Count == 0) { return; } var infoList = result.GroupBy(p => p.T_Item_Guid, (key, group) => new { Key = key, Value = group }).Select(p => GetSubDeviceRunInfo(p.Value.ToList(), start, day)).OrderBy(p => p.RunHours).ToList(); if (infoList.Count > 0) { int count = infoList.Count; var midinfo = infoList[count / 2]; device.StartTime = start; device.EndTime = start.AddDays(day); device.RunHours = midinfo.RunHours; device.TotalHours = day * 24; device.StopHours = device.TotalHours - device.RunHours; device.PreAlarmCount = infoList.Select(p => p.PreAlarmCount).Sum(); device.AlarmCount = infoList.Select(p => p.AlarmCount).Sum(); device.DangerCount = infoList.Select(p => p.DangerCount).Sum(); device.RunInfo = midinfo.RunInfo; device.ACQDatetime = midinfo.ACQDatetime; device.RecordLab = midinfo.RecordLab; device.T_Item_Guid = midinfo.T_Item_Guid; device.RPM = (float)midinfo.RPM; device.MaxResult = midinfo.MaxResult; device.Unit = midinfo.Unit; device.AlarmGrade = midinfo.AlarmGrade; device.ItemType = device.DeviceTreeItemViewModel.Children.OfType <ItemTreeItemViewModel>().Where(p => p.T_Item != null && p.T_Item.Guid == midinfo.T_Item_Guid).Select(p => p.T_Item.ItemType).FirstOrDefault(); } }
public Organization GetNewOrganization(ItemTreeItemViewModel itemtree, ItemTreeItemViewModel recycleditemtree) { Organization organization = new Organization(); organization.Name = itemtree.T_Organization.Name; organization.Code = recycleditemtree.T_Item.Code; //维持原先 organization.Guid = recycleditemtree.T_Item.Guid.ToString(); //维持原先 organization.Level = itemtree.T_Organization.Level; organization.Create_Time = recycleditemtree.T_Item.Create_Time.GetValueOrDefault().ToString("yyyy-MM-dd HH:mm:ss"); //维持原先 organization.Modify_Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); organization.Parent_Code = itemtree.T_Organization.Parent_Code; organization.Parent_Guid = itemtree.T_Organization.Parent_Guid.ToString(); organization.Parent_Level = itemtree.T_Organization.Parent_Level.Value; return(organization); }
private async Task GetDeviceRunInfo(DeviceRunInfo device, DateTime start, int day) { List <Guid> guids = new List <Guid>(); foreach (var child in device.DeviceTreeItemViewModel.Children) { if (child is ItemTreeItemViewModel) { ItemTreeItemViewModel itemTree = child as ItemTreeItemViewModel; if (itemTree.T_Item != null && itemTree.T_Item.ItemType == (int)ChannelType.WirelessVibrationChannelInfo) { guids.Add(itemTree.T_Item.Guid); } } } var result = await _databaseComponent.GetHistoryData <D_WirelessVibrationSlot>(device.DeviceTreeItemViewModel.ServerIP, guids.ToArray(), new string[] { "T_Item_Guid", "ACQDatetime", "Result", "Unit", "AlarmGrade", "ExtraInfoJSON" }, start, start.AddDays(day), null, null); if (result == null || result.Count == 0) { return; } var infoList = result.GroupBy(p => p.T_Item_Guid, (key, group) => new { Key = key, Value = group }).Select(p => GetSubDeviceRunInfo(p.Value.ToList(), start, day)).OrderBy(p => p.RunHours).ToList(); if (infoList.Count > 0) { int count = infoList.Count; var midinfo = infoList[count / 2]; device.StartTime = start; device.EndTime = start.AddDays(day); device.RunHours = midinfo.RunHours; if (device.RunHours > day * 24) { device.RunHours = day * 24; } device.TotalHours = day * 24; device.StopHours = device.TotalHours - device.RunHours; device.PreAlarmCount = infoList.Select(p => p.PreAlarmCount).Sum(); device.AlarmCount = infoList.Select(p => p.AlarmCount).Sum(); device.DangerCount = infoList.Select(p => p.DangerCount).Sum(); device.RunInfo = midinfo.RunInfo; } }
public void GetOrganizationFromDatabase(string ip, bool isadmin) { var roots = from p in _databaseComponent.GetOrganizationData(ip) where p.Level == 0 && p.Is_Disabled == false orderby p.Sort_No select p; foreach (var root in roots.Distinct())//去重复 { if (root.NodeType == 0 && root.Is_Disabled == false) { T1_OrganizationPrivilege t_organization = null; if (isadmin == false) { t_organization = (from p in T_OrganizationPrivilege[ip] where p.T_Organization_Guid == root.Guid select p).FirstOrDefault(); } if (t_organization != null || isadmin == true) { OrganizationTreeItemViewModel organization = new OrganizationTreeItemViewModel(root, ip); OrganizationTreeItems.Add(organization); GetSubOrganization(organization, ip, isadmin); } } } //新建回收站 OrganizationTreeItemViewModel recyclednode = new OrganizationTreeItemViewModel("回收站", 0, ip); recyclednode.IsExpanded = true; RecycledTreeItems.Add(recyclednode); //回收站,有问题,htzk123,忘记是否修复了没有 var recycles = from p in _databaseComponent.GetItemData(ip) where p.Is_Disabled == true orderby p.Modify_Time select p; foreach (var recycle in recycles.Distinct())//去重复 { ItemTreeItemViewModel organization = new ItemTreeItemViewModel(recycle); recyclednode.AddChild(organization); ItemTreeItems.Add(organization); } }
private async Task SubAddData(ItemTreeItemViewModel item, string conditionWave, string conditionAlarm, object[] objectWave, object[] objectAlarm, bool showmessagbox = true) { List <IBaseAlarmSlot> result = new List <IBaseAlarmSlot>(); if (item.T_Item.ItemType == (int)ChannelType.WirelessVibrationChannelInfo) { result = await _databaseComponent.GetUniformHistoryData(item.T_Item.ItemType, item.ServerIP, item.T_Item.Guid, new string[] { "ACQDatetime", "Result", "Unit", "AlarmGrade" }, StartTime.Value, EndTime.Value, conditionWave, objectWave); } else if (item.T_Item.ItemType == (int)ChannelType.WirelessScalarChannelInfo) { result = await _databaseComponent.GetUniformHistoryData(item.T_Item.ItemType, item.ServerIP, item.T_Item.Guid, new string[] { "ACQDatetime", "Result", "Unit", "AlarmGrade" }, StartTime.Value, EndTime.Value, conditionAlarm, objectAlarm); } if (result == null || result.Count == 0) { if (showmessagbox == true) { #if XBAP MessageBox.Show("没有数据,请重新选择条件", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); #else Xceed.Wpf.Toolkit.MessageBox.Show("没有数据,请重新选择条件", "提示", MessageBoxButton.OK, MessageBoxImage.Warning); #endif } return; } for (int i = 0; i < result.Count; i++) { RMSObject amsObj = new RMSObject(); if (item.BaseAlarmSignal != null) { amsObj.OrganizationName = item.BaseAlarmSignal.OrganizationName; amsObj.DeviceName = item.BaseAlarmSignal.DeviceName; amsObj.ItemName = item.BaseAlarmSignal.ItemName; } else if (item.Parent is OrganizationTreeItemViewModel)//回收站 { amsObj.OrganizationName = "回收站"; amsObj.DeviceName = item.ServerIP; amsObj.ItemName = item.Name; } amsObj.ACQDatetime = result[i].ACQDatetime; amsObj.Result = result[i].Result.Value; amsObj.Unit = result[i].Unit; amsObj.AlarmGrade = (AlarmGrade)(result[i].AlarmGrade & 0x00ffff00); if (item.T_Item.ItemType == (int)ChannelType.WirelessVibrationChannelInfo) { if (vInfoCollection.Where(p => p.OrganizationName == amsObj.OrganizationName && p.DeviceName == amsObj.DeviceName && p.ItemName == amsObj.ItemName && p.ACQDatetime == amsObj.ACQDatetime).Count() == 0) //去重 { vInfoCollection.Add(amsObj); } } else if (item.T_Item.ItemType == (int)ChannelType.WirelessScalarChannelInfo) { if (anInfoCollection.Where(p => p.OrganizationName == amsObj.OrganizationName && p.DeviceName == amsObj.DeviceName && p.ItemName == amsObj.ItemName && p.ACQDatetime == amsObj.ACQDatetime).Count() == 0) //去重 { anInfoCollection.Add(amsObj); } } } }
private void getTree() { node1 = new OrganizationTreeItemViewModel("北京航天智控测试工厂", 0, "192.168.0.210"); node1_1 = new OrganizationTreeItemViewModel("厂区1", 2, node1); node1_2 = new OrganizationTreeItemViewModel("厂区2", 1, node1); node1_3 = new OrganizationTreeItemViewModel("厂区3", 0, node1); node1_1_1 = new DeviceTreeItemViewModel("设备1", 2, node1_1); node1_1_2 = new DeviceTreeItemViewModel("设备2", 1, node1_1); node1_1_3 = new DeviceTreeItemViewModel("设备3", 0, node1_1); node1_1_1_1 = new ItemTreeItemViewModel("测点1", 2, node1_1_1); node1_1_1_2 = new ItemTreeItemViewModel("测点2", 1, node1_1_1); node1_1_1_3 = new ItemTreeItemViewModel("测点3", 0, node1_1_1); node1_1_2_1 = new ItemTreeItemViewModel("测点4", 2, node1_1_2); node1_1_2_2 = new ItemTreeItemViewModel("测点5", 1, node1_1_2); node1_1_2_3 = new ItemTreeItemViewModel("测点6", 0, node1_1_2); node1_1_3_1 = new ItemTreeItemViewModel("测点7", 2, node1_1_3); node1_1_3_2 = new ItemTreeItemViewModel("测点8", 1, node1_1_3); node1_1_3_3 = new ItemTreeItemViewModel("测点9", 0, node1_1_3); node2 = new OrganizationTreeItemViewModel("测试工厂1", 3, ""); node3 = new OrganizationTreeItemViewModel("测试工厂2", 2, ""); node4 = new OrganizationTreeItemViewModel("测试工厂3", 1, ""); OrganizationTreeItems.Clear(); List <ItemTreeItemViewModel> item1 = new List <ItemTreeItemViewModel>(); item1.Add(node1_1_1_1); item1.Add(node1_1_1_2); item1.Add(node1_1_1_3); node1_1_1.AddChildRange(from p in item1 orderby p.T_Organization.Sort_No select p as OrganizationTreeItemViewModel); List <ItemTreeItemViewModel> item2 = new List <ItemTreeItemViewModel>(); item2.Add(node1_1_2_1); item2.Add(node1_1_2_2); item2.Add(node1_1_2_3); node1_1_2.AddChildRange(from p in item2 orderby p.T_Organization.Sort_No select p as OrganizationTreeItemViewModel); List <ItemTreeItemViewModel> item3 = new List <ItemTreeItemViewModel>(); item3.Add(node1_1_3_1); item3.Add(node1_1_3_2); item3.Add(node1_1_3_3); node1_1_3.AddChildRange(from p in item3 orderby p.T_Organization.Sort_No select p as OrganizationTreeItemViewModel); List <DeviceTreeItemViewModel> device = new List <DeviceTreeItemViewModel>(); device.Add(node1_1_1); device.Add(node1_1_2); device.Add(node1_1_3); node1_1.AddChildRange(from p in device orderby p.T_Organization.Sort_No select p as OrganizationTreeItemViewModel); List <OrganizationTreeItemViewModel> organization = new List <OrganizationTreeItemViewModel>(); organization.Add(node1_1); organization.Add(node1_2); organization.Add(node1_3); node1.AddChildRange(from p in organization orderby p.T_Organization.Sort_No select p as OrganizationTreeItemViewModel); List <OrganizationTreeItemViewModel> root = new List <OrganizationTreeItemViewModel>(); root.Add(node1); root.Add(node2); root.Add(node3); root.Add(node4); OrganizationTreeItems.AddRange(from p in root orderby p.T_Organization.Sort_No select p); RecycledTreeItems.Clear(); OrganizationTreeItemViewModel recyclednode = new OrganizationTreeItemViewModel("回收站", 0, "192.168.0.1"); recyclednode.IsExpanded = true; RecycledTreeItems.Add(recyclednode); //SaveOrganizationToDatabase(); //SaveItemToDatabase(); }
private void GetSubOrganization(OrganizationTreeItemViewModel parent_organization, string ip, bool isadmin) { if (parent_organization == null) { return; } var childs = from p in _databaseComponent.GetOrganizationData(ip) where p.Parent_Guid == parent_organization.T_Organization.Guid && p.Is_Disabled == false orderby p.Sort_No select p; foreach (var child in childs) { if (child.NodeType == 0 && child.Is_Disabled == false) { T1_OrganizationPrivilege t_organization = null; if (isadmin == false) { t_organization = (from p in T_OrganizationPrivilege[ip] where p.T_Organization_Guid == child.Guid select p).FirstOrDefault(); } if (t_organization != null || isadmin == true) { OrganizationTreeItemViewModel organization = new OrganizationTreeItemViewModel(child, parent_organization); //organization.T_Organization = child; parent_organization.AddChild(organization); GetSubOrganization(organization, ip, isadmin); } } else if (child.NodeType == 1 && child.Is_Disabled == false) { T1_OrganizationPrivilege t_organization = null; if (isadmin == false) { t_organization = (from p in T_OrganizationPrivilege[ip] where p.T_Organization_Guid == child.Guid select p).FirstOrDefault(); } if (t_organization != null || isadmin == true) { DeviceTreeItemViewModel organization = new DeviceTreeItemViewModel(child, parent_organization); parent_organization.AddChild(organization); GetSubOrganization(organization, ip, isadmin); } } else if (child.NodeType == 2 && child.Is_Disabled == false) { ItemTreeItemViewModel organization = new ItemTreeItemViewModel(child, parent_organization as DeviceTreeItemViewModel); parent_organization.AddChild(organization); //测点数据 var t_item = _databaseComponent.GetItemData(ip).Where(p => p.Is_Disabled == false && p.Guid == organization.T_Organization.Guid).FirstOrDefault(); if (t_item != null) { organization.RecoverBind(t_item); t_item.ServerIP = parent_organization.ServerIP;//改为初始化时候填充,覆盖数据库的ServerIP。 //如果彻底删除此项,必须修改//服务器IP匹配20180306 } ItemTreeItems.Add(organization); GetSubOrganization(organization, ip, isadmin); } else if (child.NodeType == 3 && child.Is_Disabled == false) { DivFreTreeItemViewModel organization = new DivFreTreeItemViewModel(child, parent_organization as ItemTreeItemViewModel); //分频数据 var t_divfre = T_DivFreInfo[ip].Where(p => p.Guid == organization.T_Organization.Guid).FirstOrDefault(); if (t_divfre != null) //分频一定不为空 { parent_organization.AddChild(organization); //否则丢弃无效分频数据 organization.T_DivFreInfo = t_divfre; DivFreTreeItems.Add(organization); //GetSubOrganization(organization, ip, isadmin);//分频下无节点 } } } }
private async void SearchAll() { HashSet <Guid> guidlist = new HashSet <Guid>(); string ip = null; DevicesView = new ObservableCollection <DeviceRunInfo>(); var deviceTrees = _cardProcess.GetDevices(selectedOrganization); if (deviceTrees == null) { return; } foreach (var deviceTree in deviceTrees) { foreach (var child in deviceTree.Children) { if (child is ItemTreeItemViewModel) { ItemTreeItemViewModel itemTree = child as ItemTreeItemViewModel; if (itemTree.T_Item != null && itemTree.T_Item.ItemType == (int)ChannelType.WirelessVibrationChannelInfo) { guidlist.Add(itemTree.T_Item.Guid); } } } if (ip == null) { ip = deviceTree.ServerIP; } } var runlist = await _databaseComponent.GetStatisticsData(ip, guidlist); if (runlist == null) { return; } var allcounts = runlist.Where(o => o.Value.ContainsKey("NormalTimeLength") && o.Value.ContainsKey("PreAlarmTimeLength") && o.Value.ContainsKey("AlarmTimeLength") && o.Value.ContainsKey("DangerTimeLength")).OrderBy(o => o.Value["NormalTimeLength"] + o.Value["PreAlarmTimeLength"] + o.Value["AlarmTimeLength"] + o.Value["DangerTimeLength"]).ToList(); foreach (var deviceTree in deviceTrees) { DeviceRunInfo device = new DeviceRunInfo(); device.DeviceTreeItemViewModel = deviceTree; var counts = allcounts.Where(o => device.DeviceTreeItemViewModel.Children.OfType <ItemTreeItemViewModel>().Select(p => p.T_Item.Guid).Contains(o.Key)).ToList(); if (counts.Count > 0) { int count = counts.Count; var alarm = counts[count / 2]; device.StartTime = new DateTime((long)alarm.Value["FirstUploadTime"]); device.EndTime = new DateTime((long)alarm.Value["LastUploadTime"]); device.RunHours = (alarm.Value["NormalTimeLength"] + alarm.Value["PreAlarmTimeLength"] + alarm.Value["AlarmTimeLength"] + alarm.Value["DangerTimeLength"]) / 3600; device.TotalHours = (device.EndTime - device.StartTime).TotalHours; device.StopHours = device.TotalHours - device.RunHours; device.PreAlarmCount = counts.Select(p => p.Value["PreAlarmCount"]).Sum(); device.AlarmCount = counts.Select(p => p.Value["AlarmCount"]).Sum(); device.DangerCount = counts.Select(p => p.Value["DangerCount"]).Sum(); } DevicesView.Add(device); } UpdateChart(); }
//从回收站删除 public void RecycleDeleteItem(IList <OrganizationTreeItemViewModel> recycled, ItemTreeItemViewModel item) { if (recycled == null && recycled.Count < 1) { return; } recycled[0].RemoveChild(item); }
//删除到回收站 public ItemTreeItemViewModel RecycleRecycledItem(IList <OrganizationTreeItemViewModel> recycled, ItemTreeItemViewModel item) { if (recycled == null && recycled.Count < 1) { return(null); } ItemTreeItemViewModel recy_item = new ItemTreeItemViewModel().RecycledItemTreeItem(item); recycled[0].AddChild(recy_item); return(recy_item); }
//添加分频时,根据测点和通道得到分频信息 public DivFreInfo GetDivFreInfo(IChannel i_channel, DivFreTreeItemViewModel divfre, ItemTreeItemViewModel item) { DivFreInfo divfreinfo = null; if (i_channel is VibrationChannelInfo) { divfreinfo = new DivFreInfo(); //CardCopyHelper.DivFreInfoLeftCopyToRight((i_channel as VibrationChannelInfo).DivFreInfo[0], divfreinfo); } if (divfreinfo != null) { var divfreinfo_copy = (i_channel as VibrationChannelInfo).DivFreInfo[0]; divfreinfo.BasedOnRPM = divfreinfo_copy.BasedOnRPM; divfreinfo.FixedFre = divfreinfo_copy.FixedFre; divfreinfo.BasedOnRange = divfreinfo_copy.BasedOnRange; if (divfreinfo.AlarmStrategy == null) { divfreinfo.AlarmStrategy = new AlarmStrategy(); } if (divfreinfo.AlarmStrategy.Absolute == null) { divfreinfo.AlarmStrategy.Absolute = new AbsoluteAlarm(); } if (divfreinfo.AlarmStrategy.Comparative == null) { divfreinfo.AlarmStrategy.Comparative = new ComparativeAlarm(); } divfreinfo.AlarmStrategy.Absolute.Category = divfreinfo_copy.AlarmStrategy.Absolute.Category; divfreinfo.AlarmStrategy.Absolute.Para = divfreinfo_copy.AlarmStrategy.Absolute.Para; divfreinfo.AlarmStrategy.Absolute.Mode = divfreinfo_copy.AlarmStrategy.Absolute.Mode; divfreinfo.AlarmStrategy.Absolute.ModeCode = divfreinfo_copy.AlarmStrategy.Absolute.ModeCode; divfreinfo.AlarmStrategy.Comparative.Range = divfreinfo_copy.AlarmStrategy.Comparative.Range; divfreinfo.AlarmStrategy.Comparative.IntevalTime = divfreinfo_copy.AlarmStrategy.Comparative.IntevalTime; divfreinfo.AlarmStrategy.Comparative.Percent = divfreinfo_copy.AlarmStrategy.Comparative.Percent; divfreinfo.AlarmStrategy.Comparative.IsAllow = divfreinfo_copy.AlarmStrategy.Comparative.IsAllow; divfreinfo.AlarmStrategy.Comparative.Para = divfreinfo_copy.AlarmStrategy.Comparative.Para; divfreinfo.Guid = divfre.T_Organization.Guid.ToString(); divfreinfo.Code = divfre.T_Organization.Code; divfreinfo.Name = divfre.T_Organization.Name; divfreinfo.Create_Time = divfre.T_Organization.Create_Time.GetValueOrDefault().ToString("yyyy-MM-dd HH:mm:ss"); divfreinfo.Modify_Time = divfre.T_Organization.Modify_Time.GetValueOrDefault().ToString("yyyy-MM-dd HH:mm:ss"); divfreinfo.Remarks = divfre.T_Organization.Remarks; divfreinfo.T_Item_Guid = item.T_Item.Guid.ToString(); divfreinfo.T_Item_Name = item.T_Item.Name; divfreinfo.T_Item_Code = item.T_Item.Code; divfreinfo.DivFreCode = 0; return(divfreinfo); } return(null); }
public async void AddData(ItemTreeItemViewModel item, DateTime start, DateTime end) { await ViewModel.AddData(item, start, end); VerticalAlignButtonClick(null, null); }
public async Task AddData(ItemTreeItemViewModel item, DateTime start, DateTime end) { string selectedip = item.ServerIP; #region 测点 if (item != null) { try { WaitInfo = "获取数据中"; Status = ViewModelStatus.Querying; if (item.T_Item.ItemType == (int)ChannelType.WirelessVibrationChannelInfo) { var result = await _databaseComponent.GetHistoryData <D_WirelessVibrationSlot>(selectedip, item.T_Item.Guid, new string[] { "ACQDatetime", "Result", "Unit", "AlarmGrade", "IsValidWave", "RecordLab", "RPM" }, start, end, null, null); result = result.Where(p => p.IsValidWave == true).ToList(); if (result == null || result.Count == 0) { return; } BaseDivfreChannelToken channeltoken = new BaseDivfreChannelToken() { DisplayName = item.BaseAlarmSignal.DeviceItemName, IP = selectedip, Guid = item.T_Item.Guid, DataContracts = result.Select(p => ClassCopyHelper.AutoCopy <D_WirelessVibrationSlot, D1_WirelessVibrationSlot>(p) as IBaseAlarmSlot).ToList(), }; foreach (var color in DefaultColors.SeriesForBlackBackgroundWpf) { if (!ColorList.Contains(color)) { ColorList.Add(color); channeltoken.SolidColorBrush = new SolidColorBrush(color); break; } } amsReplayVM.AddChannel(channeltoken); timeDomainVM.AddChannel(channeltoken); frequencyDomainVM.AddChannel(channeltoken); powerSpectrumVM.AddChannel(channeltoken); powerSpectrumDensityVM.AddChannel(channeltoken); alarmPointTrendVM.AddChannel(channeltoken); orthoDataVM.AddChannel(channeltoken); offDesignConditionVM.AddChannel(channeltoken); } else if (item.T_Item.ItemType == (int)ChannelType.WirelessScalarChannelInfo) { var result = await _databaseComponent.GetHistoryData <D_WirelessScalarSlot>(selectedip, item.T_Item.Guid, new string[] { "ACQDatetime", "Result", "Unit", "AlarmGrade" }, start, end, null, null); if (result == null || result.Count == 0) { return; } BaseAlarmChannelToken channeltoken = new BaseAlarmChannelToken() { DisplayName = item.BaseAlarmSignal.DeviceItemName, IP = selectedip, Guid = item.T_Item.Guid, DataContracts = result.Select(p => ClassCopyHelper.AutoCopy <D_WirelessScalarSlot, D1_WirelessScalarSlot>(p) as IBaseAlarmSlot).ToList(), }; foreach (var color in DefaultColors.SeriesForBlackBackgroundWpf) { if (!ColorList.Contains(color)) { ColorList.Add(color); channeltoken.SolidColorBrush = new SolidColorBrush(color); break; } } amsReplayVM.AddChannel(channeltoken); timeDomainVM.IsVisible = false; frequencyDomainVM.IsVisible = false; } } catch (Exception ex) { _eventAggregator.GetEvent <ThrowExceptionEvent>().Publish(Tuple.Create <string, Exception>("数据回放-测点查询", ex)); } finally { Status = ViewModelStatus.None; } } #endregion }