コード例 #1
0
        private void RemoveCampFromRoute(SelectCampViewModel camp)
        {
            camp.Selected = false;
            var stop = Route.Stops.FirstOrDefault(s => s.Camp.Id == camp.Camp.Id);

            if (stop != null)
            {
                Route.Stops.Remove(stop);
            }
        }
コード例 #2
0
        private void AddCampToRoute(SelectCampViewModel camp)
        {
            camp.Selected = true;
            var stop = new Stop()
            {
                Complete = false,
                Camp     = camp.Camp
            };

            Route.Stops.Add(stop);
        }
コード例 #3
0
 public void OnCampSelected(SelectCampViewModel camp)
 {
     if (CampIsInRoute(camp))
     {
         RemoveCampFromRoute(camp);
     }
     else
     {
         AddCampToRoute(camp);
     }
 }
コード例 #4
0
        private void RemoveCampFromRoute(SelectCampViewModel camp)
        {
            camp.Selected = false;
            // TODO: use Id instead of Name - Id is null currently
            var stop = Route.Stops.FirstOrDefault(s => s.Value.Camp.Id == camp.Camp.Key);

            if (stop.Value != null)
            {
                Route.Stops.Remove(stop.Key);
            }
        }
コード例 #5
0
        private void AddCampToRoute(SelectCampViewModel camp)
        {
            camp.Selected       = true;
            camp.Camp.Object.Id = camp.Camp.Key;
            var stop = new Stop()
            {
                Complete = false,
                Camp     = camp.Camp.Object
            };

            Route.Stops.Add(Guid.NewGuid().ToString(), stop);
        }
コード例 #6
0
 private bool CampIsInRoute(SelectCampViewModel camp)
 {
     return(Route.Stops.Exists(s => s.Camp.Id == camp.Camp.Id));
 }
コード例 #7
0
 private bool CampIsInRoute(SelectCampViewModel camp)
 {
     // TODO: use Id instead of Name - Id is null currently
     return(Route.Stops.ToList().Exists(s => s.Value.Camp.Name == camp.Camp.Object.Name));
 }