public BoxesPageViewModel(UserInteractionService userInteractionService, int gameModeId, MenuBoxItem[] boxItems)
        {
            _userInteractionService = userInteractionService;
            _gameModeId = gameModeId;
            _boxItems = boxItems;
            InitializeComponent();

            boxesPage_listBoxDataBinding.ItemsSource = _boxItems;
            boxesPage_listBoxDataBinding.SelectionChanged += OnBoxItemClick;
        }
Example #2
0
        public MenuBoxItem[] GetMenuBoxItems(int gameModeId, string path)
        {
            MenuBoxItem[] items = null;

            string[] boxDirs = Directory.GetDirectories(path);
            items = new MenuBoxItem[boxDirs.Count()];

            for (int i = 0; i < items.Count(); i++)
            {
                items[i] = new MenuBoxItem();
                items[i].Id = int.Parse(boxDirs[i].Split('_').LastOrDefault());
                items[i].Title = "Box " + (items[i].Id + 1);
                items[i].GameModeId = gameModeId;

                items[i].LevelItems = GetMenuLevelItems(gameModeId, boxDirs[i]);
            }

            return items;
        }