private void BuyItem()
        {
            if (_selectedEquipment != null)
            {
                Equipment.Remove(_selectedEquipment);
                using (var context = new MyEntities())
                {
                    if (_editItemWindow != null)
                    {
                        _editItemWindow.Close();
                    }
                    context.Ninjas.Attach(SelectedNinja.ToModel());
                    context.Equipments.Attach(_selectedEquipment.ToModel());

                    SelectedNinja.Equipment.Add(SelectedEquipment);
                    SelectedEquipment.ToModel().Ninjas.Add(SelectedNinja.ToModel());
                    SelectedNinja.GoldAmount -= _selectedEquipment.EquipmentPrice;

                    context.SaveChanges();
                }
                base.RaisePropertyChanged();
            }
            ServiceLocator.Current.GetInstance <NinjaInventoryViewModel>().UpdateItem();
            ServiceLocator.Current.GetInstance <NinjaInventoryViewModel>().TotalGold     += _selectedEquipment.EquipmentPrice;
            ServiceLocator.Current.GetInstance <NinjaInventoryViewModel>().TotalStrength += _selectedEquipment.EquipmentStrength;
            ServiceLocator.Current.GetInstance <NinjaInventoryViewModel>().TotalAgility  += _selectedEquipment.EquipmentAgility;
            ServiceLocator.Current.GetInstance <NinjaInventoryViewModel>().TotalIntel    += _selectedEquipment.EquipmentIntel;
        }
        private void EditButton_Click(object sender, RoutedEventArgs e)
        {
            EditItemWindow EditWindow = new EditItemWindow()
            {
                Title = "Edit Item",
                Text  = (ContentList.SelectedItem as CheckLabel).Text.ToString()
            };

            EditWindow.ShowDialog();
            HandleItemChanged(ContentList.SelectedItem, new CheckLabelEventArgs(
                                  EditWindow.Text + ToHexColor(EditWindow.Text),
                                  (ContentList.SelectedItem as CheckLabel).Tag.ToString()));
            (ContentList.SelectedItem as CheckLabel).Text = EditWindow.Text;
            (ContentList.SelectedItem as CheckLabel).Tag  = EditWindow.Text + ToHexColor(EditWindow.Text);
            EditWindow.Close();
        }
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            EditItemWindow AddWindow = new EditItemWindow()
            {
                Title = "Add Item"
            };

            AddWindow.ShowDialog();
            if (!string.IsNullOrWhiteSpace(AddWindow.Text))
            {
                CheckLabel newCL = new CheckLabel
                {
                    Text = AddWindow.Text,
                    Tag  = AddWindow.Text + ToHexColor(AddWindow.Text)
                };
                ContentList.Items.Add(newCL);
                HandleItemAdded(newCL, new CheckLabelEventArgs(newCL.Tag.ToString()));
                CheckItemCount();
            }
            AddWindow.Close();
        }