Exemplo n.º 1
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            Data.BeginUpdate();
            foreach (var item in Data)
            {
                if (item.Detect6 == null)
                {
                    UpdateRTD(item);
                }
            }
            if (Data.First().Detect6 != null)
            {
                Data.Insert(0, (RTDItem.CreateItem()));
            }
            Data.EndUpdate();

            Stations.BeginUpdate();

            if (CarIndex == 0)
            {
                Stations.First().CarNo = Data.First().CarNo;
            }
            else if (CarIndex == 4)
            {
                Stations[3].CarNo = string.Empty;
                CarIndex          = 0;
                Stations.First().CarNo = Data.First().CarNo;
            }

            if (CarIndex != 0)
            {
                Stations[CarIndex].CarNo     = Stations[CarIndex - 1].CarNo;
                Stations[CarIndex - 1].CarNo = string.Empty;
            }
            //if (CarIndex == 3)
            //    CarIndex = 0;
            //else
            CarIndex++;

            Stations.EndUpdate();
            //DispatcherService.BeginInvoke(() =>
            //{
            //   // UpdataCP(CPS.First());
            //   // UpdataCP(CP);
            //});
            //CP.Param2 = 123m;
            lala = new Random(Guid.NewGuid().GetHashCode()).Next(0, 100);
        }
 public JsRepository()
 {
     Routes   = ReadList <Route>(RoutesDb);
     Stations = ReadList <Station>(StationsDb);
     foreach (var r in Routes)
     {
         foreach (var st in r.Stations)
         {
             st.Station = Stations.First(c => c.Id == st.StationId);
         }
     }
     Users = ReadList <User>(UsersDb);
     foreach (var u in Users)
     {
         foreach (var st in u.FavoriteStations)
         {
             st.Station = Stations.First(c => c.Id == st.StationId);
         }
     }
 }