Beispiel #1
0
 public ResultViewModel()
 {
     if (IsInDesignMode)
     {
         // バインド用ダミーデータ
         var tp = new TransportRoute();
         tp.Name = "経路1";
         tp.TotalTime = "1時間23分";
         tp.Fare = "99999円";
         tp.Transfer = "128回";
         tp.Distance = "2.56km";
         tp.TransportInfo = new[]{
             new TransportInfo(){
                 LineColor = Colors.Red,
                 LineName = "東山線",
                 Detail = "藤ヶ丘行き",
                 Fare = "920円",
                 Origin = "高畑",
                 Destination = "藤ヶ丘",
                 DepartureTime = "2:56",
                 ArrivalTime = "5:12",
                 IsPassThru = false
             },
             new TransportInfo(){
                 LineColor = Colors.Blue,
                 LineName = "東山線",
                 Detail = "高畑行き",
                 Fare = "",
                 Origin = "藤ヶ丘",
                 Destination = "高畑",
                 DepartureTime = "5:12",
                 ArrivalTime = "10:24",
                 IsPassThru = true
             }
         };
         _routes = new[] { tp }.Select(s => new RouteViewModel(s)).ToArray();
         SearchInfo = "[DUMMY DATA]";
     }
     else
     {
         _routes = Setting.LastResult.Select(r => new RouteViewModel(r)).ToArray();
         SearchInfo = Setting.LastSearchDescription.ToString();
     }
 }
Beispiel #2
0
 public RouteViewModel(TransportRoute route)
 {
     this.Name = route.Name;
     this.TotalTime = route.TotalTime;
     this.Fare = route.Fare;
     this.TransferCount = route.Transfer;
     this.Distance = route.Distance;
     LinkedList<List<TransportInfo>> transports = new LinkedList<List<TransportInfo>>();
     route.TransportInfo.ForEach(t =>
     {
         if (!t.IsPassThru)
             transports.AddLast(new List<TransportInfo>());
         transports.Last.Value.Add(t);
     });
     TransportChunks = transports
         .Select(s => new TransportChunkViewModel(s))
         .Append(new TransportChunkViewModel(new[] { route.TransportInfo.Last() }, true))
         .ToArray();
 }