/// <summary>
 /// Tap on Empty Space
 /// </summary>
 /// <param name="obj"></param>
 private void Esvm_OnTap(EmptySpaceViewModel esvm)
 {
     esvm.OnTap -= Esvm_OnTap;
     if (EmptySpacesViewModels.Contains(esvm))
     {
         EmptySpacesViewModels.Remove(esvm);
     }
     CreateBin(esvm.Level, esvm.Section, esvm.Depth);
     MessagingCenter.Send(this, "Update");
 }
        public void DeleteBins()
        {
            List <BinViewModel> selectedlist = BinViewModels.FindAll(x => x.Selected == true);

            foreach (BinViewModel bvm in selectedlist)
            {
                DeleteBin(bvm);
                EmptySpaceViewModel esvm = new EmptySpaceViewModel(Navigation);
                esvm.Section = bvm.Section;
                esvm.Level   = bvm.Level;
                esvm.Depth   = bvm.Depth;
                esvm.OnTap  += Esvm_OnTap;
                EmptySpacesViewModels.Add(esvm);
            }
            MessagingCenter.Send(this, "Update");
        }
示例#3
0
 public void FillEmptyPositions(int Sections, int Levels)
 {
     for (int i = 1; i <= Sections; i++)
     {
         for (int j = 1; j <= Levels; j++)
         {
             BinViewModel exist = BinViewModels.Find(x => x.Level == j && x.Section == i);
             if (exist is null)
             {
                 EmptySpaceViewModel existesvm = EmptySpacesViewModels.Find(x => x.Level == j && x.Section == i);
                 if (existesvm is null)
                 {
                     EmptySpaceViewModel esvm = new EmptySpaceViewModel(Navigation);
                     esvm.Section = i;
                     esvm.Level   = j;
                     esvm.Depth   = 1;
                     esvm.OnTap  += Esvm_OnTap;
                     EmptySpacesViewModels.Add(esvm);
                 }
             }
         }
     }
 }
示例#4
0
        public void DeleteBins()
        {
            List <BinViewModel> selectedlist = BinViewModels.FindAll(x => x.IsSelected == true);

            foreach (BinViewModel bvm in selectedlist)
            {
                DeleteBin(bvm);

                for (int i = 1; i <= bvm.SectionSpan; i++)
                {
                    for (int j = 1; j <= bvm.LevelSpan; j++)
                    {
                        EmptySpaceViewModel esvm = new EmptySpaceViewModel(Navigation);
                        esvm.Section = bvm.Section + i - 1;
                        esvm.Level   = bvm.Level + j - 1;
                        esvm.Depth   = bvm.Depth;
                        esvm.OnTap  += Esvm_OnTap;
                        EmptySpacesViewModels.Add(esvm);
                    }
                }
            }
            MessagingCenter.Send(this, "Update");
        }