internal void LoadLifetimeAwards() { this.gpgPanelAwards.Controls.Clear(); this.mLifetimeAwards = new SortedList<int, LifetimeAwardInfo>(); ThreadPool.QueueUserWorkItem(delegate (object s) { try { Dictionary<AwardCategory, Dictionary<AwardSet, Award>> dictionary = new Dictionary<AwardCategory, Dictionary<AwardSet, Award>>(); foreach (AwardSet set in AwardSet.AllAwardSets.Values) { if (!dictionary.ContainsKey(set.Category)) { dictionary[set.Category] = new Dictionary<AwardSet, Award>(); } dictionary[set.Category][set] = null; } foreach (PlayerAward award in PlayerAward.GetPlayerAwards(this.CurrentPlayer.Player.Name)) { if (award.IsAchieved) { dictionary[award.Award.AwardSet.Category][award.Award.AwardSet] = award.Award; } } using (Dictionary<AwardCategory, Dictionary<AwardSet, Award>>.Enumerator enumerator2 = dictionary.GetEnumerator()) { while (enumerator2.MoveNext()) { KeyValuePair<AwardCategory, Dictionary<AwardSet, Award>> category = enumerator2.Current; VGen0 method = null; bool flag = false; LifetimeAwardInfo awardInfo = new LifetimeAwardInfo(); using (Dictionary<AwardSet, Award>.Enumerator enumerator3 = category.Value.GetEnumerator()) { while (enumerator3.MoveNext()) { KeyValuePair<AwardSet, Award> award = enumerator3.Current; if ((award.Value != null) || award.Key.AlwaysShow) { Image awardImage; flag = true; if ((award.Value == null) && award.Key.AlwaysShow) { awardImage = award.Key.BaseImage; } else { awardImage = award.Value.LargeImage; } if (base.Disposing || base.IsDisposed) { return; } base.Invoke((VGen0)delegate { PictureBox box = new PictureBox { Size = new Size(0x30, 0x30), SizeMode = PictureBoxSizeMode.AutoSize, Image = awardImage, Tag = award }; this.gpgPanelAwards.Controls.Add(box); box.MouseEnter += delegate (object s1, EventArgs e1) { int awardDegree; PictureBox curbox = s1 as PictureBox; KeyValuePair<AwardSet, Award> tag = (KeyValuePair<AwardSet, Award>) (s1 as Control).Tag; if (tag.Value == null) { awardDegree = 0; } else { awardDegree = tag.Value.AwardDegree; } if ((((DlgAwardSetDetails.Singleton == null) || !DlgAwardSetDetails.Singleton.IsHandleCreated) || DlgAwardSetDetails.Singleton.Disposing) || DlgAwardSetDetails.Singleton.IsDisposed) { DlgAwardSetDetails.Singleton = new DlgAwardSetDetails(); } DlgAwardSetDetails.Singleton.BindToAward(tag.Key, awardDegree); Point point = this.gpgPanelAwards.PointToScreen(curbox.Location); point.Offset(0, -(DlgAwardSetDetails.Singleton.Height + 4)); DlgAwardSetDetails.Singleton.Location = point; DlgAwardSetDetails.Singleton.FadeIn(); }; box.MouseLeave += delegate (object s1, EventArgs e1) { if ((((DlgAwardSetDetails.Singleton == null) || !DlgAwardSetDetails.Singleton.IsHandleCreated) || DlgAwardSetDetails.Singleton.Disposing) || DlgAwardSetDetails.Singleton.IsDisposed) { DlgAwardSetDetails.Singleton = new DlgAwardSetDetails(); } DlgAwardSetDetails.Singleton.FadeOut(); }; awardInfo.Awards[award.Key.SortOrder] = box; }); } } } if (flag) { if (base.Disposing || base.IsDisposed) { return; } if (method == null) { method = delegate { SkinLabel label = new SkinLabel { Text = Loc.Get("<LOC>" + category.Key.Name), SkinBasePath = @"Controls\Background Label\BlueGradient", Width = this.gpgPanelAwards.Width, Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top }; this.gpgPanelAwards.Controls.Add(label); awardInfo.CategoryLabel = label; }; } base.Invoke(method); this.LifetimeAwards[category.Key.SortOrder] = awardInfo; } } } this.LayoutLifetimeAwards(); } catch (Exception exception) { ErrorLog.WriteLine(exception); } }); }
internal void LayoutLifetimeAwards() { if ((this.LifetimeAwards != null) && !this.PerformingAwardsLayout) { this.PerformingAwardsLayout = true; ThreadPool.QueueUserWorkItem(delegate (object s) { try { int num = 0; int top = 0; LifetimeAwardInfo[] array = new LifetimeAwardInfo[this.LifetimeAwards.Values.Count]; this.LifetimeAwards.Values.CopyTo(array, 0); VGen0 method = null; foreach (LifetimeAwardInfo awardInfo in array) { int num2 = 0; int left = 0; if (base.Disposing || base.IsDisposed) { return; } if (method == null) { method = delegate { awardInfo.CategoryLabel.Left = 0; awardInfo.CategoryLabel.Top = top; }; } base.Invoke(method); top += awardInfo.CategoryLabel.Height + 6; int lastImgBottom = 0; using (IEnumerator<PictureBox> enumerator = awardInfo.Awards.Values.GetEnumerator()) { VGen0 gen = null; while (enumerator.MoveNext()) { PictureBox img = enumerator.Current; if (base.Disposing || base.IsDisposed) { return; } if (gen == null) { gen = delegate { img.Top = top; img.Left = left; if (img.Bottom > lastImgBottom) { lastImgBottom = img.Bottom; } }; } base.Invoke(gen); if ((left + (img.Width + 6)) > this.gpgPanelAwards.Width) { top += img.Height + 6; left = 0; } else { left += img.Width + 6; } num2++; } } top = lastImgBottom + 6; num++; } } catch (Exception exception) { ErrorLog.WriteLine(exception); } finally { this.PerformingAwardsLayout = false; } }); } }