示例#1
0
 private void dataService_GetRTCCompleted(object sender, GetRTCCompletedEventArgs e)
 {
     if ((e.Error == null) && (e.Result != null))
     {
         App app = Application.get_Current() as App;
         string str = "";
         StationData data = null;
         using (List<TB_RTC>.Enumerator enumerator = e.Result.GetEnumerator())
         {
             Func<StationData, bool> predicate = null;
             TB_RTC data;
             while (enumerator.MoveNext())
             {
                 data = enumerator.Current;
                 if (data.Station != str)
                 {
                     if (predicate == null)
                     {
                         predicate = x => x.ShortName == data.Station;
                     }
                     data = app.StationsList.SingleOrDefault<StationData>(predicate);
                     if (data == null)
                     {
                         continue;
                     }
                     data.SetData(data);
                     str = data.Station;
                 }
                 if (data.Pollutant == data.PriPollutant)
                 {
                     data.AQI = data.AQI;
                     data.QLevel = data.QLevel;
                     data.Quality = data.Quality;
                 }
                 IAQIData item = new IAQIData();
                 string pollutant = data.Pollutant;
                 if (pollutant != null)
                 {
                     if (!(pollutant == "PM2.5"))
                     {
                         if (pollutant == "SO2")
                         {
                             goto Label_01DA;
                         }
                         if (pollutant == "CO")
                         {
                             goto Label_023B;
                         }
                         if (pollutant == "NO2")
                         {
                             goto Label_029C;
                         }
                         if (pollutant == "O3")
                         {
                             goto Label_02FD;
                         }
                         if (pollutant == "PM10")
                         {
                             goto Label_035B;
                         }
                     }
                     else
                     {
                         item.Pollutant = "PM2.5 - 24小时";
                         item.IAQI = !data.Eval24h.HasValue ? "--" : data.Eval24h.ToString();
                         item.Quality = data.Quality;
                     }
                 }
                 goto Label_03B7;
             Label_01DA:
                 item.Pollutant = "SO2 - 1小时";
                 item.IAQI = !data.Eval24h.HasValue ? "--" : data.Eval24h.ToString();
                 item.Quality = data.Quality;
                 goto Label_03B7;
             Label_023B:
                 item.Pollutant = "CO - 1小时";
                 item.IAQI = !data.Eval24h.HasValue ? "--" : data.Eval24h.ToString();
                 item.Quality = data.Quality;
                 goto Label_03B7;
             Label_029C:
                 item.Pollutant = "NO2 - 1小时";
                 item.IAQI = !data.Eval24h.HasValue ? "--" : data.Eval24h.ToString();
                 item.Quality = data.Quality;
                 goto Label_03B7;
             Label_02FD:
                 item.Pollutant = "O3 - 1小时";
                 item.IAQI = !data.Eval24h.HasValue ? "--" : data.Eval24h.ToString();
                 item.Quality = data.Quality;
                 goto Label_03B7;
             Label_035B:
                 item.Pollutant = "PM10 - 24小时";
                 item.IAQI = !data.Eval24h.HasValue ? "--" : data.Eval24h.ToString();
                 item.Quality = data.Quality;
             Label_03B7:
                 data.IAQIDataList.Add(item);
                 WRWData data3 = new WRWData {
                     ShortName = data.ShortName,
                     Group = data.Group,
                     Pollutant = data.Pollutant,
                     Value = !data.Value.HasValue ? "--" : data.Value.ToString(),
                     AVG24h = !data.AVG24h.HasValue ? "--" : data.AVG24h.ToString(),
                     QLevel = data.QLevel,
                     Quality = data.Quality
                 };
                 data.WRWDataList.Add(data3);
                 StationPushpin station = this.GetStation(data.Station);
                 if (station != null)
                 {
                     station.set_Background(data.BackColor);
                 }
             }
         }
         this.lbl_DateTime_WRW.set_Text(app.StationsList[0].Date_Time);
         this.lbl_DateTime_AQI.set_Text(app.StationsList[0].Date_Time);
         PagedCollectionView view = new PagedCollectionView(app.StationsList) {
             GroupDescriptions = { new PropertyGroupDescription("Group") }
         };
         this.dgAQI.ItemsSource = view;
         view = new PagedCollectionView(app.StationsList) {
             GroupDescriptions = { new PropertyGroupDescription("Group") }
         };
         this.dgWRW.ItemsSource = view;
         this.bWRWDataLoaded = true;
         if (this.bWRWDataLoaded && (this.WRWChannelClicked == 1))
         {
             this.wrw_pm25.set_Visibility(0);
             (this.wrwButtons.get_Resources().get_Item("PM25Storyboard") as Storyboard).Begin();
         }
     }
 }
示例#2
0
 public StationData()
 {
     this.Station = "--";
     this.ShortName = "--";
     this.Group = "--";
     this.District = "--";
     this.Lat = 0.0;
     this.Lon = 0.0;
     this.Area = "--";
     this.Zone = "--";
     this.AQI = "--";
     this.PriPollutant = "--";
     this.QLevel = "--";
     this.RealTimeQL = "--";
     this.Quality = "--";
     this.AirDataType = "--";
     this.Prompt = "--";
     this.Date_Time = "--";
     this.BackColor = (Application.get_Current() as App).AQILevelColorsList[0];
     this.FontColor = new SolidColorBrush(Colors.get_White());
     this.WRWValue = "--";
     this.WRWCotUnit = "--";
     this.WRWBackColor = (Application.get_Current() as App).AQILevelColorsList[0];
     this.WRWDataVisibility = 1;
     this.AQIDataVisibility = 1;
     this.NoDataPrompt = "遇校准、维护、仪器故障、通讯中断、停电等情况,会发生短时数据缺测现象";
     this.IAQIDataList = new List<IAQIData>();
     IAQIData item = new IAQIData {
         Pollutant = "PM2.5\t  - 24 小时"
     };
     this.IAQIDataList.Add(item);
     item = new IAQIData {
         Pollutant = "PM10\t  - 24 小时"
     };
     this.IAQIDataList.Add(item);
     item = new IAQIData {
         Pollutant = "SO2\t  -  1  小时"
     };
     this.IAQIDataList.Add(item);
     item = new IAQIData {
         Pollutant = "NO2\t  -  1  小时"
     };
     this.IAQIDataList.Add(item);
     item = new IAQIData {
         Pollutant = "O3\t\t  -  1  小时"
     };
     this.IAQIDataList.Add(item);
     item = new IAQIData {
         Pollutant = "CO\t\t  -  1  小时"
     };
     this.IAQIDataList.Add(item);
     this.WRWDataList = new List<WRWData>();
     WRWData data2 = new WRWData {
         Pollutant = "PM2.5"
     };
     this.WRWDataList.Add(data2);
     data2 = new WRWData {
         Pollutant = "SO2"
     };
     this.WRWDataList.Add(data2);
     data2 = new WRWData {
         Pollutant = "NO2"
     };
     this.WRWDataList.Add(data2);
     data2 = new WRWData {
         Pollutant = "O3"
     };
     this.WRWDataList.Add(data2);
     data2 = new WRWData {
         Pollutant = "CO"
     };
     this.WRWDataList.Add(data2);
     data2 = new WRWData {
         Pollutant = "PM10"
     };
     this.WRWDataList.Add(data2);
 }