示例#1
0
        public UpdaterForm(NewVersionWindowOptions options)
        {
            InitializeComponent();

            Options = options;

            if (Options.MyIcon != null)
            {
                Icon = Options.MyIcon;
            }
            if (Options.MyImage != null)
            {
                pbApp.Image = Options.MyImage;
            }

            lblVer.Text = Options.Question;

            if (!string.IsNullOrEmpty(Options.UpdateInfo.Summary))
            {
                txtVer.Text = Options.UpdateInfo.Summary;
            }

            Text = string.Format("{0} update is available", Options.ProjectName);

            BringToFront();
            Activate();
        }
 public UpdateChecker(string url, string applicationName, Version applicationVersion, ReleaseChannelType channel, IWebProxy proxy, NewVersionWindowOptions nvwo = null)
 {
     URL = url;
     ApplicationName = applicationName;
     ApplicationVersion = applicationVersion;
     ReleaseChannel = channel;
     Proxy = proxy;
 }
        public UpdaterForm(NewVersionWindowOptions options)
        {
            InitializeComponent();

            Options = options;

            if (Options.MyIcon != null) Icon = Options.MyIcon;
            if (Options.MyImage != null) pbApp.Image = Options.MyImage;

            lblVer.Text = Options.Question;

            if (!string.IsNullOrEmpty(Options.UpdateInfo.Summary))
            {
                txtVer.Text = Options.UpdateInfo.Summary;
            }

            Text = string.Format("{0} update is available", Options.ProjectName);

            BringToFront();
            Activate();
        }
 public UpdateChecker(string url, string applicationName, Version applicationVersion, ReleaseChannelType channel, IWebProxy proxy, NewVersionWindowOptions nvwo = null)
 {
     URL                = url;
     ApplicationName    = applicationName;
     ApplicationVersion = applicationVersion;
     ReleaseChannel     = channel;
     Proxy              = proxy;
 }
        private void updateThread_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker worker = (BackgroundWorker)sender;
            NewVersionWindowOptions nvwo = new NewVersionWindowOptions { MyIcon = Resources.zss_main, MyImage = Resources.main };
            UpdateChecker updateChecker = new UpdateChecker(ZLinks.URL_UPDATE, Application.ProductName,
                new Version(Adapter.AssemblyVersion),
                Engine.ConfigUI.ReleaseChannel, Adapter.CheckProxySettings().GetWebProxy, nvwo);

            updateChecker.CheckUpdate();

            string status;
            if (updateChecker.UpdateInfo.Status == UpdateStatus.UpdateCheckFailed)
            {
                status = "Update check failed";
            }
            else
            {
                status = updateChecker.UpdateInfo.ToString();
            }

            worker.ReportProgress(1, status);
        }
 private void updateThread_DoWork(object sender, DoWorkEventArgs e)
 {
     BackgroundWorker worker = (BackgroundWorker)sender;
     NewVersionWindowOptions nvwo = new NewVersionWindowOptions { MyIcon = Resources.zss_main, MyImage = Resources.main };
     UpdateChecker updateChecker = new UpdateChecker(Engine.URL_UPDATE, Application.ProductName, new Version(Application.ProductVersion),
         Engine.conf.ReleaseChannel, Adapter.CheckProxySettings().GetWebProxy, nvwo);
     worker.ReportProgress(1, updateChecker.CheckUpdate());
     updateChecker.ShowPrompt();
 }