/// <summary> /// Decodes the build. /// </summary> /// <param name="simpleBuild">The simple build.</param> private void DecodeBuild(SimpleBuild simpleBuild) { this._build = PathOfBuildingService.Decode(simpleBuild.PathOfBuildingCode); this.Ascendancy = this._build.Ascendancy; this.NotifyOfPropertyChange("DisplayName"); var mainSkill = this._build.Skills.OrderByDescending(s => s.Gems.Count(g => g.Support)).FirstOrDefault(); if (mainSkill != null) { var gem = mainSkill.Gems.FirstOrDefault(g => !g.Support); if (gem != null) { this.GemViewModel = new GemViewModel(gem, false); this.NotifyOfPropertyChange("GemViewModel"); } } Caliburn.Micro.Execute.OnUIThread(() => { foreach (var item in this._build.Items.OrderBy(i => i.Level)) { this.Items.Add(new UniqueItemViewModel(item, false)); } }); }
/// <summary> /// Adds the build. /// </summary> /// <param name="build">The build.</param> /// <returns>Simple Build.</returns> public SimpleBuild AddBuild(Build build) { var simpleBuild = new SimpleBuild() { PathOfBuildingCode = build.Xml, }; this.AddBuild(simpleBuild); return(simpleBuild); }
/// <summary> /// Selects the build. /// </summary> /// <param name="build">The build.</param> public async void SelectBuild(SimpleBuild build) { this._currentBuild = build; if (this._activePlayer != null) { this._activePlayer.SetBuild(build.Id); this._playerService.Save(); } this.ClearBuild(); await this.Initialize(build.PathOfBuildingCode, true); }
/// <summary> /// Initializes a new instance of the <see cref="BuildConfigurationViewModel" /> class. /// </summary> /// <param name="build">The build.</param> public BuildConfigurationViewModel(SimpleBuild build) { this._buildConfiguration = build; this.Items = new ObservableCollection <UniqueItemViewModel>(); if (PathOfBuildingService.IsInitialize) { this.DecodeBuild(build); } else { PathOfBuildingService.InitializeAsync().ContinueWith((t) => { this.DecodeBuild(build); }); } }
/// <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); }
public NuGetPacker(SimpleBuild build) => Build = build;
/// <summary> /// Adds the build. /// </summary> /// <param name="build">The build.</param> public void AddBuild(SimpleBuild build) { this._buildManager.Builds.Add(build); }
/// <summary> /// Builds the selector build selected. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The e.</param> private void BuildSelector_BuildSelected(object sender, SimpleBuild e) { this.SelectBuild(e); }