public MapViewModel(MapData info) { this.MapNumber = info.MapNumber; this.Name = info.Name; this.AreaName = info.AreaName; this.Current = info.Current; this.Max = info.Max; this.RemainingCount = info.RemainingCount.ToString(); this.IsCleared = info.IsCleared == 1; var color = info.RemainingCount < 2 ? new SolidColorBrush(Color.FromRgb(255, 32, 32)) : new SolidColorBrush(Color.FromRgb(64, 200, 32)); color.Freeze(); this.GaugeColor = color; this.IsRankSelected = info.Eventmap == null || info.Eventmap.SelectedRank != 0 || info.Eventmap.NowMapHp != 9999; this.IsSupported = 0 < info.RemainingCount; }
public MapViewModel(MapData info) { this._source = info; this.MapNumber = info.MapNumber; this.Name = info.Name; this.AreaName = info.AreaName; this.Current = info.Current; this.Max = info.Max; this.SelectedRank = info.Eventmap?.SelectedRankText ?? ""; this.RemainingCountTransportS = info.RemainingCountTransportS.ToString(); this.IsCleared = info.IsCleared == 1; this.IsRankSelected = info.Eventmap == null || info.Eventmap.SelectedRank != 0 || info.Eventmap.NowMapHp != 9999; this.GaugeType = info.GaugeType; this.GaugeColor = green; this.IsSupported = true; this.IsInfinity = false; this.IsLoading = true; this.UpdateRemainingCount(info); }
private void UpdateRemainingCount(MapData info, bool useCache = false) { try { info.GetRemainingCount(useCache) .ContinueWith(t => this.Update(t.Result, useCache)); } catch (AggregateException e) { Debug.WriteLine(e); } }