Exemplo n.º 1
0
        public SharpUpdateInfoForm(ISharpUpdate applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();

            this.lblVersions.Text = String.Format("Current Version: {0} \n Update Version: {1}",
                                                  applicationInfo.ApplicationAssembly.GetName().Version.ToString(), updateInfo.Version.ToString());
        }
        /// <summary>
        /// Creates a new SharpUpdate object
        /// </summary>
        public SharpUpdater(ISharpUpdate applicationInfo)
        {
            this.applicationInfo = applicationInfo;

            // Color backgroundWorker
            this.bgWorker                     = new BackgroundWorker();
            this.bgWorker.DoWork             += new DoWorkEventHandler(bgWorker_DoWork);
            this.bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorker_RunWorkerCompleted);
        }
        /// <summary>
        /// Checks for/parse update.xml on server
        /// </summary>
        private void bgWorker_DoWork(Object sender, DoWorkEventArgs e)
        {
            ISharpUpdate application = (ISharpUpdate)e.Argument;

            if (!SharpUpdateXml.ExistsOnServer(application.UpdateXmlLocation))
            {
                e.Cancel = true;
            }
            else
            {
                e.Result = SharpUpdateXml.Parse(application.UpdateXmlLocation, application.ApplicationID);
            }
        }
        /// <summary>
        /// Creates a new SharpUpdateInfoForm
        /// </summary>
        internal SharpUpdateInfoForm(ISharpUpdate applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();

            // Sets the icon if its not null
            if (applicationInfo.ApplicationIcon != null)
            {
                this.Icon = applicationInfo.ApplicationIcon;
            }

            //Fill in the UI
            this.Text             = applicationInfo.ApplicationName + " . Update Info";
            this.lblVersions.Text = string.Format("Current Version: {0}\nUpdate Version: {1}", applicationInfo.ApplicationAssembly.GetName().Version.ToString(),
                                                  updateInfo.Version.ToString());
            this.txtDescription.Text = updateInfo.Description;
        }
        /// <summary>
        /// Creates a new SharpUpdateAcceptForm
        /// </summary>
        public SharpUpdateAcceptForm(ISharpUpdate applicationInfo, SharpUpdateXml updateInfo)
        {
            InitializeComponent();

            this.applicationInfo = applicationInfo;
            this.updateInfo      = updateInfo;

            this.Text = this.applicationInfo.ApplicationName + " . Update Available";

            if (this.applicationInfo.ApplicationIcon != null)
            {
                this.Icon = this.applicationInfo.ApplicationIcon;
            }

            this.lblNewVersion.Text = string.Format("New Version: {0}", this.updateInfo.Version.ToString());
        }