public StatComparisonDocumentVM(StatComparisonDocumentService service, CommandBindingCollection commandBindings, string persistentInfo)
        {
            _isInitializing = true;

            _commandBindings = commandBindings;

            this.PersistentInfo = DocumentPersistentInfoProviderBase.Load(persistentInfo,
                                                                          () => new StatComparisonDocumentPersistentInfo(),
                                                                          this.GetLogger());
            this.StatsManager = new StatsManagerVM(this);
            this.TanksManager = new TanksManagerVM(this);

            this.InitializeGrid();

            if (this.Title == null)
            {
                service.PromptForTitle()
                .ContinueWith(t => this.Title = string.IsNullOrWhiteSpace(t.Result)
                                                     ? this.L("stat_comparison", "new_comparison_default_title")
                                                     : t.Result);
            }

            this.UpdateStatsValueMode();

            this.DropHandler = new DropHandlerImpl(this);

            this.InitializeCommands();

            _isInitializing = false;
        }
        public StatsDocumentVM(StatsDocumentService service, CommandBindingCollection commandBindings, TankInstance tank, string persistentInfo)
            : base(commandBindings)
        {
            this.StatsDocumentService = service;
            this.Tank = tank;

            this.PersistentInfo = DocumentPersistentInfoProviderBase.Load(persistentInfo,
                                                                          () => new StatsDocumentPersistentInfo(tank),
                                                                          this.GetLogger());
            this.CreateDocument();
        }
        public RepositoryManagerDocumentVM(RepositoryManagerDocumentService service, CommandBindingCollection commandBindings, string persistentInfo)
        {
            this.PersistentInfo = DocumentPersistentInfoProviderBase.Load(persistentInfo,
                                                                          () => new RepositoryManagerDocumentPersistentInfo(), this.GetLogger());

            var repositoryManager = RepositoryManagerService.Instance;

            this.Repositories = new ViewModelMap <IRepository, RepositoryVM>(
                repositoryManager.Repositories,
                r => new RepositoryVM(r, repositoryManager.GetConfiguration(r)));

            if (this.Repositories.Count > 0)
            {
                this.SelectedRepository = this.Repositories[0];
            }

            this.AddRepositoryCommand    = new RelayCommand(this.AddRepository);
            this.RemoveRepositoryCommand = new RelayCommand <IList>(this.RemoveRepository, this.CanRemoveRepository);
        }
        public PatchnoteGeneratorDocumenVM(CommandBindingCollection commandBindings,
                                           IRepository target,
                                           IRepository reference,
                                           string persistentInfo)
            : base(commandBindings)
        {
            this.PersistentInfo = DocumentPersistentInfoProviderBase.Load(persistentInfo,
                                                                          () => new PatchnoteGeneratorDocumentPersistentInfo());

            this.TargetRepository    = target;
            this.ReferenceRepository = reference;

            using (var documentStyleFile = File.OpenRead(s_documentStyleFile))
                this.DocumentStyle = (ResourceDictionary)XamlReader.Load(documentStyleFile);

            if (!this.TryLoadPersistentDocument())
            {
                this.GeneratePatchnote();
            }
        }
示例#5
0
        public TechTreeDocumentVM(TechTreeDocumentService service,
                                  CommandBindingCollection commandBindings,
                                  IRepository repository,
                                  string persistentInfo)
        {
            _service            = service;
            _commandBindings    = commandBindings;
            this.PersistentInfo = DocumentPersistentInfoProviderBase.Load(persistentInfo,
                                                                          () => new TechTreeDocumentPersistentInfo(repository.Nations.First()),
                                                                          this.GetLogger());

            if (!repository.Nations.Contains(this.PersistentInfo.NationKey))
            {
                this.LogError("unknown nation key: {0}", this.PersistentInfo.NationKey);
                this.PersistentInfo.NationKey = repository.Nations.First();
            }

            // todo: handle non-LocalGameClient repositories
            _nationalTechTrees = repository.Nations.ToDictionary(n => n, n => new LocalGameClientNationalTechTreeVM((LocalGameClient)repository, n));

            this.SelectNation(this.PersistentInfo.NationKey);
        }
 protected override ModelDocumentPersistentInfoBase LoadPersistentInfo(string persistentInfo)
 {
     return(DocumentPersistentInfoProviderBase.Load(persistentInfo, () => new ArmorDocumentPersistentInfo()));
 }