Exemple #1
0
        public async Task GetMonitorData()
        {
            var wlc      = new WienerLinienContext("VgIHscNiquj8LYbV");
            var stations = await Stations.GetAllStationsAsync();

            var firstFive = stations.Take(4);
            var rtd       = new RealtimeData.RealtimeData(wlc);
            var listRbls  = firstFive.Select(item => item.Platforms[0].RblNumber).ToList();
            var mp        = new Parameters.MonitorParameters {
                Rbls = listRbls
            };
            var data = await rtd.GetMonitorDataAsync(mp);

            var a = data.Data.Monitors[0].Lines[0].Departures.Departure[0].DepartureTime.TimePlanned;

            Assert.IsFalse(data.Data.IsNull());
        }
        public static async Task <Dictionary <string, string> > GetDirections(string station, string line)
        {
            if (stations == null)
            {
                stations = await Stations.GetAllStationsAsync();
            }
            Console.WriteLine("Station=" + station + "&line=" + line + "&type=");
            var directions = (from v in stations
                              where v.Name == station
                              from p in v.Platforms
                              where p.Name == line
                              select p.RblNumber.ToString()).ToList();

            var rbls = directions.Select(int.Parse).ToList();

            var rtd = new RealtimeData.RealtimeData(Context);

            var parameters = new Parameters.MonitorParameters()
            {
                Rbls = rbls
            };
            var monitorInfo = await rtd.GetMonitorDataAsync(parameters);

            Data = monitorInfo;
            var strings = new  Dictionary <string, string>();
            var b       =
                monitorInfo.Data.Monitors.Where(i => i.Lines[0].Direction == "R" && i.Lines[0].Name == line).ToList();

            if (b.Count > 0)
            {
                strings.Add("R", ReplaceString(b.Select(i => i.Lines[0].Towards)
                                               .ToList()
                                               .First() + " "));
            }
            var c =
                monitorInfo.Data.Monitors.Where(i => i.Lines[0].Direction == "H" && i.Lines[0].Name == line).ToList();

            if (c.Count > 0)
            {
                strings.Add("H", ReplaceString(c.Select(i => i.Lines[0].Towards)
                                               .ToList()
                                               .First() + " "));
            }
            return(strings);
        }