2 using System.Diagnostics;
5 using System.Windows.Forms;
7 namespace AppLimit.NetSparkle
9 public partial class NetSparkleForm : Form
11 NetSparkleAppCastItem _currentItem;
13 public NetSparkleForm(NetSparkleAppCastItem item, Image appIcon, Icon windowIcon)
15 InitializeComponent();
20 NetSparkleBrowser.AllowWebBrowserDrop = false;
21 NetSparkleBrowser.AllowNavigation = false;
28 lblHeader.Text = lblHeader.Text.Replace("APP", item.AppName);
29 lblInfoText.Text = lblInfoText.Text.Replace("APP", item.AppName + " " + item.Version);
30 lblInfoText.Text = lblInfoText.Text.Replace("OLDVERSION", item.AppVersionInstalled);
32 if (!String.IsNullOrWhiteSpace(item.Summary))
34 NetSparkleBrowser.DocumentText = "<html><body>" + item.Summary + "</html></body>";
38 if (item.ReleaseNotesLink != null && item.ReleaseNotesLink.Length > 0)
40 using (var client = new WebClient())
42 //Download the content instead of navigating to it, to bypass
43 //the Content-Disposition header
44 string notes = client.DownloadString(item.ReleaseNotesLink);
45 NetSparkleBrowser.DocumentText = notes;
49 RemoveReleaseNotesControls();
53 imgAppIcon.Image = appIcon;
55 if (windowIcon != null)
59 public void RemoveReleaseNotesControls()
61 if (label3.Parent == null)
65 Size newSize = new Size(this.Size.Width, this.Size.Height - label3.Height - panel1.Height);
67 // remove the no more needed controls
68 label3.Parent.Controls.Remove(label3);
69 NetSparkleBrowser.Parent.Controls.Remove(NetSparkleBrowser);
70 panel1.Parent.Controls.Remove(panel1);
73 /*this.MinimumSize = newSize;
74 this.Size = this.MinimumSize;
75 this.MaximumSize = this.MinimumSize;*/
79 private void skipButton_Click(object sender, EventArgs e)
81 // set the dialog result to no
82 this.DialogResult = DialogResult.No;
88 private void buttonRemind_Click(object sender, EventArgs e)
90 // set the dialog result ot retry
91 this.DialogResult = DialogResult.Retry;
97 private void updateButton_Click(object sender, EventArgs e)
99 // set the result to yes
100 DialogResult = DialogResult.Yes;