/// <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 = 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); }