Esempio n. 1
0
        public ProductListViewModel()
        {
            _uiMetadata = new UIMetadata {
                LabelProvider = () => "Product List"
            };

            Products = new ObservableCollection <Product>
            {
                new Product {
                    Name = "Mac Book Pro", Quantity = 2
                },
                new Product {
                    Name = "Domain Driven Design Book", Quantity = 3
                },
                new Product {
                    Name = "RAM Memory", Quantity = 23
                },
                new Product {
                    Name = "C# - Bible Book", Quantity = 15
                },
                new Product {
                    Name = "Amazon Kindle", Quantity = 12
                }
            };

            EditProductCommand = new SimpleCommand <object>(OnEditProductCommand);
        }
Esempio n. 2
0
        public AboutView()
        {
            InitializeComponent();

            _uiMetadata = new UIMetadata {
                LabelProvider = () => "About"
            };
        }
Esempio n. 3
0
        public HomeView()
        {
            InitializeComponent();

            _uiMetadata = new UIMetadata {
                LabelProvider = () => "Home"
            };
        }
Esempio n. 4
0
        public ProductEditViewModel(Product product)
        {
            _uiMetadata = new UIMetadata {
                LabelProvider = () => "Edit a product"
            };
            IsDirty = true;
            Product = product;

            SaveCommand = new SimpleCommand <object>(OnSaveCommandExecute);
        }
Esempio n. 5
0
        private IUIMetadata GetUIMetadata(object view, object viewModel)
        {
            IUIMetadata uiMetadata = null;

            var presentable = view as IPresentable;

            if (presentable != null)
            {
                uiMetadata = presentable.UIMetadata;
            }

            presentable = viewModel as IPresentable;
            if (presentable != null)
            {
                uiMetadata = presentable.UIMetadata;
            }

            return(uiMetadata);
        }
Esempio n. 6
0
 public FakeView()
 {
     UIMetadata = new UIMetadata {
         LabelProvider = () => "ViewLabel"
     };
 }
Esempio n. 7
0
 public EnumItem(IUIMetadata uiMetadata, TEnum value)
 {
     _uiMetadata = uiMetadata;
     _value      = value;
 }