private void ChangeAvailabilityOfObject(Object sender, RoutedEventArgs e)
 {
     if (_selectedObject.GameObject.ChangeValue == 0 || _selectedObject.GameObject.Price == 0)
     {
         System.Windows.MessageBox.Show("Prosze najpierw zapisać zmiany", "Nie zapisano zmian",
                                        (MessageBoxButton)MessageBoxButtons.OK, (MessageBoxImage)MessageBoxIcon.Error);
     }
     else
     {
         if (_selectedObject.IsAvailable)
         {
             _allGameObjects.ChangeAvailability(_selectedObject.GameObject);
             _availableForUserGameObjects.RemoveObject(_selectedObject);
             _availableForUserGameObjects.CreateGrid();
             _allGameObjects.CreateGridWithCategoryBreaks(GetCategoryBreakLineIndex());
             OnObjectClick(_allGameObjects.GameObjectsList.Find(x =>
                                                                x.GameObject.TileObject.Name == _selectedObject.GameObject.TileObject.Name));
         }
         else
         {
             _allGameObjects.ChangeAvailability(_selectedObject.GameObject);
             AdminInGridClickableObject
                 copy = new AdminInGridClickableObject(_selectedObject.GameObject, true, this);
             OnObjectClick(copy);
             _availableForUserGameObjects.AddObject(copy);
             _availableForUserGameObjects.CreateGrid();
             _allGameObjects.CreateGridWithCategoryBreaks(GetCategoryBreakLineIndex());
         }
     }
 }
        public AdminRestrictionsWindow(ITileBinder iTileBinder)
        {
            Console.WriteLine("Init");
            _savedGameObjects = iTileBinder.AvailableObjects;
            InitializeComponent();
            _budget          = iTileBinder.AvailableFounds;
            _savedBudget     = iTileBinder.AvailableFounds;
            AdminBudget.Text = _budget.ToString();
            _allGameObjects  = new AdminGridObjectsCreator(
                InitializeGameObjects(),
                false,
                AllGameObjectsGrid,
                this
                );

            _availableForUserGameObjects = new AdminGridObjectsCreator(
                _savedGameObjects.ToArray(),
                true,
                AvailableForUserGameObjectsGrid,
                this
                );
            HideSelectedObjects(_savedGameObjects);
            _availableForUserGameObjects.InitializeGridDefinitions();
            _availableForUserGameObjects.CreateGrid();
            _allGameObjects.InitializeGridDefinitions();
            _allGameObjects.CreateGridWithCategoryBreaks(GetCategoryBreakLineIndex());
            _objectDetails = new AdminSelectedObjectDetails(SelectedGameObjectDetails, this);
            OnObjectClick(_allGameObjects.GameObjectsList[0]);
        }
        public void Return(object obj, RoutedEventArgs routedEventArgs)
        {
            _budget          = _savedBudget;
            AdminBudget.Text = _budget.ToString();
            _allGameObjects  = new AdminGridObjectsCreator(
                InitializeGameObjects(),
                false,
                AllGameObjectsGrid,
                this
                );

            _availableForUserGameObjects = new AdminGridObjectsCreator(
                _savedGameObjects.ToArray(),
                true,
                AvailableForUserGameObjectsGrid,
                this
                );
            HideSelectedObjects(_savedGameObjects);
            _allGameObjects.CreateGridWithCategoryBreaks(GetCategoryBreakLineIndex());
            _availableForUserGameObjects.CreateGrid();
            OnObjectClick(_selectedObject);
        }