예제 #1
0
        public void NewButton_Pressed(object sender, RoutedEventArgs e)
        {
            if (!AllItems.Any() || AllItems.Count == ComboBoxBindingSources.Count)
            {
                return;
            }
            var remainingItems = AllItems.Where(x => ChosenItems.All(y => x.ID != y.ID)).ToList();

            ComboBoxBindingSources.Add(new ComboBoxBindingSource(remainingItems.First(), remainingItems));
            RefreshAvailableItems();
        }
예제 #2
0
        public ActionResult RemoveItem(long itemId)
        {
            var item = ChosenItems.FirstOrDefault(i => i.Id == itemId);

            if (item != null)
            {
                ChosenItems.Remove(item);
            }

            return(PartialView("~/Views/Plan/ChosenDestinations.cshtml", ChosenItems));
        }
예제 #3
0
        // GET: Routing
        public ActionResult Index(long townId)
        {
            var homeTown = routingService.GetHomeCoordinates(townId);

            // insert the home town for calculations:
            ChosenItems.Insert(0, homeTown);

            LastOrderedList = tspService.SolveTsp(ChosenItems);

            // Remove hometown after calculations are done:
            ChosenItems.Remove(homeTown);
            return(View(LastOrderedList));
        }
예제 #4
0
        public ActionResult GetDestinationInfo(long itemId)
        {
            var item = ChosenItems.FirstOrDefault(i => i.Id == itemId);

            if (item == null)
            {
                UserRoutes.ForEach(r =>
                {
                    item = r.Destinations?.FirstOrDefault(d => d.Id == itemId) ?? item;
                });
            }

            if (item != null)
            {
                return(PartialView("~/Views/Plan/DestinationInfo.cshtml", item));
            }

            return(Json(null));
        }