summaryrefslogtreecommitdiffstats
path: root/win/C#/frmUpdater.cs
blob: 816e00facb04dfa01f7ea5effc97f882dfbacd47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*  frmUpdater.cs $
 	
 	   This file is part of the HandBrake source code.
 	   Homepage: <http://handbrake.fr>.
 	   It may be used under the terms of the GNU General Public License. */

using System;
using System.Windows.Forms;
using Handbrake.Functions;

namespace Handbrake
{
    public partial class frmUpdater : Form
    {
        readonly AppcastReader _appcast;
        public frmUpdater(AppcastReader reader)
        {
            InitializeComponent();

            _appcast = reader;
            GetRss();
            SetVersions();
        }

        private void GetRss()
        {
            wBrowser.Url = _appcast.descriptionUrl;
        }

        private void SetVersions()
        {
            string old = "(You have: " + Properties.Settings.Default.hb_version.Trim() + " / " + Properties.Settings.Default.hb_build.ToString().Trim() + ")";
            string newBuild = _appcast.version.Trim() + " (" + _appcast.build + ")";
            lbl_update_text.Text = "HandBrake " + newBuild + " is now available. " + old;
        }

        private void btn_installUpdate_Click(object sender, EventArgs e)
        {
            frmDownload download = new frmDownload(_appcast.downloadFile);
            download.ShowDialog();
            this.Close();
        }

        private void btn_remindLater_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btn_skip_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.skipversion = int.Parse(_appcast.build);
            Properties.Settings.Default.Save();

            this.Close();
        }

    }
}