/// <summary> /// Creates a new AutoUpdateDownloadForm /// </summary> internal AutoUpdateDownloadForm(AutoUpdatable applicationInfo, Uri location, String md5, Icon programIcon) { InitializeComponent(); this.applicationInfo = applicationInfo; this.tools = applicationInfo.Tools; if (programIcon != null) { this.Icon = programIcon; } this.Text = applicationInfo.ApplicationName + " - " + tools.getString("update_download"); this.lblDownloading.Text = tools.getString("update_downloading"); // Set the temp file name and create new 0-byte file tempFile = Path.GetTempFileName(); this.md5 = md5; // Set up WebClient to download file webClient = new WebClient(); webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(webClient_DownloadProgressChanged); webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(webClient_DownloadFileCompleted); // Set up backgroundworker to hash file bgWorker = new BackgroundWorker(); bgWorker.DoWork += new DoWorkEventHandler(bgWorker_DoWork); bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorker_RunWorkerCompleted); // Download file try { webClient.DownloadFileAsync(location, this.tempFile); } catch { this.DialogResult = DialogResult.No; this.Close(); } }
/// <summary> /// Creates a new AutoUpdater object /// </summary> /// <param name="applicationName">The name of the application so it can be displayed on dialog boxes to user</param> /// <param name="appId">A unique Id for the application, same as in update xml</param> /// <param name="updateXmlLocation">The Uri for the program's update.xml</param> public AutoUpdater(AutoUpdatable applicationInfo) { this.applicationInfo = applicationInfo; this.lang = applicationInfo.Lang; // Set up backgroundworker this.bgWorker = new BackgroundWorker(); this.bgWorker.DoWork += new DoWorkEventHandler(bgWorker_DoWork); this.bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorker_RunWorkerCompleted); }
/// <summary> /// Creates a new AutoUpdater object /// </summary> /// <param name="applicationName">The name of the application so it can be displayed on dialog boxes to user</param> /// <param name="appId">A unique Id for the application, same as in update xml</param> /// <param name="updateXmlLocation">The Uri for the program's update.xml</param> public AutoUpdater(AutoUpdatable applicationInfo) { this.applicationInfo = applicationInfo; this.tools = applicationInfo.Tools; // Set up backgroundworker this.bgWorker = new BackgroundWorker(); this.bgWorker.DoWork += new DoWorkEventHandler(bgWorker_DoWork); this.bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorker_RunWorkerCompleted); }
/// <summary> /// Checks for/parses update.xml on server /// </summary> private void bgWorker_DoWork(object sender, DoWorkEventArgs e) { AutoUpdatable application = (AutoUpdatable)e.Argument; // Check for update on server if (!AutoUpdateXml.ExistsOnServer(application.UpdateXmlLocation)) { e.Cancel = true; } else // Parse update xml { e.Result = AutoUpdateXml.Parse(application.UpdateXmlLocation, application.ApplicationID); } }
/// <summary> /// Creates a new AutoUpdateAcceptForm /// </summary> /// <param name="applicationInfo"></param> /// <param name="updateInfo"></param> internal AutoUpdateAcceptForm(AutoUpdatable applicationInfo, AutoUpdateXml updateInfo) { InitializeComponent(); this.applicationInfo = applicationInfo; this.updateInfo = updateInfo; this.lang = applicationInfo.Lang; this.Text = lang.getString("update_found_title"); this.lblAppName.Text = lang.getString("app_name"); this.lblUpdateAvail.Text = lang.getString("update_found"); this.lblNewVersion_label.Text = lang.getString("update_new"); this.lblCurVersion_label.Text = lang.getString("update_cur"); this.lblDescription.Text = lang.getString("update_description"); this.btnYes.Text = lang.getString("button_ok"); this.btnNo.Text = lang.getString("button_cancel"); // Assigns the icon if it isn't null if (this.applicationInfo.ApplicationIcon != null) { this.Icon = this.applicationInfo.ApplicationIcon; } // Adds the current version # to the form this.lblCurVersion.Text = applicationInfo.ApplicationAssembly.GetName().Version.ToString(); // Adds the update version # to the form this.lblNewVersion.Text = this.updateInfo.Version.ToString(); // Fill in update info this.txtDescription.Text = updateInfo.Description; //this.txtDescription.ScrollBarAppearance = DevComponents.DotNetBar.eScrollBarAppearance.ApplicationScroll; //Size txtDescription_size = this.txtDescription.Size; //this.txtDescription.Size = new Size(txtDescription_size.Width /3, txtDescription_size.Height /3); // DotNetBar richTextBoxEx doesn't appear correctly under high DPI // Use normal richTextBox instead! this.richTextBox1.Text = updateInfo.Description; // DPI settings AutoScaleDimensions = new SizeF(96F, 96F); AutoScaleMode = AutoScaleMode.Dpi; // Set UI Font according to language lang.setFont(this.Controls); Font = new Font(lang.getFont(), Font.Size, Font.Style); }
/// <summary> /// Creates a new AutoUpdateAcceptForm /// </summary> /// <param name="applicationInfo"></param> /// <param name="updateInfo"></param> internal AutoUpdateAcceptForm(AutoUpdatable applicationInfo, AutoUpdateXml updateInfo) { InitializeComponent(); this.applicationInfo = applicationInfo; this.updateInfo = updateInfo; this.lang = applicationInfo.Lang; this.Text = lang.getString("update_found_title"); this.lblAppName.Text = this.applicationInfo.ApplicationName; this.lblUpdateAvail.Text = lang.getString("update_found"); this.lblNewVersion_label.Text = lang.getString("update_new"); this.lblCurVersion_label.Text = lang.getString("update_cur"); this.lblDescription.Text = lang.getString("update_description"); this.btnYes.Text = lang.getString("button_ok"); this.btnNo.Text = lang.getString("button_cancel"); // Assigns the icon if it isn't null if (this.applicationInfo.ApplicationIcon != null) this.Icon = this.applicationInfo.ApplicationIcon; // Adds the current version # to the form this.lblCurVersion.Text = applicationInfo.ApplicationAssembly.GetName().Version.ToString(); // Adds the update version # to the form this.lblNewVersion.Text = this.updateInfo.Version.ToString(); // Fill in update info this.txtDescription.Text = updateInfo.Description; //this.txtDescription.ScrollBarAppearance = DevComponents.DotNetBar.eScrollBarAppearance.ApplicationScroll; //Size txtDescription_size = this.txtDescription.Size; //this.txtDescription.Size = new Size(txtDescription_size.Width /3, txtDescription_size.Height /3); // DotNetBar richTextBoxEx doesn't appear correctly under high DPI // Use normal richTextBox instead! this.richTextBox1.Text = updateInfo.Description; // DPI settings AutoScaleDimensions = new SizeF(96F, 96F); AutoScaleMode = AutoScaleMode.Dpi; // Set UI Font according to language lang.setFont(this.Controls); Font = new Font(lang.getFont(), Font.Size, Font.Style); }
/// <summary> /// Creates a new AutoUpdateDownloadForm /// </summary> internal AutoUpdateDownloadForm(AutoUpdatable applicationInfo, Uri location, String md5, Icon programIcon) { InitializeComponent(); this.applicationInfo = applicationInfo; this.lang = applicationInfo.Lang; if (programIcon != null) { this.Icon = programIcon; } this.Text = lang.getString("app_name") + " - " + lang.getString("update_download"); this.lblDownloading.Text = lang.getString("update_downloading"); // Set the temp file name and create new 0-byte file tempFile = Path.GetTempFileName(); this.md5 = md5; // Set up WebClient to download file webClient = new WebClient(); webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(webClient_DownloadProgressChanged); webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(webClient_DownloadFileCompleted); // Set up backgroundworker to hash file bgWorker = new BackgroundWorker(); bgWorker.DoWork += new DoWorkEventHandler(bgWorker_DoWork); bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorker_RunWorkerCompleted); // Download file try { webClient.DownloadFileAsync(location, this.tempFile); } catch { this.DialogResult = DialogResult.No; this.Close(); } // DPI settings AutoScaleDimensions = new SizeF(96F, 96F); AutoScaleMode = AutoScaleMode.Dpi; // Set UI Font according to language lang.setFont(this.Controls); Font = new Font(lang.getFont(), Font.Size, Font.Style); }
/// <summary> /// Creates a new AutoUpdateDownloadForm /// </summary> internal AutoUpdateDownloadForm(AutoUpdatable applicationInfo, Uri location, String md5, Icon programIcon) { InitializeComponent(); this.applicationInfo = applicationInfo; this.lang = applicationInfo.Lang; if (programIcon != null) this.Icon = programIcon; this.Text = applicationInfo.ApplicationName + " - " + lang.getString("update_download"); this.lblDownloading.Text = lang.getString("update_downloading"); // Set the temp file name and create new 0-byte file tempFile = Path.GetTempFileName(); this.md5 = md5; // Set up WebClient to download file webClient = new WebClient(); webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(webClient_DownloadProgressChanged); webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(webClient_DownloadFileCompleted); // Set up backgroundworker to hash file bgWorker = new BackgroundWorker(); bgWorker.DoWork += new DoWorkEventHandler(bgWorker_DoWork); bgWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bgWorker_RunWorkerCompleted); // Download file try { webClient.DownloadFileAsync(location, this.tempFile); } catch { this.DialogResult = DialogResult.No; this.Close(); } // DPI settings AutoScaleDimensions = new SizeF(96F, 96F); AutoScaleMode = AutoScaleMode.Dpi; // Set UI Font according to language lang.setFont(this.Controls); Font = new Font(lang.getFont(), Font.Size, Font.Style); }
/// <summary> /// Creates a new AutoUpdateAcceptForm /// </summary> /// <param name="applicationInfo"></param> /// <param name="updateInfo"></param> internal AutoUpdateAcceptForm(AutoUpdatable applicationInfo, AutoUpdateXml updateInfo) { InitializeComponent(); this.applicationInfo = applicationInfo; this.updateInfo = updateInfo; this.tools = applicationInfo.Tools; pictureBox.Image = tools.Img; this.Text = tools.GetString("update_found_title"); this.lblAppName.Text = this.applicationInfo.ApplicationName; this.lblUpdateAvail.Text = tools.GetString("update_found"); this.lblNewVersion_label.Text = tools.GetString("update_new"); this.lblCurVersion_label.Text = tools.GetString("update_cur"); this.lblDescription.Text = tools.GetString("update_description"); this.btnYes.Text = tools.GetString("button_ok"); this.btnNo.Text = tools.GetString("button_cancel"); // Assigns the icon if it isn't null if (this.applicationInfo.ApplicationIcon != null) { this.Icon = this.applicationInfo.ApplicationIcon; } // Adds the current version # to the form this.lblCurVersion.Text = applicationInfo.ApplicationAssembly.GetName().Version.ToString(); // Adds the update version # to the form this.lblNewVersion.Text = this.updateInfo.Version.ToString(); // Fill in update info this.txtDescription.Text = updateInfo.Description; }