public TankMuseumVM()
        {
            _allTanks = new ViewModelMap <IRepository, TankVM[]>(RepositoryManager.Instance.Repositories,
                                                                 r =>
            {
                var repositoryVm = new RepositoryVM(r);
                return(r.TankDatabase.QueryMany("tank")
                       .Select(t => new TankVM(repositoryVm, new Tank(t))).ToArray());
            });

            _allTanks.CollectionChanged += _allTanks_CollectionChanged;

            this.ListedTanks        = CollectionViewSource.GetDefaultView(_allTanks);
            this.ListedTanks.Filter = this.Filter;

            this.TankListDragHandler = new TankListDragHandlerImpl();
            this.ContextMenuItems    = new ObservableCollection <MenuItemVM>();
            this.ContextMenuItems.Add(new MenuItemVM("text"));

            this.ResetFiltersCommand = new RelayCommand(this.ResetFilters);
        }
        public TankVM(RepositoryVM repository, Tank tank)
        {
            this.Repository = repository;
            this.Model      = tank;

            this.TankUnikey = new TankUnikey(repository.Model, tank);

            this.Name      = tank.Name;
            this.ShortName = tank.ShortName;
            this.Tier      = RomanNumberService.GetRomanNumber(tank.Tier);

            this.ClassSortIndex = TankClassComparer.GetClassSortIndex(tank.ClassKey);

            this.Nation = tank.NationKey;

            var gameClient = repository.Model as LocalGameClient;

            if (gameClient != null)
            {
                App.BeginInvokeBackground(() => this.SmallIcon = gameClient.PackageImages.GetTankSmallIcon(tank.IconKey));
                this.NationIcon = gameClient.PackageImages.GetNationSmallIcon(tank.NationKey);
                this.ClassIcon  = gameClient.PackageImages.GetClassSmallIcon(tank.ClassKey);
            }
        }