Statistics
| Branch: | Revision:

root / trunk / NetSparkle / NetSparkleForm.cs @ 049333d2

History | View | Annotate | Download (2.7 kB)

1
using System;
2
using System.Diagnostics;
3
using System.Drawing;
4
using System.Windows.Forms;
5

    
6
namespace AppLimit.NetSparkle
7
{
8
    public partial class NetSparkleForm : Form
9
    {
10
        NetSparkleAppCastItem _currentItem;
11
        
12
        public NetSparkleForm(NetSparkleAppCastItem item, Image appIcon, Icon windowIcon)
13
        {            
14
            InitializeComponent();
15
            
16
            // init ui 
17
            try
18
            {
19
                NetSparkleBrowser.AllowWebBrowserDrop = false;
20
                NetSparkleBrowser.AllowNavigation = false;
21
            }
22
            catch (Exception)
23
            { }
24
            
25
            _currentItem = item;
26

    
27
            lblHeader.Text = lblHeader.Text.Replace("APP", item.AppName);
28
            lblInfoText.Text = lblInfoText.Text.Replace("APP", item.AppName + " " + item.Version);
29
            lblInfoText.Text = lblInfoText.Text.Replace("OLDVERSION", item.AppVersionInstalled);
30

    
31
            if (item.ReleaseNotesLink != null && item.ReleaseNotesLink.Length > 0 )
32
                NetSparkleBrowser.Navigate(item.ReleaseNotesLink);
33
            else            
34
                RemoveReleaseNotesControls();            
35

    
36
            if (appIcon != null)
37
                imgAppIcon.Image = appIcon;
38

    
39
            if (windowIcon != null)
40
                Icon = windowIcon;
41
        }
42

    
43
        public void RemoveReleaseNotesControls()
44
        {
45
            if (label3.Parent == null)
46
                return;
47

    
48
            // calc new size
49
            Size newSize = new Size(this.Size.Width, this.Size.Height - label3.Height - panel1.Height);
50

    
51
            // remove the no more needed controls            
52
            label3.Parent.Controls.Remove(label3);
53
            NetSparkleBrowser.Parent.Controls.Remove(NetSparkleBrowser);
54
            panel1.Parent.Controls.Remove(panel1);
55

    
56
            // resize the window
57
            /*this.MinimumSize = newSize;
58
            this.Size = this.MinimumSize;
59
            this.MaximumSize = this.MinimumSize;*/
60
            this.Size = newSize;
61
        }
62

    
63
        private void skipButton_Click(object sender, EventArgs e)
64
        {
65
            // set the dialog result to no
66
            this.DialogResult = DialogResult.No;
67

    
68
            // close the windows
69
            Close();
70
        }
71

    
72
        private void buttonRemind_Click(object sender, EventArgs e)
73
        {
74
            // set the dialog result ot retry
75
            this.DialogResult = DialogResult.Retry;
76

    
77
            // close the window
78
            Close();
79
        }
80

    
81
        private void updateButton_Click(object sender, EventArgs e)
82
        {
83
            // set the result to yes
84
            DialogResult = DialogResult.Yes;
85

    
86
            // close the dialog
87
            Close();
88
        }
89
    }
90
}