Ejemplo n.º 1
0
        /// <summary>
        /// Show the Popup for the Item
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public bool ShowPopup(ItemLocationEnum data)
        {
            PopupLoadingView.IsVisible = true;

            PopupLocationLabel.Text = "Avaliable Items for: " + data.ToMessage();
            PopupLocationValue.Text = data.ToMessage();

            PopupLocationItemListView.ItemsSource = ItemIndexViewModel.Instance.GetLocationItems(data);

            PopupLocationEnum = data;


            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Show the Popup for Selecting Items
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public bool ShowPopup(ItemLocationEnum location)
        {
            PopupItemSelector.IsVisible = true;

            PopupLocationLabel.Text = "Items for :";
            PopupLocationValue.Text = location.ToMessage();

            // Make a fake item for None
            var NoneItem = new ItemModel
            {
                Id          = null,   // will use null to clear the item
                Guid        = "None", // how to find this item amoung all of them
                ImageURI    = "icon_cancel.png",
                Name        = "None",
                Description = "None"
            };

            List <ItemModel> itemList = new List <ItemModel>
            {
                NoneItem
            };

            // Add the rest of the items to the list
            itemList.AddRange(ItemIndexViewModel.Instance.GetLocationItems(location));

            // Populate the list with the items
            PopupLocationItemListView.ItemsSource = itemList;

            // Remember the location for this popup
            PopupLocationEnum = location;

            return(true);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Look up the Item to Display
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public StackLayout GetItemToDisplay(ItemLocationEnum location)
        {
            // Defualt Image is the Plus
            var ImageSource     = "icon_cancel.png";
            var ClickableButton = true;

            // Get ItemModel
            var data = ViewModel.Data.GetItemByLocation(location);

            // ItemModel is null, no item in the location
            if (data == null)
            {
                // Show the Default Icon for the Location
                data = new ItemModel {
                    Location = location, ImageURI = ImageSource
                };

                // Turn off click action
                ClickableButton = false;
            }

            // Hookup the Image Button to show the Item picture
            var ItemButton = new ImageButton
            {
                Style  = (Style)Application.Current.Resources["ImageMediumStyle"],
                Source = data.ImageURI
            };

            if (ClickableButton)
            {
                // Add a event to the user can click the item and see more
                ItemButton.Clicked += (sender, args) => ShowPopupItem_Clicked(data);
            }

            // Add the Display Text for the item
            var ItemLabel = new Label
            {
                Text                    = location.ToMessage(),
                Style                   = (Style)Application.Current.Resources["ValueStyleMicro"],
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center,
            };

            // Put the Image Button and Text inside a layout
            var ItemStack = new StackLayout
            {
                Padding           = new Thickness(15, 12),
                Style             = (Style)Application.Current.Resources["ItemImageBox"],
                HorizontalOptions = LayoutOptions.Center,
                Children          =
                {
                    ItemButton,
                    ItemLabel
                },
            };

            return(ItemStack);
        }
        /// <summary>
        /// Look up the Item to Display
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public StackLayout GetItemToDisplay(ItemLocationEnum location)
        {
            // Defualt Image is the Plus
            var ImageSource     = "https://icons.iconarchive.com/icons/google/noto-emoji-smileys/1024/10024-thinking-face-icon.png";
            var ClickableButton = true;

            var data = ViewModel.Data.GetItemByLocation(location);

            if (data == null)
            {
                // Show the Default Icon for the Location
                data = new ItemModel {
                    Location = location, ImageURI = ImageSource
                };

                // Turn off click action
                ClickableButton = false;
            }

            // Hookup the Image Button to show the Item picture
            var ItemButton = new ImageButton
            {
                Style  = (Style)Application.Current.Resources["ImageMediumStyle"],
                Source = data.ImageURI
            };

            if (ClickableButton)
            {
                // Add a event to the user can click the item and see more
                ItemButton.Clicked += (sender, args) => ShowPopup(data);
            }

            // Add the Display Text for the item
            var ItemLabel = new Label
            {
                Text                    = location.ToMessage(),
                Style                   = (Style)Application.Current.Resources["ValueStyle"],
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center
            };

            // Put the Image Button and Text inside a layout
            var ItemStack = new StackLayout
            {
                Padding           = 3,
                Style             = (Style)Application.Current.Resources["ItemImageBox"],
                HorizontalOptions = LayoutOptions.Center,
                Children          =
                {
                    ItemButton,
                    ItemLabel
                },
            };

            return(ItemStack);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Look up the Item to Display
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public StackLayout GetItemToDisplay(ItemLocationEnum location)
        {
            // Get the Item, if it exist show the info
            // If it does not exist, show a Plus Icon for the location

            // Defualt Image is the Plus
            var ImageSource = "icon_add.png";

            var data = ViewModel.Data.GetItemByLocation(location);

            if (data == null)
            {
                data = new ItemModel {
                    Location = location, ImageURI = ImageSource
                };
            }

            // Hookup the Image Button to show the Item picture
            var ItemButton = new ImageButton
            {
                Style  = (Style)Application.Current.Resources["ImageMediumStyle"],
                Source = data.ImageURI
            };

            // Add a event to the user can click the item and see more
            ItemButton.Clicked += (sender, args) => ShowPopup(location);

            // Add the Display Text for the item
            var ItemLabel = new Label
            {
                Text                    = location.ToMessage(),
                Style                   = (Style)Application.Current.Resources["ValueStyleMicro"],
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center
            };

            // Put the Image Button and Text inside a layout
            var ItemStack = new StackLayout
            {
                Padding           = 3,
                Style             = (Style)Application.Current.Resources["ItemImageBox"],
                HorizontalOptions = LayoutOptions.Center,
                Children          =
                {
                    ItemButton,
                    ItemLabel
                },
            };

            return(ItemStack);
        }
        /// <summary>
        /// load an item
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public StackLayout LoadItem(ItemLocationEnum location)
        {
            ItemModel data = null;

            // check
            foreach (ItemModel item in newItems)
            {
                if (item.Location == location)
                {
                    data = item;
                }
            }

            // Hookup the Image Button to show the Item picture
            var ItemButton = new ImageButton
            {
                Style  = (Style)Application.Current.Resources["ItemImageClicked"],
                Source = data.ImageURI
            };

            // Add clicked method to load item info.
            ItemButton.Clicked += (sender, args) => ShowItem(data);

            // Add the Display Text for the item
            var ItemLabel = new Label
            {
                Text = location.ToMessage(),
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center
            };

            // Put the Image Button and Text inside a layout
            var ItemStack = new StackLayout
            {
                Padding           = 3,
                Style             = (Style)Application.Current.Resources["ItemImageBox"],
                HorizontalOptions = LayoutOptions.Center,
                Children          =
                {
                    ItemButton,
                    ItemLabel
                },
            };

            return(ItemStack);
        }
        /// <summary>
        /// Look up the Item to Display
        /// </summary>
        /// <param name="location"></param>
        /// <returns></returns>
        public StackLayout GetItemToDisplay(ItemLocationEnum location)
        {
            var data = ViewModel.Data.GetItemByLocation(location);

            if (data == null)
            {
                return(new StackLayout());
            }

            // Hookup the Image Button to show the Item picture
            var ItemButton = new ImageButton
            {
                Style  = (Style)Application.Current.Resources["ItemImageClicked"],
                Source = data.ImageURI
            };

            // Add clicked method to load item info.
            ItemButton.Clicked += (sender, args) => ShowItem(data);

            // Add the Display Text for the item
            var ItemLabel = new Label
            {
                Text = location.ToMessage(),
                HorizontalOptions       = LayoutOptions.Center,
                HorizontalTextAlignment = TextAlignment.Center
            };

            // Put the Image Button and Text inside a layout
            var ItemStack = new StackLayout
            {
                Padding           = 3,
                Style             = (Style)Application.Current.Resources["ItemImageBox"],
                HorizontalOptions = LayoutOptions.Center,
                Children          =
                {
                    ItemButton,
                    ItemLabel
                },
            };

            return(ItemStack);
        }