private void inflateUI(RemotePackageInfo pack) { var rangeTuple = DependencyHelper.GetSuitableRange(ctx, pack); var suitableRange = rangeTuple.Item1; var packagesToBlame = rangeTuple.Item2; Font biggerFont = new Font(this.Font.FontFamily, 14, FontStyle.Regular, GraphicsUnit.Pixel); infoPanel.Controls.Clear(); versionPanel.Controls.Clear(); if (pack == null) { return; } int rownum = 0; string[] blacklist = new[] { "Files", "AvailableVersions", "ForcePopup" }; infoPanel.SuspendLayout(); foreach (var prop in pack.GetType().GetProperties()) { var value = prop.GetValue(pack); if (blacklist.Contains(prop.Name)) { continue; } if (value == null) { continue; } infoPanel.Controls.Add(new Label() { Text = prop.Name, Font = biggerFont, ForeColor = accentColor, Margin = new Padding(3) }, 0, rownum); infoPanel.Controls.Add(new Label() { Text = value.ToString(), Font = biggerFont, Margin = new Padding(3) }, 1, rownum); rownum++; } infoPanel.ResumeLayout(); int vernum = 0; bool foundLatestAvailableVersion = false; foreach (var ver in pack.AvailableVersions.Reverse()) { var text = ver.Key.ToString(); if (vernum == 0) { text += " (Latest)"; } bool versionValid = suitableRange.ContainsVersion(ver.Key); if (versionValid && !foundLatestAvailableVersion && vernum > 0) { text += " (Latest Installable)"; } versionPanel.Controls.Add(new RadioButton() { Size = new Size(300, 30), Enabled = versionValid, Checked = versionValid && !foundLatestAvailableVersion, Font = biggerFont, Tag = ver.Key, Text = text }); foundLatestAvailableVersion |= versionValid; vernum++; } btnOK.Enabled = foundLatestAvailableVersion; bool hasWarning = !foundLatestAvailableVersion || !suitableRange.ContainsVersion(pack.AvailableVersions.Last().Key); if (hasWarning) { if (!mainTabControl.TabPages.Contains(tabPageWarning)) { mainTabControl.TabPages.Insert(0, tabPageWarning); } mainTabControl.SelectedIndex = 0; var sb = new System.Text.StringBuilder(); if (foundLatestAvailableVersion) { sb.AppendLine(I._("bpmcore_context_cannotlatest", pack.AvailableVersions.Keys.Last(), pack.ID)); } else { if (!suitableRange.NotEmpty) { sb.AppendLine(I._("bpmcore_exception_badrange1")); } else { sb.AppendLine(I._("bpmcore_exception_badrange2")); } } sb.AppendLine(I._("bpmcore_exception_blame")); foreach (var item in packagesToBlame) { sb.AppendLine(I._("bpmcore_exception_constraint", item.Item1.ToString(), string.IsNullOrEmpty(item.Item2[0]) ? I._("bpmcore_exception_userconstraint") : item.Item2[0], item.Item2.Length > 1 ? "...(" + (item.Item2.Length - 1).ToString() + "+)" : "")); } textWarn.Font = biggerFont; textWarn.Text = sb.ToString(); } else { if (mainTabControl.TabPages.Contains(tabPageWarning)) { mainTabControl.TabPages.Remove(tabPageWarning); } } }