Example #1
0
 private void ExecuteHeaderClickCommand(PlaceViewModel item)
 {
     item.Expanded = !item.Expanded;
     if (!item.Expanded)
     {
         SelectedItem = null;
     }
 }
Example #2
0
        public async void PopulateListbox()
        {
            if (List.Any())
            {
                //if there are any existent items, delete them
                List.Clear();
            }

            List <Place> Places;

            if (Items.Any())
            {
                Places = new List <Place>();

                if (HidePlanned)
                {
                    //get list of places
                    foreach (Process p in Items.Where(i => i.LastStatus != ProcessStatus.Planowany))
                    {
                        int pId = p.PlaceId;

                        if (Places.Where(pl => pl.PlaceId == pId).Any())
                        {
                            //there's already such a place
                            Place nPlace = Places.Where(pl => pl.PlaceId == pId).FirstOrDefault();
                            nPlace.Processes.Add(p);
                        }
                        else
                        {
                            //no place like that yet. Have to create new one
                            Place nPlace = new Place();
                            nPlace.PlaceId  = p.PlaceId;
                            nPlace.Name     = p.PlaceName;
                            nPlace.SetId    = p.SetId ?? 0;
                            nPlace.SetName  = p.SetName;
                            nPlace.AreaId   = p.AreaId ?? 0;
                            nPlace.AreaName = p.AreaName;
                            nPlace.Image    = p.PlaceImage;
                            nPlace.Processes.Add(p);
                            Places.Add(nPlace);
                        }
                    }
                    if (Places.Any())
                    {
                        foreach (Place pl in Places)
                        {
                            PlaceViewModel vm = new PlaceViewModel(pl);
                            List.Add(vm);
                        }
                    }
                }
                else
                {
                    //get list of places
                    foreach (Process p in Items)
                    {
                        int pId = p.PlaceId;

                        if (Places.Where(pl => pl.PlaceId == pId).Any())
                        {
                            //there's already such a place
                            Place nPlace = Places.Where(pl => pl.PlaceId == pId).FirstOrDefault();
                            nPlace.Processes.Add(p);
                        }
                        else
                        {
                            //no place like that yet. Have to create new one
                            Place nPlace = new Place();
                            nPlace.PlaceId  = p.PlaceId;
                            nPlace.Name     = p.PlaceName;
                            nPlace.SetId    = p.SetId ?? 0;
                            nPlace.SetName  = p.SetName;
                            nPlace.AreaId   = p.AreaId ?? 0;
                            nPlace.AreaName = p.AreaName;
                            nPlace.Image    = p.PlaceImage;
                            nPlace.Processes.Add(p);
                            Places.Add(nPlace);
                        }
                    }
                    if (Places.Any())
                    {
                        foreach (Place pl in Places)
                        {
                            PlaceViewModel vm = new PlaceViewModel(pl);
                            List.Add(vm);
                        }
                    }
                }
            }
        }