Ejemplo n.º 1
0
 public StationViewModel(StationLocationViewModel location, StationAvailabilityViewModel availability)
 {
     events = IoC.Get<IEventAggregator>();
     cityContext = IoC.Get<CityContextViewModel>();
     this.Location = location;
     this.Availability = availability;
     if (location != null)
     {
         Location.ActivateWith(this);
         Location.DeactivateWith(this);
     }
 }
Ejemplo n.º 2
0
        private void HandleRouteCalculated(IEnumerable<GeoCoordinate> points, StationLocationViewModel station)
        {
            try
            {
                Execute.OnUIThread(() =>
                {
                    if (mapLine == null)
                    {
                        mapLine = new MapPolyline();
                        mapLine.StrokeColor = Color.FromArgb(178, 0, 0, 255);
                        mapLine.StrokeThickness = 5;
                        view.Map.MapElements.Add(mapLine);
                    }

                    mapLine.Path.Clear();
                    foreach (var point in points)
                        mapLine.Path.Add(point);
                });
            }
            finally
            {
                station.OnRouteCalculated -= HandleRouteCalculated;
                events.Publish(BusyState.NotBusy());
            }
        }
Ejemplo n.º 3
0
 public StationViewModel(StationLocationViewModel location)
     : this(location, null)
 {
 }
        public int PageSize = 10;  // ten items per page

        // GET: StationLocations
        public ActionResult Index(string type, string searchString, int page = 1)
        {
            Session["searchString"] = null;
            Session["type"]         = null;
            if (!string.IsNullOrEmpty(type))
            {
                Session["type"] = type;
                StationLocationViewModel model = new StationLocationViewModel
                {
                    StationLocations = db.StationLocations
                                       .OrderBy(d => d.StationName)
                                       .Where(s => s.StationType.Equals(type))
                                       .Skip((page - 1) * PageSize)
                                       .Take(PageSize),
                    PagingInfo = new PagingInfo
                    {
                        CurrentPage  = page,
                        ItemsPerPage = PageSize,
                        TotalItems   = db.StationLocations.Where(s => s.StationType.Equals(type)).Count()
                    }
                };

                return(View(model));
            }
            else if (!string.IsNullOrEmpty(searchString))
            {
                Session["searchString"] = searchString;
                StationLocationViewModel model = new StationLocationViewModel
                {
                    StationLocations = db.StationLocations
                                       .OrderBy(d => d.StationName)
                                       .Where(s => s.StationType.Equals(searchString) || s.StationName.Contains(searchString))
                                       .Skip((page - 1) * PageSize)
                                       .Take(PageSize),
                    PagingInfo = new PagingInfo
                    {
                        CurrentPage  = page,
                        ItemsPerPage = PageSize,
                        TotalItems   = db.StationLocations.Where(s => s.StationType.Equals(searchString) || s.StationName.Contains(searchString)).Count()
                    }
                };

                return(View(model));
            }
            else
            {
                StationLocationViewModel model = new StationLocationViewModel
                {
                    StationLocations = db.StationLocations
                                       .OrderBy(d => d.StationName)
                                       .Skip((page - 1) * PageSize)
                                       .Take(PageSize).ToList(),
                    PagingInfo = new PagingInfo
                    {
                        CurrentPage  = page,
                        ItemsPerPage = PageSize,
                        TotalItems   = db.StationLocations.Count()
                    }
                };

                return(View(model));
            }
        }