Пример #1
0
        public void Refresh()
        {
            container = DatabaseHandler.GetDatabase().GetContainer(id, container.GetLocation());

            ;
            //set title
            this.Title = container.GetName();


            //set proportions
            this.imageFrame.HeightRequest = MasterNavigationPage.current.Height / 2.0;



            //init image
            if (ImageTools.HasImage(container))
            {
                if (ImageBaseHandler.current.isContainerCached(container.GetId()))
                {
                    SetImage(ImageBaseHandler.current.GetContainerImageSource(container.GetId()));
                }
                else
                {
                    SetImage(ImageTools.LoadImage(container));
                }
            }
            else //if no image give it the place holder image
            {
                SetImage("camera");
            }



            //set colors
            this.BackgroundColor = PageColors.secondaryColor;
        }
Пример #2
0
        //makes the menu page to open
        private PopupPageMenu MakeMenuPage()
        {
            PopupPageMenu menu = new PopupPageMenu();


            //move container menu button
            Grid moveContainerGrid = menu.AddLabelAndImage("Move Container", "move_to_container");
            TapGestureRecognizer moveContainerGesture = new TapGestureRecognizer();

            ContainerWrapper containerWrapper = new ContainerWrapper();

            //to call when the container is selected
            Action callOnMoveSelected = () =>
            {
                if (containerWrapper.Container != null)
                {
                    MoveHighlightedItems(containerWrapper.Container);
                    PopupNavigation.Instance.PushAsync(new PopupTextNotification("Items moved"));
                    container = DatabaseHandler.GetDatabase().GetContainer(container.GetId(), container.GetLocation());
                    MasterNavigationPage.current.Refresh();
                }
            };


            moveContainerGesture.Tapped += (sen, e) =>
            {
                PopupNavigation.Instance.PopAsync();
                if (container.GetLocation().GetContainers().Count <= 1) //if there arent enough locations to move, display an error
                {
                    PopupNavigation.Instance.PushAsync(new PopupErrorNotification("You need more containers to do that"));
                }
                else
                {
                    Navigation.PushAsync(new ContainerSelectPage(containerWrapper, callOnMoveSelected, container.GetLocation().GetContainers(), new List <int>()
                    {
                        container.GetId()
                    }));
                }
            };
            moveContainerGrid.GestureRecognizers.Add(moveContainerGesture);


            //delete item menu button
            Grid deleteItemGrid = menu.AddLabelAndImage("Delete Items", "trash");
            TapGestureRecognizer deleteItemGesture = new TapGestureRecognizer();

            deleteItemGesture.Tapped += (sen, e) =>
            {
                if (CanDelete()) //if can delete - delete, else give error messxage
                {
                    Delete();
                    PopupNavigation.Instance.PopAsync();
                }
                else
                {
                    PopupNavigation.Instance.PushAsync(new PopupErrorNotification("Unable to delete"));
                }
            };
            deleteItemGrid.GestureRecognizers.Add(deleteItemGesture);

            return(menu);
        }
Пример #3
0
 public async void Edit()
 {
     NewContainerPage editPage = new NewContainerPage(container.GetName(), container.GetNotes(), container.GetTags(), container.GetId(), container, container.GetLocation());
     await Navigation.PushAsync(editPage);
 }