public winUpdater(GitHubUpdater updater, IReadOnlyList <GitHubUpdateResult> updateResult, Action postUpdateLoad) : base("winUpdater") { this.updater = updater; this.updateResult = updateResult; this.postUpdateLoad = postUpdateLoad; Windows.WindowSwitcher.UpdaterWindow = this; this.Windowed = true; this.TitleBar.Text = "Updater"; this.TitleBar.Font = Graphics.FontManager.LoadFont("tahoma", 10); this.Size = new Size(400, 400); this.BackColor = Color.White; this.Location = DrawingSupport.GetCenter(WindowManager.ScreenSize, this.Size); lblUpdateFound = new Label("lblUpdateFound"); lblUpdateFound.Location = new Point(10, 300); lblUpdateFound.AutoSize = true; lblUpdateFound.Font = Graphics.FontManager.LoadFont("tahoma", 12); lblUpdateFound.Text = "An update has been found! Would you like to install this update?"; packageScroller = new PackageScroller("packageScroller"); packageScroller.Location = new Point(0, 0); if (updateResult.Count > 0) { foreach (var package in updateResult) { packageScroller.AddPackage(new PackageInfo() { Name = package.PackageName, PublishDate = package.PublishDate, Size = package.Size }); } } packageScroller.PackageButtonSelected += new EventHandler <PackageButtonSelectedEventArgs>(packageScroller_PackageButtonSelected); lblUpdateInfo = new Label("lblUpdateInfo"); lblUpdateInfo.Size = new Size(188, 300); lblUpdateInfo.Location = new Point(212, 0); lblUpdateInfo.WordWrap = true; lblUpdateInfo.Font = Graphics.FontManager.LoadFont("tahoma", 12); lblStatus = new Label("lblStatus"); lblStatus.Location = new Point(lblUpdateFound.Location.X, lblUpdateFound.Location.Y + lblUpdateFound.Height + 5); lblStatus.AutoSize = true; lblStatus.Font = Graphics.FontManager.LoadFont("tahoma", 12); lblStatus.Visible = false; lblStatus = new Label("lblStatus"); lblStatus.Location = new Point(lblUpdateFound.Location.X, lblUpdateFound.Location.Y + lblUpdateFound.Height + 5); lblStatus.AutoSize = true; lblStatus.Font = Graphics.FontManager.LoadFont("tahoma", 12); lblStatus.Visible = false; pgbDownloadProgress = new ProgressBar("pgbDownloadProgress"); pgbDownloadProgress.Location = new Point(lblUpdateFound.Location.X, lblUpdateFound.Location.Y + lblUpdateFound.Height + 5); pgbDownloadProgress.Size = new System.Drawing.Size(this.Width - (lblUpdateFound.Location.X * 2), 20); pgbDownloadProgress.Font = Graphics.FontManager.LoadFont("tahoma", 12); pgbDownloadProgress.Visible = false; pgbDownloadProgress.TextStyle = ProgressBarTextStyle.Percent; btnAccept = new Button("btnAccept"); btnAccept.Text = "Yes"; btnAccept.Font = Graphics.FontManager.LoadFont("tahoma", 12); btnAccept.Size = new Size(100, 20); btnAccept.Location = new Point(lblUpdateFound.Location.X, lblUpdateFound.Location.Y + lblUpdateFound.Height + 5); btnAccept.Click += new EventHandler <MouseButtonEventArgs>(btnAccept_Click); btnDecline = new Button("btnDecline"); btnDecline.Text = "Skip"; btnDecline.Font = Graphics.FontManager.LoadFont("tahoma", 12); btnDecline.Size = new Size(100, 20); btnDecline.Location = new Point(lblUpdateFound.Location.X + btnAccept.Width + 5, lblUpdateFound.Location.Y + lblUpdateFound.Height + 5); btnDecline.Click += new EventHandler <MouseButtonEventArgs>(btnDecline_Click); tmrRestart = new SdlDotNet.Widgets.Timer("restartTimer"); tmrRestart.Interval = 1000; tmrRestart.Elapsed += new EventHandler(tmrRestart_Elapsed); this.AddWidget(packageScroller); this.AddWidget(lblUpdateInfo); this.AddWidget(lblUpdateFound); this.AddWidget(btnAccept); this.AddWidget(btnDecline); this.AddWidget(lblStatus); this.AddWidget(pgbDownloadProgress); this.AddWidget(tmrRestart); this.LoadComplete(); packageScroller.ScrollToButton(0); LoadPackageInfo(packageScroller.Buttons[0]); }
public winUpdater(UpdateEngine updateEngine) : base("winUpdater") { Windows.WindowSwitcher.UpdaterWindow = this; this.updateEngine = updateEngine; this.updateEngine.Updater.StatusUpdated += new EventHandler(Updater_StatusUpdated); this.updateEngine.Updater.PackageDownloadStart += new EventHandler<PMU.Updater.PackageDownloadStartEventArgs>(Updater_PackageDownloadStart); this.updateEngine.Updater.PackageInstallationComplete += new EventHandler<PMU.Updater.PackageInstallationCompleteEventArgs>(Updater_PackageInstallationComplete); this.updateEngine.Updater.InstallationComplete += new EventHandler(Updater_InstallationComplete); this.Windowed = true; this.TitleBar.Text = "Updater"; this.TitleBar.Font = Graphics.FontManager.LoadFont("tahoma", 10); this.Size = new Size(400, 400); this.BackColor = Color.White; this.Location = DrawingSupport.GetCenter(WindowManager.ScreenSize, this.Size); lblUpdateFound = new Label("lblUpdateFound"); lblUpdateFound.Location = new Point(10, 300); lblUpdateFound.AutoSize = true; lblUpdateFound.Font = Graphics.FontManager.LoadFont("tahoma", 12); lblUpdateFound.Text = "An update has been found! Would you like to install this update?"; packageScroller = new PackageScroller("packageScroller"); packageScroller.Location = new Point(0, 0); for (int i = 0; i < updateEngine.LastCheckResult.PackagesToUpdate.Count; i++) { packageScroller.AddPackage(updateEngine.LastCheckResult.PackagesToUpdate[i]); } packageScroller.PackageButtonSelected += new EventHandler<PackageButtonSelectedEventArgs>(packageScroller_PackageButtonSelected); lblUpdateInfo = new Label("lblUpdateInfo"); lblUpdateInfo.Size = new Size(188, 300); lblUpdateInfo.Location = new Point(212, 0); lblUpdateInfo.WordWrap = true; lblUpdateInfo.Font = Graphics.FontManager.LoadFont("tahoma", 12); lblStatus = new Label("lblStatus"); lblStatus.Location = new Point(lblUpdateFound.Location.X, lblUpdateFound.Location.Y + lblUpdateFound.Height + 5); lblStatus.AutoSize = true; lblStatus.Font = Graphics.FontManager.LoadFont("tahoma", 12); lblStatus.Visible = false; lblStatus = new Label("lblStatus"); lblStatus.Location = new Point(lblUpdateFound.Location.X, lblUpdateFound.Location.Y + lblUpdateFound.Height + 5); lblStatus.AutoSize = true; lblStatus.Font = Graphics.FontManager.LoadFont("tahoma", 12); lblStatus.Visible = false; pgbDownloadProgress = new ProgressBar("pgbDownloadProgress"); pgbDownloadProgress.Location = new Point(lblUpdateFound.Location.X, lblUpdateFound.Location.Y + lblUpdateFound.Height + 5); pgbDownloadProgress.Size = new System.Drawing.Size(this.Width - (lblUpdateFound.Location.X * 2), 20); pgbDownloadProgress.Font = Graphics.FontManager.LoadFont("tahoma", 12); pgbDownloadProgress.Visible = false; pgbDownloadProgress.TextStyle = ProgressBarTextStyle.Percent; btnAccept = new Button("btnAccept"); btnAccept.Text = "Yes"; btnAccept.Font = Graphics.FontManager.LoadFont("tahoma", 12); btnAccept.Size = new Size(100, 20); btnAccept.Location = new Point(lblUpdateFound.Location.X, lblUpdateFound.Location.Y + lblUpdateFound.Height + 5); btnAccept.Click += new EventHandler<MouseButtonEventArgs>(btnAccept_Click); btnDecline = new Button("btnDecline"); btnDecline.Text = "No"; btnDecline.Font = Graphics.FontManager.LoadFont("tahoma", 12); btnDecline.Size = new Size(100, 20); btnDecline.Location = new Point(lblUpdateFound.Location.X + btnAccept.Width + 5, lblUpdateFound.Location.Y + lblUpdateFound.Height + 5); btnDecline.Click += new EventHandler<MouseButtonEventArgs>(btnDecline_Click); tmrRestart = new SdlDotNet.Widgets.Timer("restartTimer"); tmrRestart.Interval = 1000; tmrRestart.Elapsed += new EventHandler(tmrRestart_Elapsed); this.AddWidget(packageScroller); this.AddWidget(lblUpdateInfo); this.AddWidget(lblUpdateFound); this.AddWidget(btnAccept); this.AddWidget(btnDecline); this.AddWidget(lblStatus); this.AddWidget(pgbDownloadProgress); this.AddWidget(tmrRestart); this.LoadComplete(); packageScroller.ScrollToButton(0); LoadPackageInfo(packageScroller.Buttons[0]); }
public winUpdater(UpdateEngine updateEngine) : base("winUpdater") { Windows.WindowSwitcher.UpdaterWindow = this; this.updateEngine = updateEngine; this.updateEngine.Updater.StatusUpdated += new EventHandler(Updater_StatusUpdated); this.updateEngine.Updater.PackageDownloadStart += new EventHandler <PMU.Updater.PackageDownloadStartEventArgs>(Updater_PackageDownloadStart); this.updateEngine.Updater.PackageInstallationComplete += new EventHandler <PMU.Updater.PackageInstallationCompleteEventArgs>(Updater_PackageInstallationComplete); this.updateEngine.Updater.InstallationComplete += new EventHandler(Updater_InstallationComplete); this.Windowed = true; this.TitleBar.Text = "Updater"; this.TitleBar.Font = Graphics.FontManager.LoadFont("tahoma", 10); this.Size = new Size(400, 400); this.BackColor = Color.White; this.Location = DrawingSupport.GetCenter(WindowManager.ScreenSize, this.Size); lblUpdateFound = new Label("lblUpdateFound"); lblUpdateFound.Location = new Point(10, 300); lblUpdateFound.AutoSize = true; lblUpdateFound.Font = Graphics.FontManager.LoadFont("tahoma", 12); lblUpdateFound.Text = "An update has been found! Would you like to install this update?"; packageScroller = new PackageScroller("packageScroller"); packageScroller.Location = new Point(0, 0); for (int i = 0; i < updateEngine.LastCheckResult.PackagesToUpdate.Count; i++) { packageScroller.AddPackage(updateEngine.LastCheckResult.PackagesToUpdate[i]); } packageScroller.PackageButtonSelected += new EventHandler <PackageButtonSelectedEventArgs>(packageScroller_PackageButtonSelected); lblUpdateInfo = new Label("lblUpdateInfo"); lblUpdateInfo.Size = new Size(188, 300); lblUpdateInfo.Location = new Point(212, 0); lblUpdateInfo.WordWrap = true; lblUpdateInfo.Font = Graphics.FontManager.LoadFont("tahoma", 12); lblStatus = new Label("lblStatus"); lblStatus.Location = new Point(lblUpdateFound.Location.X, lblUpdateFound.Location.Y + lblUpdateFound.Height + 5); lblStatus.AutoSize = true; lblStatus.Font = Graphics.FontManager.LoadFont("tahoma", 12); lblStatus.Visible = false; lblStatus = new Label("lblStatus"); lblStatus.Location = new Point(lblUpdateFound.Location.X, lblUpdateFound.Location.Y + lblUpdateFound.Height + 5); lblStatus.AutoSize = true; lblStatus.Font = Graphics.FontManager.LoadFont("tahoma", 12); lblStatus.Visible = false; pgbDownloadProgress = new ProgressBar("pgbDownloadProgress"); pgbDownloadProgress.Location = new Point(lblUpdateFound.Location.X, lblUpdateFound.Location.Y + lblUpdateFound.Height + 5); pgbDownloadProgress.Size = new System.Drawing.Size(this.Width - (lblUpdateFound.Location.X * 2), 20); pgbDownloadProgress.Font = Graphics.FontManager.LoadFont("tahoma", 12); pgbDownloadProgress.Visible = false; pgbDownloadProgress.TextStyle = ProgressBarTextStyle.Percent; btnAccept = new Button("btnAccept"); btnAccept.Text = "Yes"; btnAccept.Font = Graphics.FontManager.LoadFont("tahoma", 12); btnAccept.Size = new Size(100, 20); btnAccept.Location = new Point(lblUpdateFound.Location.X, lblUpdateFound.Location.Y + lblUpdateFound.Height + 5); btnAccept.Click += new EventHandler <MouseButtonEventArgs>(btnAccept_Click); btnDecline = new Button("btnDecline"); btnDecline.Text = "No"; btnDecline.Font = Graphics.FontManager.LoadFont("tahoma", 12); btnDecline.Size = new Size(100, 20); btnDecline.Location = new Point(lblUpdateFound.Location.X + btnAccept.Width + 5, lblUpdateFound.Location.Y + lblUpdateFound.Height + 5); btnDecline.Click += new EventHandler <MouseButtonEventArgs>(btnDecline_Click); tmrRestart = new SdlDotNet.Widgets.Timer("restartTimer"); tmrRestart.Interval = 1000; tmrRestart.Elapsed += new EventHandler(tmrRestart_Elapsed); this.AddWidget(packageScroller); this.AddWidget(lblUpdateInfo); this.AddWidget(lblUpdateFound); this.AddWidget(btnAccept); this.AddWidget(btnDecline); this.AddWidget(lblStatus); this.AddWidget(pgbDownloadProgress); this.AddWidget(tmrRestart); this.LoadComplete(); packageScroller.ScrollToButton(0); LoadPackageInfo(packageScroller.Buttons[0]); }