Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BuildViewModel" /> class.
        /// </summary>
        /// <param name="windowManager">The window manager.</param>
        /// <param name="dockingHelper">The docking helper.</param>
        /// <param name="processLurker">The process lurker.</param>
        /// <param name="settingsService">The settings service.</param>
        /// <param name="buildService">The build service.</param>
        /// <param name="playerService">The player service.</param>
        /// <param name="settingsViewModel">The settings view model.</param>
        /// <param name="githubService">The github service.</param>
        /// <param name="mouseLurker">The mouse lurker.</param>
        public BuildViewModel(IWindowManager windowManager, DockingHelper dockingHelper, ProcessLurker processLurker, SettingsService settingsService, BuildService buildService, PlayerService playerService, SettingsViewModel settingsViewModel, GithubService githubService, MouseLurker mouseLurker)
            : base(windowManager, dockingHelper, processLurker, settingsService)
        {
            this._settings             = settingsViewModel;
            this._playerService        = playerService;
            this._buildService         = buildService;
            this._githubService        = githubService;
            this._activePlayer         = playerService.FirstPlayer;
            this._skillTimelineEnabled = this.SettingsService.TimelineEnabled;
            this._eventAggregator      = IoC.Get <IEventAggregator>();

            this.Skills      = new ObservableCollection <SkillViewModel>();
            this.UniqueItems = new ObservableCollection <UniqueItemViewModel>();

            this._mouseLurker = mouseLurker;

            if (this._activePlayer != null && !string.IsNullOrEmpty(this._activePlayer.Build.BuildId))
            {
                var build = buildService.Builds.FirstOrDefault(b => b.Id == this._activePlayer.Build.BuildId);
                if (build == null)
                {
                    this._hasNoBuild = true;
                }
                else
                {
                    this._currentBuild = build;
                    this._currentTask  = this.Initialize(build.PathOfBuildingCode, false);
                }
            }
            else
            {
                this._hasNoBuild = true;
            }

            this.IsVisible = true;

            this.ActivePlayer = new PlayerViewModel(playerService);
            this.Builds       = new ObservableCollection <SimpleBuild>();

            this.BuildSelector = new BuildSelectorViewModel(buildService);
        }