Exemplo n.º 1
0
        public ShopVM(NinjaListVM ninjaList)
        {
            this.NinjaList = ninjaList;
            using (var context = new LeagueOfNinjasEntities())
            {
                var gear = context.Gears.ToList();

                ShopItems     = new ObservableCollection <ItemVM>(gear.Select(g => new ItemVM(g)));
                TempShopItems = new ObservableCollection <ItemVM>();
            }
            ShowAddItemCommand = new RelayCommand(ShowAddItem);
            DeleteItemCommand  = new GenericCommand(DeleteItem, CanDeleteItem);

            //Switch tabs

            EditItemCommand       = new GenericCommand(ShowEditItem, CanEditMethod);
            ShowHeadCategory      = new RelayCommand(RetrieveHeadItems);
            ShowLegsCategory      = new RelayCommand(RetrieveLegsItems);
            ShowBeltCategory      = new RelayCommand(RetrieveBeltItems);
            ShowChestCategory     = new RelayCommand(RetrieveChestItems);
            ShowBootsCategory     = new RelayCommand(RetrieveBootsItems);
            ShowShouldersCategory = new RelayCommand(RetrieveShouldersItems);

            BuyItemCommand = new GenericCommand(BuyItem, CanBuyItem);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the ViewModelLocator class.
        /// </summary>
        public ViewModelLocator()
        {
            _ninjas = new NinjaListVM();
            _shop   = new ShopVM(_ninjas);
            ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);

            ////if (ViewModelBase.IsInDesignModeStatic)
            ////{
            ////    // Create design time view services and models
            ////    SimpleIoc.Default.Register<IDataService, DesignDataService>();
            ////}
            ////else
            ////{
            ////    // Create run time view services and models
            ////    SimpleIoc.Default.Register<IDataService, DataService>();
            ////}

            SimpleIoc.Default.Register <MainViewModel>();
        }
Exemplo n.º 3
0
 public AddNinjaVM(NinjaListVM ninjas)
 {
     _ninjas    = ninjas;
     Ninja      = new NinjaVM();
     AddCommand = new GenericCommand(Add, CanAdd);
 }