private void FillModel(List <Location> list)
 {
     if (list.Count > 0)
     {
         ClearAll();
         foreach (Location location in list)
         {
             SetDefaultSizes(location);
             LocationViewModel lvm = new LocationViewModel(Navigation, location);
             lvm.OnTap += Lvm_OnTap;
             LocationViewModels.Add(lvm);
         }
         State = ModelState.Normal;
         UpdateMinSizes();
         Rebuild(true);
     }
     else
     {
         State = ModelState.NoData;
     }
 }
Esempio n. 2
0
        private void Lvm_OnTap(LocationViewModel tappedlvm)
        {
            if (!IsEditMode)
            {
                OpenZoneSchemePage(tappedlvm);
            }
            else
            {
                UnSelectAllOthers(tappedlvm);

                if (tappedlvm.IsSelected)
                {
                    switch (tappedlvm.EditMode)
                    {
                    case SchemeElementEditMode.None:
                        break;

                    case SchemeElementEditMode.Move:
                        tappedlvm.EditMode = SchemeElementEditMode.Resize;
                        break;

                    case SchemeElementEditMode.Resize:
                        tappedlvm.IsSelected      = false;
                        SelectedLocationViewModel = null;
                        tappedlvm.EditMode        = SchemeElementEditMode.None;
                        break;

                    default:
                        throw new InvalidOperationException("LocationsViewModel Lvm_OnTap Impossible Value ");
                    }
                }
                else
                {
                    tappedlvm.IsSelected      = true;
                    SelectedLocationViewModel = tappedlvm;
                    tappedlvm.EditMode        = SchemeElementEditMode.Move;
                    MessagingCenter.Send(this, "BringToFront");
                }
            }
        }