Ejemplo n.º 1
0
        public void Check(IWin32Window owner, Uri url)
        {
            try {
                _owner = owner;

                ApplicationUpdater applicationUpdater = new ApplicationUpdater();
                applicationUpdater.UpdateAvailable += new EventHandler <UpdatesAvailableEventArgs> (applicationUpdater_UpdateAvailable);
                applicationUpdater.Version          = new Version(Application.ProductVersion);
                applicationUpdater.CheckForUpdatesByUrl(url);
            } catch {
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Raises the <see cref="E:System.Windows.Forms.Form.Load"></see> event.
 /// </summary>
 /// <param name="e">An <see cref="T:System.EventArgs"></see> that contains the event data.</param>
 protected override void OnLoad(EventArgs e)
 {
     base.OnLoad(e);
     if (Program.UpdateUrl != null)
     {
         au.CheckForUpdatesByUrl(Program.UpdateUrl);
     }
     else
     {
         au.CheckForUpdate(Program.UpdateCheckType);
     }
 }
Ejemplo n.º 3
0
        private void updatePlugin_Click(object sender, EventArgs e)
        {
            if (this.pluginsList.SelectedItems.Count > 0)
            {
                AssemblyListViewItem alvi = this.pluginsList.SelectedItems[0] as AssemblyListViewItem;
                ApplicationUpdater   au   = new ApplicationUpdater();
                au.Version = alvi.Version;

                this.pluginUpdateStatus.Text = "Checking updates for " + alvi.Text;

                au.UpdateAvailable += new EventHandler <UpdatesAvailableEventArgs> (delegate(object s, UpdatesAvailableEventArgs uae) {
                    ApplicationUpdater ai        = (ApplicationUpdater)s;
                    ai.UpdateName                = alvi.Text;
                    this.pluginUpdateStatus.Text = "Updates available...";
                    if (ai.UpdatesAvailable)
                    {
                        UpdateInformationForm uif = new UpdateInformationForm(ai);
                        if (uif.ShowDialog(null) == DialogResult.OK)
                        {
                            string thisPath   = this.GetType().Assembly.Location;
                            string attrString = string.Format(CCNetConfig.Core.Util.UserSettings.UpdateSettings.LaunchArgumentsFormat,
                                                              CCNetConfig.Core.Util.UserSettings.UpdateSettings.UpdateCheckType, thisPath,
                                                              ai.UpdateInfoList.GetLatestVersion());
                            Process.Start(Path.Combine(Application.StartupPath, CCNetConfig.Core.Util.UserSettings.UpdateSettings.UpdaterApplication), attrString);
                            Application.Exit();
                        }
                    }
                });

                au.UpdateException += new EventHandler <ExceptionEventArgs> (delegate(object s, ExceptionEventArgs ex) {
                    MessageBox.Show(ex.Exception.Message, "Update of plugin error");
                });

                au.CheckForUpdatesByUrl(alvi.UpdateUrl);
                this.pluginUpdateStatus.Text = string.Empty;
            }
        }