本文整理汇总了C#中Station.UpdateStatesBasedOnValues方法的典型用法代码示例。如果您正苦于以下问题:C# Station.UpdateStatesBasedOnValues方法的具体用法?C# Station.UpdateStatesBasedOnValues怎么用?C# Station.UpdateStatesBasedOnValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Station
的用法示例。
在下文中一共展示了Station.UpdateStatesBasedOnValues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadDataGarvis
public async Task LoadDataGarvis(ObservableCollection<Station> stations)
{
stations.Clear(); //vynulovat seznam stanic
Dictionary<string, object[]> stationsDict = new Dictionary<string, object[]>(); //vytvořit nový dictionary pro stanice
stationCount = new Dictionary<int, int>(); //vytvořit nový dict pro druhy stanic???
for(int i = 1; i<=8; i++)
{
stationCount.Add(i, 0);
}
string s = RawData;
if (s != null && s.Length != 0)
{
try
{
using (StringReader reader = new StringReader(s))
{
string line;
line = reader.ReadLine();
//datetime of data
DataTime = new DateTime(Int64.Parse(line));
Station sta;
string[] sl;
while ((line = reader.ReadLine()) != null)
{
if (line.Length == 0) continue;
try
{
sl = line.Split('|');
sta = new Station();
sta.Id = Int32.Parse(sl[0]);
sta.Code = sl[1];
sta.Name = sl[2];
sta.Classification = GetClassification(sl[3]);
sta.Owner = sl[4];
sta.Position = new MyGeocoordinate(Double.Parse(sl[6], CultureInfo.InvariantCulture), Double.Parse(sl[5], CultureInfo.InvariantCulture));
sta.Quality = Int32.Parse(sl[7]);
if (sl[8] == "") sta.So2.Value = -1; else sta.So2.Value = Double.Parse(sl[8], CultureInfo.InvariantCulture);
sta.So2.State = Int32.Parse(sl[9]);
if (sl[10] == "") sta.No2.Value = -1; else sta.No2.Value = Double.Parse(sl[10], CultureInfo.InvariantCulture);
sta.No2.State = Int32.Parse(sl[11]);
if (sl[12] == "") sta.Co.Value = -1; else sta.Co.Value = Double.Parse(sl[12], CultureInfo.InvariantCulture);
sta.Co.State = Int32.Parse(sl[13]);
if (sl[14] == "") sta.O3.Value = -1; else sta.O3.Value = Double.Parse(sl[14], CultureInfo.InvariantCulture);
sta.O3.State = Int32.Parse(sl[15]);
if (sl[16] == "") sta.Pm10.Value = -1; else sta.Pm10.Value = Double.Parse(sl[16], CultureInfo.InvariantCulture);
sta.Pm10.State = Int32.Parse(sl[17]);
if (sl[18] == "") sta.Pm24.Value = -1; else sta.Pm24.Value = Double.Parse(sl[18], CultureInfo.InvariantCulture);
sta.Pm24.State = Int32.Parse(sl[19]);
//new Time of Last Image
if (sl[20] == "") sta.LastPhoto = null; else sta.LastPhoto = new DateTime(Int64.Parse(sl[20]));
sta.UpdateStatesBasedOnValues();
stations.Add(sta); // Add to list of stations
stationsDict.Add(sta.Code, new object[] {sta.Name, sta.Quality, sta.Position.Longitude, sta.Position.Latitude});
// add count
if (stationCount.ContainsKey(sta.Quality))
{
stationCount[sta.Quality]++;
}
else
{
stationCount.Add(sta.Quality, 1);
}
}
catch (Exception e)
{
throw e;
}
}
}
try
{
//zakomentováno pro účely debuggu
//await SerializationStorage.Save("stations.serial", stationsDict);
}
catch (Exception e)
{
throw e;
}
}
catch(Exception e)
{
throw e;
//.........这里部分代码省略.........