Example #1
0
        public MultiItemUpdatePage()
        {
            InitializeComponent();

            BindingContext = viewModel = new MultiItemUpdateViewModel();
            viewModel.ViewModelMessageEvent += HandleViewModelMessage;

            NotificationPopup = DependencyService.Get <INotificationPopup>();
        }
        public UpdateMdAssignedItemPage(ItemDomainMachineDesign mdItem, ItemDomainMachineDesignDetailPage detailPage)
        {
            InitializeComponent();
            this.viewModel  = new UpdateMdAssignedItemViewModel(mdItem);
            this.detailPage = detailPage;

            viewModel.ViewModelMessageEvent += HandleViewModelMessage;

            NotificationPopup = DependencyService.Get <INotificationPopup>();

            BindingContext = this.viewModel;
        }
Example #3
0
        private void SetupView(MenuItemType itemType, int parentItemId = -1)
        {
            InitializeComponent();
            NotificationPopup = DependencyService.Get <INotificationPopup>();

            Boolean isInventory = false;

            if (itemType == MenuItemType.BrowseCatalog)
            {
                BindingContext = viewModel = new CatalogItemsViewModel(this, parentItemId);
                CdbMobileAppStorage.Instance.CatalogBrowseModeChangedEvent += OnBrowseModeChanged;
            }
            else
            {
                isInventory    = true;
                BindingContext = viewModel = new InventoryItemsViewModel(this, parentItemId);
            }

            viewModel.ViewModelMessageEvent += OnViewModelMessage;

            // Set up list view template
            var itemDataTemplate = new DataTemplate(() =>
            {
                var stackLayout     = new StackLayout();
                stackLayout.Padding = 5;
                var grid            = new Grid();
                stackLayout.Children.Add(grid);

                grid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(25)
                });
                grid.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(25)
                });

                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(40)
                });
                grid.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(1, GridUnitType.Star)
                });

                var image = new Image();
                image.SetBinding(Image.SourceProperty, "PrimaryImageUrlScaled");


                var nameLabel = new Label {
                    FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label))
                };
                var itemIdentifier1Label = new Label {
                    FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label))
                };

                nameLabel.SetBinding(Label.TextProperty, "Item.Name");
                itemIdentifier1Label.SetBinding(Label.TextProperty, "Item.ItemIdentifier1");

                grid.Children.Add(image, 0, 0);
                Grid.SetRowSpan(image, 2);

                grid.Children.Add(nameLabel, 1, 0);
                grid.Children.Add(itemIdentifier1Label, 1, 1);

                if (isInventory)
                {
                    grid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(20)
                    });

                    var catalogLabel = new Label {
                        FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label))
                    };
                    //TODO update the yaml inheritance when done to use the Catalog item.
                    //catalogLabel.SetBinding(Label.TextProperty, "Item.CatalogItem.Name");
                    catalogLabel.SetBinding(Label.TextProperty, "Item.DerivedFromItem.Name");
                    grid.Children.Add(catalogLabel, 0, 2);
                    Grid.SetColumnSpan(catalogLabel, 2);
                }


                return(new ViewCell {
                    View = stackLayout
                });
            });

            ItemsListView.ItemTemplate = itemDataTemplate;
        }