public CreateEquipmentVM(EquipmentOverviewVM equipmentOverview)
 {
     _equipmentOverview = equipmentOverview;
     Equipment          = new EquipmentVM();
     using (var context = new NinjaManagerEntities())
     {
         var categories = context.Category.ToList().Select(c => new CategoryVM(c).Name);
         Categories = new ObservableCollection <string>(categories);
     }
     SaveEquipmentCommand = new RelayCommand(() =>
     {
         using (var context = new NinjaManagerEntities())
         {
             context.Equipment.Add(Equipment.ToModel());
             if (Equipment.Name != null && Equipment.Picture != null)
             {
                 context.SaveChanges();
                 _equipmentOverview.Equipment.Add(Equipment);
             }
         }
     });
     LoadImageCommand = new RelayCommand(() =>
     {
         Equipment.Picture = FileLoader.LoadImage();
     });
 }
 public void UpdateItem()
 {
     HeadItem     = SelectedNinja.Equipment.Where(s => s.EquipmentCategory.Trim().Equals("Head")).FirstOrDefault();
     ShoulderItem = SelectedNinja.Equipment.Where(s => s.EquipmentCategory.Trim().Equals("Shoulders")).FirstOrDefault();
     ChestItem    = SelectedNinja.Equipment.Where(s => s.EquipmentCategory.Trim().Equals("Chest")).FirstOrDefault();
     BeltItem     = SelectedNinja.Equipment.Where(s => s.EquipmentCategory.Trim().Equals("Belt")).FirstOrDefault();
     LegsItem     = SelectedNinja.Equipment.Where(s => s.EquipmentCategory.Trim().Equals("Legs")).FirstOrDefault();
     BootsItem    = SelectedNinja.Equipment.Where(s => s.EquipmentCategory.Trim().Equals("Boots")).FirstOrDefault();
 }
Beispiel #3
0
 private string output(EquipmentVM equipment)
 {
     if (equipment != null)
     {
         return(equipment.Category + Environment.NewLine +
                equipment.Name + Environment.NewLine +
                "Strength = " + equipment.Strenght + Environment.NewLine +
                "Intelligence = " + equipment.Intelligence + Environment.NewLine +
                "Agility = " + equipment.Agility);
     }
     else
     {
         return("geen item");
     }
 }
Beispiel #4
0
 private void deleteFields()
 {
     _head      = null;
     Head       = output(null);
     _chest     = null;
     Chest      = output(null);
     _boots     = null;
     Boots      = output(null);
     _belt      = null;
     Belt       = output(null);
     _legs      = null;
     Legs       = output(null);
     _shoulders = null;
     Shoulders  = output(null);
     TotalGold  = updateGold();
     Values     = updateStats();
 }
Beispiel #5
0
 public InventoryVM(MainViewModel main)
 {
     _main = main;
     Ninja = _main.SelectedNinja;
     DeleteAllEquipment = new RelayCommand(deleteAllEquipment);
     foreach (EquipmentVM equipmentVM in Ninja.Inventory)
     {
         totalsStrength     += equipmentVM.Strenght;
         totalsIntelligence += equipmentVM.Intelligence;
         totalsAgillity     += equipmentVM.Agility;
         totalGold          += equipmentVM.Gold;
         if (equipmentVM.Category == "Head")
         {
             _head = equipmentVM;
         }
         if (equipmentVM.Category == "Chest")
         {
             _chest = equipmentVM;
         }
         if (equipmentVM.Category == "Shoulders")
         {
             _shoulders = equipmentVM;
         }
         if (equipmentVM.Category == "Legs")
         {
             _legs = equipmentVM;
         }
         if (equipmentVM.Category == "Belt")
         {
             _belt = equipmentVM;
         }
         if (equipmentVM.Category == "Boots")
         {
             _boots = equipmentVM;
         }
     }
     Head      = output(_head);
     Chest     = output(_chest);
     Shoulders = output(_shoulders);
     Legs      = output(_legs);
     Belt      = output(_belt);
     Boots     = output(_boots);
     TotalGold = updateGold();
     Values    = updateStats();
 }
 public EditItemViewModel(EquipmentVM selectedEquipment, ShopListViewModel listViewModel)
 {
     this._selectedEquipment = selectedEquipment;
     this._listViewModel     = listViewModel;
     SaveCommand             = new RelayCommand(saveCommand);
 }