| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -60,6 +60,7 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      //   Dictionary<string, ASCiiData> cacheChartDic=new Dictionary<string, ASCiiData>();
 | 
					 | 
					 | 
					 | 
					      //   Dictionary<string, ASCiiData> cacheChartDic=new Dictionary<string, ASCiiData>();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        Dictionary<string, ASCiiData> subNameList;
 | 
					 | 
					 | 
					 | 
					        Dictionary<string, ASCiiData> subNameList;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        bool isSubScribeOK = false;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        #endregion
 | 
					 | 
					 | 
					 | 
					        #endregion
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        #region 属性
 | 
					 | 
					 | 
					 | 
					        #region 属性
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -475,7 +476,6 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                _lChartAll.EndUpdate();
 | 
					 | 
					 | 
					 | 
					                _lChartAll.EndUpdate();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        int i = 1;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private void RealTimeData(object isCheck)
 | 
					 | 
					 | 
					 | 
					        private void RealTimeData(object isCheck)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        {           
 | 
					 | 
					 | 
					 | 
					        {           
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            _channelCount = smList.Count * 3;
 | 
					 | 
					 | 
					 | 
					            _channelCount = smList.Count * 3;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -494,6 +494,7 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                {
 | 
					 | 
					 | 
					 | 
					                {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    currentOATime = 0;
 | 
					 | 
					 | 
					 | 
					                    currentOATime = 0;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    _data = new double[smList.Count * 3][];
 | 
					 | 
					 | 
					 | 
					                    _data = new double[smList.Count * 3][];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    StartChart();
 | 
					 | 
					 | 
					 | 
					                    StartChart();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    //Set real-time monitoring automatic old data destruction
 | 
					 | 
					 | 
					 | 
					                    //Set real-time monitoring automatic old data destruction
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    LChartALL.ViewXY.DropOldSeriesData = true;
 | 
					 | 
					 | 
					 | 
					                    LChartALL.ViewXY.DropOldSeriesData = true;
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -504,7 +505,7 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    LChartALL.ViewXY.XAxes[0].ScrollMode = XAxisScrollMode.Scrolling;
 | 
					 | 
					 | 
					 | 
					                    LChartALL.ViewXY.XAxes[0].ScrollMode = XAxisScrollMode.Scrolling;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    Task.Run(() =>
 | 
					 | 
					 | 
					 | 
					                    Task.Run(() =>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    {
 | 
					 | 
					 | 
					 | 
					                    {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        Thread.Sleep(5000);
 | 
					 | 
					 | 
					 | 
					                        Thread.Sleep(3000);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        time.Start();
 | 
					 | 
					 | 
					 | 
					                        time.Start();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    });
 | 
					 | 
					 | 
					 | 
					                    });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    using (RedisListService service = new RedisListService())
 | 
					 | 
					 | 
					 | 
					                    using (RedisListService service = new RedisListService())
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -517,8 +518,13 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        {
 | 
					 | 
					 | 
					 | 
					                        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            using (RedisListService service = new RedisListService())
 | 
					 | 
					 | 
					 | 
					                            using (RedisListService service = new RedisListService())
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            {
 | 
					 | 
					 | 
					 | 
					                            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                Debug.WriteLine($"注册{1}:{subName.Key}");
 | 
					 | 
					 | 
					 | 
					                                Debug.WriteLine($"注册,:{subName.Key},时间:{DateTime.Now}");
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                    if(subName.Key== subNameList.Keys.Last())
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                    {
 | 
					 | 
					 | 
					 | 
					                                    {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                        isSubScribeOK = true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                        Debug.WriteLine($"******注册完成********,:{subName.Key},时间:{DateTime.Now}");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                    service.Subscribe(subName.Key, (c, message, iRedisSubscription) =>
 | 
					 | 
					 | 
					 | 
					                                    service.Subscribe(subName.Key, (c, message, iRedisSubscription) =>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                    {
 | 
					 | 
					 | 
					 | 
					                                    {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                        if(message.Length==7 && System.Text.Encoding.Default.GetString(message)== "shutoff")
 | 
					 | 
					 | 
					 | 
					                                        if(message.Length==7 && System.Text.Encoding.Default.GetString(message)== "shutoff")
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -589,6 +595,10 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            Debug.WriteLine($"接收:{asciiData.sid}:{startTime},count:{lines.Count}");
 | 
					 | 
					 | 
					 | 
					            Debug.WriteLine($"接收:{asciiData.sid}:{startTime},count:{lines.Count}");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            string lineStr = String.Join(",", lines);
 | 
					 | 
					 | 
					 | 
					            string lineStr = String.Join(",", lines);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            if(!isSubScribeOK)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                return;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            using (RedisListService service = new RedisListService())
 | 
					 | 
					 | 
					 | 
					            using (RedisListService service = new RedisListService())
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                service.LPush(name, lineStr);
 | 
					 | 
					 | 
					 | 
					                service.LPush(name, lineStr);
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -677,16 +687,16 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            v.LegendBoxes[0].Shadow.Visible = false;
 | 
					 | 
					 | 
					 | 
					            v.LegendBoxes[0].Shadow.Visible = false;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            StationModel stationModel = smList.First();
 | 
					 | 
					 | 
					 | 
					            StationModel stationModel = smList.First();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            var beginTime= stationModel.BeginTime;
 | 
					 | 
					 | 
					 | 
					            var beginTime = DateTime.Now;//  stationModel.BeginTime;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (AxisValueType.DateTime == v.XAxes[0].ValueType)
 | 
					 | 
					 | 
					 | 
					            if (AxisValueType.DateTime == v.XAxes[0].ValueType)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //设置X轴的开始时间
 | 
					 | 
					 | 
					 | 
					                //设置X轴的开始时间
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                v.XAxes[0].AutoFormatLabels = false;
 | 
					 | 
					 | 
					 | 
					                v.XAxes[0].AutoFormatLabels = false;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                v.XAxes[0].LabelsTimeFormat = "HH:mm:ss.ff";
 | 
					 | 
					 | 
					 | 
					                v.XAxes[0].LabelsTimeFormat = "HH:mm:ss.ff";
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                v.XAxes[0].DateOriginYear = beginTime.Year;
 | 
					 | 
					 | 
					 | 
					               // v.XAxes[0].DateOriginYear = beginTime.Year;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                v.XAxes[0].DateOriginDay = beginTime.Day;
 | 
					 | 
					 | 
					 | 
					              //  v.XAxes[0].DateOriginDay = beginTime.Day;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                v.XAxes[0].DateOriginMonth = beginTime.Month;
 | 
					 | 
					 | 
					 | 
					              //  v.XAxes[0].DateOriginMonth = beginTime.Month;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                DateTime MaxDateTime = beginTime.AddSeconds(_samplingFrequency == 500 ? 30 : 60);
 | 
					 | 
					 | 
					 | 
					                DateTime MaxDateTime = beginTime.AddSeconds(_samplingFrequency == 500 ? 31 : 61);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                v.XAxes[0].SetRange(v.XAxes[0].DateTimeToAxisValue(beginTime), v.XAxes[0].DateTimeToAxisValue(MaxDateTime));
 | 
					 | 
					 | 
					 | 
					                v.XAxes[0].SetRange(v.XAxes[0].DateTimeToAxisValue(beginTime), v.XAxes[0].DateTimeToAxisValue(MaxDateTime));
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            double firstSampleTimeStamp = v.XAxes[0].DateTimeToAxisValue(beginTime);
 | 
					 | 
					 | 
					 | 
					            double firstSampleTimeStamp = v.XAxes[0].DateTimeToAxisValue(beginTime);
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -864,15 +874,20 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private void CompositionTarget_Rendering(object sender, System.Timers.ElapsedEventArgs e)
 | 
					 | 
					 | 
					 | 
					        private void CompositionTarget_Rendering(object sender, System.Timers.ElapsedEventArgs e)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        {
 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					             RenderNextFrame();
 | 
					 | 
					 | 
					 | 
					             RenderNextFrame();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            //_dispatcher.Invoke(() =>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            //{
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                   //测试数据
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					              //    FeedDataTest();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            //});
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        static double currentOATime = 0;
 | 
					 | 
					 | 
					 | 
					        static double currentOATime = 0;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<string> tempData = new List<string>();
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private void RenderNextFrame()
 | 
					 | 
					 | 
					 | 
					        private void RenderNextFrame()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        {
 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            Stopwatch stopwatch = Stopwatch.StartNew();
 | 
					 | 
					 | 
					 | 
					            Stopwatch stopwatch = Stopwatch.StartNew();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            string minName = string.Empty;
 | 
					 | 
					 | 
					 | 
					            string minName = string.Empty;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (_lChartAll == null)
 | 
					 | 
					 | 
					 | 
					            if (_lChartAll == null && !isSubScribeOK)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                Debug.WriteLine("注册未完成,时间:{1}", DateTime.Now);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return;
 | 
					 | 
					 | 
					 | 
					                return;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            List<double> datasStr = new List<double>();
 | 
					 | 
					 | 
					 | 
					            List<double> datasStr = new List<double>();
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -926,19 +941,18 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        }
 | 
					 | 
					 | 
					 | 
					                        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        else if ((currentTime - firstTime).TotalSeconds < 0)
 | 
					 | 
					 | 
					 | 
					                        else if ((currentTime - firstTime).TotalSeconds < 0)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        {
 | 
					 | 
					 | 
					 | 
					                        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            _data[item.Value.Index] = new double[datasStr.Count];
 | 
					 | 
					 | 
					 | 
					                            _data[item.Value.Index] = new double[_samplingFrequency];
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        }
 | 
					 | 
					 | 
					 | 
					                        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        else if ((currentTime - firstTime).TotalSeconds > 0)
 | 
					 | 
					 | 
					 | 
					                        else if ((currentTime - firstTime).TotalSeconds > 0)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        {
 | 
					 | 
					 | 
					 | 
					                        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            firstTime.AddMilliseconds(-firstTime.Millisecond);
 | 
					 | 
					 | 
					 | 
					                            firstTime.AddMilliseconds(-firstTime.Millisecond);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            //出更数据需要重新绘图表点
 | 
					 | 
					 | 
					 | 
					                            //出更数据需要重新绘图表点
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            _data[item.Value.Index] = new double[datasStr.Count];
 | 
					 | 
					 | 
					 | 
					                            _data[item.Value.Index] = new double[_samplingFrequency];
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            int offset = (int)(currentTime - firstTime).TotalSeconds;
 | 
					 | 
					 | 
					 | 
					                            int offset = (int)(currentTime - firstTime).TotalSeconds;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            while (offset > 0)
 | 
					 | 
					 | 
					 | 
					                            while (offset > 0)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            {
 | 
					 | 
					 | 
					 | 
					                            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                service.RemoveStartFromList(item.Key);
 | 
					 | 
					 | 
					 | 
					                                service.RemoveStartFromList(item.Key);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                tempData.Add(item.Key+ firstTime);                             
 | 
					 | 
					 | 
					 | 
					                                if (offset < 30)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                if (offset < 60)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                {
 | 
					 | 
					 | 
					 | 
					                                {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                    // 不能超过缓存数, 更新数据
 | 
					 | 
					 | 
					 | 
					                                    // 不能超过缓存数, 更新数据
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                    var time = currentTime.AddSeconds(-offset);
 | 
					 | 
					 | 
					 | 
					                                    var time = currentTime.AddSeconds(-offset);
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -964,136 +978,186 @@ namespace StartServerWPF.Modules.MseedChart.ViewModels
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    }
 | 
					 | 
					 | 
					 | 
					                    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    else
 | 
					 | 
					 | 
					 | 
					                    else
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    {
 | 
					 | 
					 | 
					 | 
					                    {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        _data[item.Value.Index] = new double[500];
 | 
					 | 
					 | 
					 | 
					                        _data[item.Value.Index] = new double[_samplingFrequency];
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    }
 | 
					 | 
					 | 
					 | 
					                    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }
 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                item.Value.AddData(currentOATime, _data[item.Value.Index]);
 | 
					 | 
					 | 
					 | 
					                item.Value.AddData(currentOATime, _data[item.Value.Index]);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }            
 | 
					 | 
					 | 
					 | 
					            }            
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            stopwatch.Stop();
 | 
					 | 
					 | 
					 | 
					            stopwatch.Stop();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            double time1 = stopwatch.ElapsedMilliseconds;
 | 
					 | 
					 | 
					 | 
					            double time1 = stopwatch.ElapsedMilliseconds;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            stopwatch.Start();
 | 
					 | 
					 | 
					 | 
					            stopwatch.Restart();
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            bool isRefresh = false;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            //有新数据开始刷新
 | 
					 | 
					 | 
					 | 
					            //有新数据开始刷新
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (tempData.Count > 5)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            DateTime startTime = DateTime.Today;
 | 
					 | 
					 | 
					 | 
					            DateTime startTime = DateTime.Today;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            foreach (var item in subNameList)
 | 
					 | 
					 | 
					 | 
					            foreach (var item in subNameList)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                List<double> temDou = new List<double>();
 | 
					 | 
					 | 
					 | 
					                List<double> temDou = new List<double>();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    var number = item.Value.datas.Count;
 | 
					 | 
					 | 
					 | 
					                item.Value.datas.ForEach(d => temDou.AddRange(d));
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    for (int i = 0; i < number; i++)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        temDou.AddRange(item.Value.datas[i]);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                _data[item.Value.Index] = temDou.ToArray();
 | 
					 | 
					 | 
					 | 
					                _data[item.Value.Index] = temDou.ToArray();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    if (startTime == DateTime.Today)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        startTime = DateTime.FromOADate(item.Value.StartOATime).AddSeconds(-item.Value.datas.Count);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                _lChartAll.ViewXY.XAxes[0].SetRange(_lChartAll.ViewXY.XAxes[0].DateTimeToAxisValue(startTime),
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                _lChartAll.ViewXY.XAxes[0].DateTimeToAxisValue(startTime.AddSeconds(30)));
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                LChartALL.ViewXY.DropOldSeriesData = true;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                _pointsAppended = LChartALL.ViewXY.XAxes[0].Minimum;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                isRefresh = true;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                tempData.Clear();
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            stopwatch.Stop();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            double time2 = stopwatch.ElapsedMilliseconds;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            stopwatch.Restart();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            _dispatcher.Invoke(() =>
 | 
					 | 
					 | 
					 | 
					            _dispatcher.Invoke(() =>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                FeedData(isRefresh /*chartTitleText*/);
 | 
					 | 
					 | 
					 | 
					                FeedData();
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            });
 | 
					 | 
					 | 
					 | 
					            });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            stopwatch.Stop();
 | 
					 | 
					 | 
					 | 
					            stopwatch.Stop();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            double time2 = stopwatch.ElapsedMilliseconds;
 | 
					 | 
					 | 
					 | 
					            double time3 = stopwatch.ElapsedMilliseconds;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            Debug.WriteLine("timeFrame:{0},time1:{1},time1:{2}", DateTime.FromOADate(currentOATime), time1, time2);
 | 
					 | 
					 | 
					 | 
					            Debug.WriteLine("timeFrame:{0},time1:{1},time2:{2},time3:{3}", DateTime.FromOADate(currentOATime), time1, time2,time3);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        double _pointsAppended = 0;
 | 
					 | 
					 | 
					 | 
					        double _pointsAppended = 0;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        double[][] _data;
 | 
					 | 
					 | 
					 | 
					        double[][] _data;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        private void FeedData(bool isRefresh)
 | 
					 | 
					 | 
					 | 
					        private void FeedData()
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        {
 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (_lChartAll == null) return;
 | 
					 | 
					 | 
					 | 
					            if (_lChartAll == null) return;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            _lChartAll.BeginUpdate();
 | 
					 | 
					 | 
					 | 
					            _lChartAll.BeginUpdate();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (isRefresh)
 | 
					 | 
					 | 
					 | 
					            foreach (var item in _lChartAll.ViewXY.SampleDataSeries)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                for (int seriesIndex = 0; seriesIndex < _channelCount; seriesIndex++)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    _lChartAll.ViewXY.SampleDataSeries[seriesIndex].Clear();
 | 
					 | 
					 | 
					 | 
					                item.Clear();
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }
 | 
					 | 
					 | 
					 | 
					                item.FirstSampleTimeStamp =  _lChartAll.ViewXY.XAxes[0].Minimum;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //foreach (var item in subNameList.Values)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //{
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //    startTime = DateTime.FromOADate(item.StartOATime).AddSeconds(item.datas.Count);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //    _lChartAll.ViewXY.XAxes[0].SetRange(_lChartAll.ViewXY.XAxes[0].DateTimeToAxisValue(startTime),
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //    _lChartAll.ViewXY.XAxes[0].DateTimeToAxisValue(startTime.AddSeconds(60)));
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //    LChartALL.ViewXY.DropOldSeriesData = true;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //    _pointsAppended = LChartALL.ViewXY.XAxes[0].Minimum;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //    var number = item.datas.Count;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //    for (int i = 0; i < number; i++)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //    {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //        foreach (var d in subNameList)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //        {
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //            double[] thisSeriesData = subNameList[d.Key].datas[i];
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //            _lChartAll.ViewXY.SampleDataSeries[d.Value.Index].AddSamples(thisSeriesData, false);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //        }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //        _pointsAppended += 1;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //        //Set X axis real-time scrolling position 
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //        double last = _pointsAppended;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //        _lChartAll.ViewXY.XAxes[0].ScrollPosition = last;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //    }
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //    break;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //}
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            //Append data to series
 | 
					 | 
					 | 
					 | 
					            //Append data to series
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            for (int seriesIndex = 0; seriesIndex < _channelCount; seriesIndex++)
 | 
					 | 
					 | 
					 | 
					            System.Threading.Tasks.Parallel.For(0, _channelCount, (seriesIndex) =>
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                double[] thisSeriesData = _data[seriesIndex];
 | 
					 | 
					 | 
					 | 
					                double[] thisSeriesData = _data[seriesIndex];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                _lChartAll.ViewXY.YAxes[seriesIndex].SetRange(thisSeriesData.Min(), thisSeriesData.Max()+1);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                _lChartAll.ViewXY.SampleDataSeries[seriesIndex].AddSamples(thisSeriesData, false);
 | 
					 | 
					 | 
					 | 
					                _lChartAll.ViewXY.SampleDataSeries[seriesIndex].AddSamples(thisSeriesData, false);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                _data[seriesIndex] = null;
 | 
					 | 
					 | 
					 | 
					               // _data[seriesIndex] = null;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //    System.Diagnostics.Debug.WriteLine("***********index:{0}, pointCount:{1},time:{2}", seriesIndex,
 | 
					 | 
					 | 
					 | 
					                System.Diagnostics.Debug.WriteLine("***********index:{0}, pointCount:{1}", seriesIndex,
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //                       _lChartAll.ViewXY.SampleDataSeries[seriesIndex].PointCount, DateTime.Now);
 | 
					 | 
					 | 
					 | 
					                                  _lChartAll.ViewXY.SampleDataSeries[seriesIndex].PointCount);
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            });
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            _pointsAppended += 1;
 | 
					 | 
					 | 
					 | 
					            _pointsAppended += 1;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            //Set X axis real-time scrolling position 
 | 
					 | 
					 | 
					 | 
					            //Set X axis real-time scrolling position 
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            double lastX = _pointsAppended;
 | 
					 | 
					 | 
					 | 
					            double lastX = _pointsAppended * XInterval;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            _lChartAll.ViewXY.XAxes[0].ScrollPosition = lastX;
 | 
					 | 
					 | 
					 | 
					            _lChartAll.ViewXY.XAxes[0].ScrollPosition = lastX;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            _lChartAll.EndUpdate();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            //Update sweep bands
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (_lChartAll.ViewXY.XAxes[0].ScrollMode == XAxisScrollMode.Sweeping)
 | 
					 | 
					 | 
					 | 
					        //Append data point per round count
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        private int _appendCountPerRound=30000;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        //X axis length 
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        private double _xLen;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        //Generate this many rounds of data 
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        private const int PreGenerateDataForRoundCount = 10;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        //X data point step
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        private const double XInterval = 1;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        //Data feeding round 
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        private int _iRound = 0;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        //Y axis minimum 
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        private const double YMin = 0;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        //Y axis maximum 
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        private const double YMax = 100;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        private double[][] CreateInputData(int seriesCount, int appendCountPerRound)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        {
 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //Dark band of old page fading away 
 | 
					 | 
					 | 
					 | 
					            //Create input data for all series. 
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                double pageLen = _lChartAll.ViewXY.XAxes[0].Maximum - _lChartAll.ViewXY.XAxes[0].Minimum;
 | 
					 | 
					 | 
					 | 
					            double[][] data = new double[seriesCount][];
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                double sweepGapWidth = pageLen / 20.0;
 | 
					 | 
					 | 
					 | 
					            //  System.Threading.Tasks.Parallel.For(0, seriesCount, (seriesIndex) =>
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                _lChartAll.ViewXY.Bands[0].SetValues(lastX - pageLen, lastX - pageLen + sweepGapWidth);
 | 
					 | 
					 | 
					 | 
					            for (int seriesIndex = 0; seriesIndex < seriesCount; seriesIndex++)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if (_lChartAll.ViewXY.Bands[0].Visible == false)
 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                int dataPointCount = PreGenerateDataForRoundCount * appendCountPerRound;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                double[] seriesData = new double[dataPointCount];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                float seriesIndexPlus1 = seriesIndex + 1;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                Random rand = new Random((int)DateTime.Now.Ticks / (seriesIndex + 1));
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                double y = 50;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                for (int i = 0; i < dataPointCount; i++)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    y = y - 0.05 + rand.NextDouble() / 10.0;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    if (y > YMax)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                        y = YMax;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    if (y < YMin)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    {
 | 
					 | 
					 | 
					 | 
					                    {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    _lChartAll.ViewXY.Bands[0].Visible = true;
 | 
					 | 
					 | 
					 | 
					                        y = YMin;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    }
 | 
					 | 
					 | 
					 | 
					                    }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    seriesData[i] = (float)y;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                data[seriesIndex] = seriesData;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            }//);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //Bright new page band
 | 
					 | 
					 | 
					 | 
					            return data;
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                _lChartAll.ViewXY.Bands[1].SetValues(lastX - sweepGapWidth / 6, lastX);
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if (_lChartAll.ViewXY.Bands[1].Visible == false)
 | 
					 | 
					 | 
					 | 
					        private void PrefillChartWithData()
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        {
 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    _lChartAll.ViewXY.Bands[1].Visible = true;
 | 
					 | 
					 | 
					 | 
					            /*  test  
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            _lChartAll.BeginUpdate();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            _data = CreateInputData(smList.Count * 3, _appendCountPerRound);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            LChartALL.ViewXY.DropOldSeriesData = true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            _pointsAppended = LChartALL.ViewXY.XAxes[0].Minimum;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            time.Elapsed -= CompositionTarget_Rendering;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            time.Elapsed += CompositionTarget_Rendering;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            LChartALL.ViewXY.XAxes[0].ScrollMode = XAxisScrollMode.Scrolling;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            LChartALL.ViewXY.AxisLayout.AutoShrinkSegmentsGap = true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            _lChartAll.EndUpdate();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            time.Start();*/
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            //Set data almost till the end, 
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            //so it will reach end and start scrolling quite soon. 
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            //How many rounds to prefill in the series 
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            int roundsToPrefill = 50;// (int)(0.9 * _xLen) / _appendCountPerRound;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            //How many points to prefill in the series
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            int pointCount = roundsToPrefill * _appendCountPerRound;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            System.Threading.Tasks.Parallel.For(0, _channelCount, (seriesIndex) =>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                double[] thisSeriesData = _data[seriesIndex];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                for (int round = 0; round < roundsToPrefill; round++)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    float[] dataArray = new float[_appendCountPerRound];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    Array.Copy(thisSeriesData, (round % PreGenerateDataForRoundCount) * _appendCountPerRound, dataArray, 0, _appendCountPerRound);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    _lChartAll.ViewXY.SampleDataBlockSeries[seriesIndex].AddSamples(dataArray, false);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }
 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            _pointsAppended += pointCount;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            _iRound += roundsToPrefill;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            //Set X axis real-time scrolling position 
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            double lastX = _pointsAppended * XInterval;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            _lChartAll.ViewXY.XAxes[0].ScrollPosition = lastX;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            else
 | 
					 | 
					 | 
					 | 
					        private void FeedDataTest(/*string chartTitleText*/)
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (_lChartAll != null)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            {
 | 
					 | 
					 | 
					 | 
					            {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //Hide sweeping bands if not in sweeping mode
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //if (_lChartAll.ViewXY.Bands[0].Visible == true)
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //{
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //    _lChartAll.ViewXY.Bands[0].Visible = false;
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //}
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //if (_lChartAll.ViewXY.Bands[1].Visible == true)
 | 
					 | 
					 | 
					 | 
					                _lChartAll.BeginUpdate();
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //{
 | 
					 | 
					 | 
					 | 
					                foreach (var item in _lChartAll.ViewXY.SampleDataSeries)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //    _lChartAll.ViewXY.Bands[1].Visible = false;
 | 
					 | 
					 | 
					 | 
					                {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //}
 | 
					 | 
					 | 
					 | 
					                    item.Clear();
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    item.FirstSampleTimeStamp =  _lChartAll.ViewXY.XAxes[0].Minimum;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }
 | 
					 | 
					 | 
					 | 
					                }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    //Append data to series
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                 System.Threading.Tasks.Parallel.For(0, _channelCount, (seriesIndex) =>
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    double[] thisSeriesData = _data[seriesIndex];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    double[] dataToAppendNow = new double[_appendCountPerRound];
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    Array.Copy(thisSeriesData, (_iRound % PreGenerateDataForRoundCount) * _appendCountPerRound, dataToAppendNow, 0, _appendCountPerRound);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    _lChartAll.ViewXY.YAxes[seriesIndex].SetRange(dataToAppendNow.Min(), dataToAppendNow.Max());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    _lChartAll.ViewXY.SampleDataSeries[seriesIndex].AddSamples(dataToAppendNow, false);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    System.Diagnostics.Debug.WriteLine("***********index:{0}, pointCount:{1}", seriesIndex,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                                      _lChartAll.ViewXY.SampleDataSeries[seriesIndex].PointCount);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                _pointsAppended += 1;//;_appendCountPerRound;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                //Set X axis real-time scrolling position 
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                double lastX = _pointsAppended * XInterval;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                _lChartAll.ViewXY.XAxes[0].ScrollPosition = lastX;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                _lChartAll.EndUpdate();
 | 
					 | 
					 | 
					 | 
					                _lChartAll.EndUpdate();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                _iRound++;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
					 | 
					 | 
					 | 
					        public void OnNavigatedTo(NavigationContext navigationContext)
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |