public NationalTechTreeNodeVM(IRepository repository,
                                      IXQueryable tank,
                                      int row,
                                      int column,
                                      IEnumerable <string> unlockTanks,
                                      ImageSource icon)
        {
            _repository      = repository;
            this.Tank        = new TankEntity(tank);
            _unikey          = new TankUnikey(_repository, this.Tank);
            this.Column      = column;
            this.Row         = row;
            this.UnlockTanks = unlockTanks;

            App.BeginInvokeBackground(() => this.Icon = icon);

            this.MenuItems = TankCommandManager.Instance
                             .Commands
                             .OrderBy(c => c.Priority)
                             .Select(c => new MenuItemVM(c.Name, c, _unikey)
            {
                Icon = c.Icon,
            })
                             .ToArray();
        }
 public TankNodeVM(NationNodeVM parent, Tank tank, LocalGameClient client)
     : base(parent, tank.Name, LoadChildenStrategy.LazyStatic)
 {
     _client = client;
     _tank   = tank;
     _unikey = new TankUnikey(_client, _tank);
 }
示例#3
0
        private void ViewXML(TankUnikey key)
        {
            var repository = RepositoryManager.Instance[key.RepositoryID];
            var tank       = repository.TankDatabase.Query("tank[@key = '{0}' and nation/@key = '{1}']", key.TankKey, key.NationKey);

            var uri = FileDocumentService.Instance
                      .CreateTemporaryStreamUri("tank",
                                                "xml",
                                                key.ToString(),
                                                tank.Xml.ToStream(),
                                                this.L("xml_viewer_service", "document_title", tank["userString"]),
                                                null,
                                                repository);

            DockingViewManager.Instance.DocumentManager.OpenDocument(uri);
        }
示例#4
0
            internal TankVM GetTankVM(TankUnikey key)
            {
                TankVM tankVm;

                if (_tankVms.TryGetValue(key, out tankVm))
                {
                    return(tankVm);
                }

                IRepository repository;
                IXQueryable tank;

                if (key.TryGetTank(out tank, out repository))
                {
                    tankVm        = new TankVM(repository, tank);
                    _tankVms[key] = tankVm;
                    return(tankVm);
                }

                return(null);
            }
示例#5
0
        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);
            }
        }
 private void AddToComparison(TankUnikey key)
 {
     this.AddToComparison(new[] { key });
 }
示例#7
0
 public static Uri CreateUri(TankUnikey key)
 {
     return(key.CreateUri(ArmorDocumentServiceBase.ArmorScheme));
 }
示例#8
0
 public static Uri CreateUri(TankUnikey key)
 {
     return(key.CreateUri(StatsScheme));
 }
 public static Uri CreateUri(TankUnikey key)
 {
     return(key.CreateUri(ModelDocumentServiceBase.ModelScheme));
 }
示例#10
0
        private void InspectModel(TankUnikey key)
        {
            var uri = ModelDocumentServiceBase.CreateUri(key);

            DockingViewManager.Instance.DocumentManager.OpenDocument(uri);
        }
        private void ViewModuleTree(TankUnikey key)
        {
            var uri = TankModuleTreeDocumentServiceBase.CreateUri(key);

            DockingViewManager.Instance.DocumentManager.OpenDocument(uri);
        }
示例#12
0
            internal TankVM GetTankVM(IRepository repository, IXQueryable tank)
            {
                var key = new TankUnikey(repository, tank);

                return(_tankVms.GetOrCreate(key, () => new TankVM(repository, tank)));
            }
示例#13
0
 public static Uri CreateUri(TankUnikey key)
 {
     return(key.CreateUri(TankModuleTreeDocumentServiceBase.TankModuleTreeScheme));
 }
 public static Uri CreateUri(TankUnikey key)
 {
     return(key.CreateUri(StatsDocumentServiceBase.StatsScheme));
 }
示例#15
0
 public static Uri CreateUri(TankUnikey key)
 {
     return(key.CreateUri(TankModuleTreeScheme));
 }