protected override void Localize() { base.Localize(); if (InstallationInfo.ProgramMode == ProgramMode.UninstallPackage) { if (InstallerResources.IsCustomized) { PageSubtitle = InstallerResources.GetString("E_B_Title_Cus", InstallerResources.CustomizedSettings.InstallerName); PageSubtitle = InstallerResources.GetString("E_B_Subtitle_Cus", InstallerResources.CustomizedSettings.InstallerName); } else { PageTitle = InstallerResources.GetString("E_B_Title"); PageSubtitle = InstallerResources.GetString("E_B_Subtitle"); } } else { if (InstallerResources.IsCustomized) { PageSubtitle = InstallerResources.GetString("C_G_Subtitle_Cus", InstallerResources.CustomizedSettings.InstallerName); } } }
private void Archive_Completed(String destDir) { this.Invoke(new MethodInvoker(delegate() { if (destDir != null) { __statusLbl.Text = InstallerResources.GetString("C_B_instantiating"); String packageFileName = Path.Combine(destDir, "package.xml"); if (!File.Exists(packageFileName)) { MessageBox.Show(this, InstallerResources.GetString("C_B_errorPackageXmlNotFound"), "Anolis", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } InstantiatePackage(packageFileName); } else { String message; if (InstallerResources.IsCustomized) { message = InstallerResources.GetString("C_B_error_Cus", InstallerResources.CustomizedSettings.InstallerFullName); } else { message = InstallerResources.GetString("C_B_error"); } // the previous PackageProgressEvent method call will contain the error string, so don't set anything and display a message to the user MessageBox.Show(this, message, "Anolis", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } })); }
private void WelcomePage_PageUnload(object sender, W3b.Wizards.PageChangeEventArgs e) { /////////////////////// // Installer Condition if (!PackageInfo.IgnoreCondition && !InstallationInfo.EvaluateInstallerCondition()) { String message = InstallerResources.CustomizedSettings.InstallerConditionMessage; MessageBox.Show(this, message, "Anolis Installer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } /////////////////////// // Pending Operations if (!PackageInfo.IgnoreCondition && PackageUtility.HasPendingRestart()) { String message; if (InstallerResources.IsCustomized) { message = InstallerResources.GetString("A_PendingOperations_Cus", InstallerResources.CustomizedSettings.InstallerFullName); } else { message = InstallerResources.GetString("A_PendingOperations"); } MessageBox.Show(message, InstallationInfo.InstallerTitle, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); e.Cancel = true; } }
private void __bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { String title = InstallerResources.GetString("G2_ErrorTitle"); String message = InstallerResources.GetString("G2_ErrorMessage"); if (e.Error != null) { // never query e.Result, it raises exceptions if there's an error message += " " + e.Error.Message + " - " + e.Error.GetType().Name; MessageBox.Show(this, message, title, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } else { if (e.Result == null || (FeedbackResult)e.Result == FeedbackResult.Error) { // then it's an unknown error (spooky!) message += " " + InstallerResources.GetString("G2_UnknownError"); MessageBox.Show(this, message, title, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } } Close(); }
private void __bw_DoWork(object sender, DoWorkEventArgs e) { PackageExecutionSettings settings = new PackageExecutionSettings(); settings.LiteMode = PackageInfo.LiteMode; if (PackageInfo.I386Install) { settings.ExecutionMode = PackageExecutionMode.CDImage; settings.I386Directory = PackageInfo.I386Directory; } else { settings.ExecutionMode = PackageExecutionMode.Regular; settings.CreateSystemRestorePoint = PackageInfo.SystemRestore; settings.BackupDirectory = PackageInfo.BackupPath != null ? new DirectoryInfo(PackageInfo.BackupPath) : null; } PackageInfo.Package.Execute(settings); PackageInfo.RequiresRestart = PackageInfo.Package.ExecutionInfo.RequiresRestart; /////////////////////////////// // Clean Up Extracted and Temporary Files if (PackageInfo.Source == PackageSource.Archive || PackageInfo.Source == PackageSource.Embedded) { BeginInvoke(new MethodInvoker(delegate() { __progress.Style = ProgressBarStyle.Marquee; __statusLbl.Text = InstallerResources.GetString("C_G_cleanup"); })); PackageInfo.Package.DeleteFiles(); } }
protected override void Localize() { base.Localize(); if (!SystemRestore.IsSystemRestoreAvailable()) { __restoreDesc.Text = InstallerResources.GetString("C_F2_RestoreDescNA"); } }
protected override void Localize() { base.Localize(); if (InstallerResources.IsCustomized) { __downloadInfo.Text = InstallerResources.GetString("C_C_downloadInfo_Cus", InstallerResources.CustomizedSettings.InstallerName); } }
protected override void Localize() { base.Localize(); if (InstallerResources.IsCustomized) { PageTitle = InstallerResources.GetString("C_B_Title_Cus", InstallerResources.CustomizedSettings.InstallerName); PageSubtitle = InstallerResources.GetString("C_B_Subtitle_Cus", InstallerResources.CustomizedSettings.InstallerFullName); } }
///////////////////////////////// // Download update info private void DownloadInfo() { __bw.ReportProgress(-1, InstallerResources.GetString("C_C_infoChecking")); _updateInfo = PackageInfo.Package.CheckForUpdates(); if (_updateInfo == null) { __bw.ReportProgress(100, InstallerResources.GetString("C_C_infoFailed")); PackageInfo.Package.Log.Add(LogSeverity.Warning, InstallerResources.GetString("C_C_infoFailed")); } else { Boolean isNewer = _updateInfo.Version > PackageInfo.Package.Version; if (isNewer) { if (_updateInfo.InformationLocation != null) { BeginInvoke(new MethodInvoker(delegate() { __downloadInfo.Tag = _updateInfo.InformationLocation; __downloadInfo.Visible = true; })); } if (_updateInfo.PackageLocation != null) { String message = InstallerResources.GetString("C_C_infoUpdateAvailableAutomatic"); message = String.Format(Cult.CurrentCulture, message, _updateInfo.Version); __bw.ReportProgress(0, message); BeginInvoke(new MethodInvoker(delegate() { __downloadYes.Visible = true; __downloadNo.Visible = true; })); } else { String message = InstallerResources.GetString("C_C_infoUpdateAvailableManual"); message = String.Format(Cult.CurrentCulture, message, _updateInfo.Version); __bw.ReportProgress(100, message); } } else { String message = InstallerResources.GetString("C_C_infoUpdateLatest"); message = String.Format(Cult.CurrentCulture, message, PackageInfo.Package.Version); __bw.ReportProgress(100, message); } } }
protected override void Localize() { base.Localize(); // problem: the feedback form will be shown regardless of whether or not the uninstallation package has a feedback URI set if (InstallerResources.IsCustomized) { __feedbackLbl.Text = InstallerResources.GetString("E_A_feedbackLbl_Cus", InstallerResources.CustomizedSettings.InstallerName, InstallerResources.CustomizedSettings.InstallerDeveloper); } }
protected override void Localize() { base.Localize(); if (InstallerResources.IsCustomized) { __installRad.Text = InstallerResources.GetString("B_installRad_Cus", InstallerResources.CustomizedSettings.InstallerFullName); __installBlurb.Text = InstallerResources.GetString("B_installBlurb_Cus", InstallerResources.CustomizedSettings.InstallerName); __uninstallRad.Text = InstallerResources.GetString("B_uninstallRad_Cus", InstallerResources.CustomizedSettings.InstallerFullName); __toolsBlurb.Text = InstallerResources.GetString("B_toolsBlurb_Cus", InstallerResources.CustomizedSettings.InstallerName); } }
private void InstallationOptionsPage_PageUnload(object sender, PageChangeEventArgs e) { if (e.PageToBeLoaded == Program.PageCGInstalling) { if (__i386.Checked) { String i386Path = __i386Path.Text; if (!ValidateCDImagePath(i386Path)) { e.Cancel = true; MessageBox.Show(this, InstallerResources.GetString("C_F_pathInvalidI386"), "Anolis Installer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } } if (__backup.Checked) { String backupPath = __backupPath.Text; if (backupPath.Length == 0 || !Path.IsPathRooted(backupPath)) { e.Cancel = true; MessageBox.Show(this, InstallerResources.GetString("C_F_pathInvalidBackup"), "Anolis Installer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } DirectoryInfo dir = new DirectoryInfo(backupPath); if (dir.Exists && !dir.IsEmpty()) { e.Cancel = true; MessageBox.Show(this, InstallerResources.GetString("C_F_pathExistsBackup"), "Anolis Installer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); return; } } PackageInfo.BackupPath = __backup.Checked ? __backupPath.Text : null; PackageInfo.I386Install = __i386.Checked; if (__i386.Checked) { PackageInfo.I386Directory = new System.IO.DirectoryInfo(__i386Path.Text); } } WizardForm.NextText = _oldNextText; }
private void ShowError(String exceptionMessage) { Invoke(new MethodInvoker(delegate() { WizardForm.EnableBack = true; WizardForm.EnableNext = false; __statusLbl.Text = InstallerResources.GetString("D_B_downloadFailed"); String message = InstallerResources.GetString("C_C_infoFailed") + ": " + exceptionMessage; MessageBox.Show(this, message, "Anolis Installer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); })); }
protected override void Localize() { base.Localize(); base.WatermarkImage = InstallerResources.GetImage("Background"); base.WatermarkAlignment = ContentAlignment.BottomLeft; base.WatermarkWidth = WatermarkImage.Width; // 273; if (InstallerResources.IsCustomized) { this.__title.Text = InstallerResources.GetString("A_Title_Cus", InstallerResources.CustomizedSettings.InstallerFullName); this.__notes.Text = InstallerResources.GetString("A_Notes_Cus", InstallerResources.CustomizedSettings.InstallerFullName); } }
private void ReleaseNotesPage_PageLoad(object sender, EventArgs e) { Package package = PackageInfo.Package; String packageNotes = package.ReleaseNotes; String installerNotes = InstallerResources.GetString("EULA"); __packageRtf.Rtf = packageNotes; __installerRtf.Rtf = installerNotes; __packageTab.Text = InstallerResources.GetString("C_D_packageNotes", PackageInfo.Package.Name); // TODO: Hide the package tab if it has no notes. This isn't a trivial operation, the tab has to be physically removed or re-added }
private void __downloadYes_Click(object sender, EventArgs e) { __sfd.Title = InstallerResources.GetString("C_C_sfdTitle"); if (__sfd.ShowDialog(this) == DialogResult.OK) { __downloadYes.Enabled = false; __downloadNo.Enabled = false; WizardForm.EnableBack = false; WizardForm.EnableNext = false; DownloadPackage(__sfd.FileName); } }
private void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e) { _rate.Add(e.BytesReceived); Int64 xferRate = _rate.GetRate(); String message = InstallerResources.GetString("C_C_downloadProgress"); message = String.Format(Cult.CurrentCulture, message, e.ProgressPercentage, e.BytesReceived / 1024, e.TotalBytesToReceive / 1024, xferRate); BeginInvoke(new MethodInvoker(delegate() { __progress.Value = e.ProgressPercentage; __statusLbl.Text = message; })); }
protected override void Localize() { base.Localize(); if (InstallerResources.IsCustomized) { PageSubtitle = InstallerResources.GetString("C_D_Subtitle_Cus", InstallerResources.CustomizedSettings.InstallerName); } __installerTab.Text = InstallerResources.GetString("C_D_installerNotes"); // the release notes should never have RTL set to true as it's often in English __installerRtf.RightToLeft = System.Windows.Forms.RightToLeft.No; __packageRtf.RightToLeft = System.Windows.Forms.RightToLeft.No; }
private void Page_Load(object sender, EventArgs e) { InstallationInfo.ProgramMode = ProgramMode.UninstallPackage; WizardForm.NextText = InstallerResources.GetString("E_A_uninstallButton"); if (InstallationInfo.UninstallPackage != null) { WizardForm.EnableBack = false; // as the control is not visible, CreateControl will not be called, so it won't double-load the stuff __culture.Visible = true; __uninstallationLanguage.Visible = true; __dir.Text = InstallationInfo.UninstallPackage.Directory.FullName; } }
private void Page_Unload(object sender, W3b.Wizards.PageChangeEventArgs e) { if (e.PageToBeLoaded != NextPage) { WizardForm.NextText = InstallerResources.GetString("Wiz_Next"); return; } if (!PrepareToUninstall()) { MessageBox.Show(this, InstallerResources.GetString("E_A_notValidDirectory"), "Anolis Installer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); e.Cancel = true; } else { WizardForm.NextText = InstallerResources.GetString("Wiz_Next"); } }
public SelectorPage() { InitializeComponent(); this.__advanced.Click += new EventHandler(__advanced_Click); this.__presets.SelectedIndexChanged += new EventHandler(__presets_SelectedIndexChanged); this.__wallpaper.SelectionChangeCommitted += new EventHandler(SelectionChangeCommitted); this.__logonPreview.CheckedChanged += new EventHandler(SelectionChangeCommitted); this.__logon.SelectionChangeCommitted += new EventHandler(SelectionChangeCommitted); this.__bitmaps.SelectionChangeCommitted += new EventHandler(SelectionChangeCommitted); this.__visualStyles.SelectionChangeCommitted += new EventHandler(SelectionChangeCommitted); this.PageLoad += new EventHandler(SelectorPage_PageLoad); this.PageUnload += new EventHandler <W3b.Wizards.PageChangeEventArgs>(SelectorPage_PageUnload); _customPreset = new Preset(InstallerResources.GetString("C_E1_Custom")); }
private void PopulatePackageItemInfo(PackageItem item) { if (item == null) { __infoPicture.Image = null; __infoLbl.Text = null; return; } if (item.DescriptionImage == null) { __infoPicture.Visible = false; __infoLbl.Top = __infoPicture.Top; } else { __infoPicture.Image = item.DescriptionImage; __infoPicture.Visible = true; __infoLbl.Top = __infoPicture.Bottom + 3; } if (String.IsNullOrEmpty(item.Description)) { PathOperation po = item as PathOperation; if (po != null) { __infoLbl.Text = po.Path; } else { __infoLbl.Text = String.Format(Cult.CurrentCulture, InstallerResources.GetString("C_E_noInfo"), item.Name); } } else { __infoLbl.Text = item.Description; } }
private void Package_ProgressEvent(object sender, PackageProgressEventArgs e) { if (!IsHandleCreated) { return; } BeginInvoke(new MethodInvoker(delegate() { if (e.Percentage == -1) { __progress.Style = ProgressBarStyle.Marquee; __statusLbl.Text = e.Message; } else { __progress.Style = ProgressBarStyle.Blocks; __progress.Value = e.Percentage; __statusLbl.Text = String.Format(InstallerResources.GetString("C_G_status"), e.Percentage, e.Message); } })); }
private void FinishedPage_PageLoad(object sender, EventArgs e) { this.WizardForm.EnableBack = false; this.WizardForm.EnableNext = true; this.WizardForm.EnableCancel = false; if (InstallerResources.IsCustomized) { String author = InstallerResources.CustomizedSettings.InstallerDeveloper; String webStr = InstallerResources.CustomizedSettings.InstallerWebsite; Uri uri; if (!String.IsNullOrEmpty(author) && Uri.TryCreate(InstallerResources.CustomizedSettings.InstallerWebsite, UriKind.Absolute, out uri)) { __authorWebsiteLbl.Text = author; __authorWebsiteLbl.Visible = true; __authorWebsite.Tag = uri; __authorWebsite.Text = uri.OriginalString; __authorWebsite.Visible = true; } } if (InstallationInfo.InstallationAborted) { this.__title.Text = InstallerResources.GetString("F_aborted"); this.__installationComplete.Text = InstallerResources.GetString("F_abortedDesc"); this.WizardForm.NextText = InstallerResources.GetString("F_finishButton"); this.WizardForm.NextClicked += new EventHandler(WizardForm_NextClicked_Quit); } else { switch (InstallationInfo.ProgramMode) { case ProgramMode.InstallPackage: if (PackageInfo.RequiresRestart) { this.__installationComplete.Text = InstallerResources.GetString("F_installationCompleteRestart"); } else { this.__installationComplete.Text = InstallerResources.GetString("F_installationComplete"); } break; case ProgramMode.UninstallPackage: this.__title.Text = InstallerResources.GetString("F_TitleUninstall"); if (PackageInfo.RequiresRestart) { this.__installationComplete.Text = InstallerResources.GetString("F_uninstallationCompleteRestart"); } else { this.__installationComplete.Text = InstallerResources.GetString("F_uninstallationComplete"); } break; case ProgramMode.InstallTools: this.__installationComplete.Text = InstallerResources.GetString("F_installTools"); break; } ///////////////////////////////// if (PackageInfo.RequiresRestart) { this.WizardForm.NextText = InstallerResources.GetString("F_restartButton"); this.WizardForm.NextClicked += new EventHandler(WizardForm_NextClicked_Restart); } else { this.WizardForm.NextText = InstallerResources.GetString("F_finishButton"); this.WizardForm.NextClicked += new EventHandler(WizardForm_NextClicked_Quit); } } if (InstallationInfo.FeedbackCanSend && InstallationInfo.FeedbackSend) { SendFeedbackForm feedbackForm = new SendFeedbackForm(); feedbackForm.ShowDialog(this); } }
private String G(String name) { return(InstallerResources.GetString(LocalizePrefix + "_" + name)); }
private void SelectPackagePage_PageUnload(object sender, W3b.Wizards.PageChangeEventArgs e) { if (InstallerResources.IsCustomized && InstallerResources.CustomizedSettings.SimpleUI) { return; } if (e.PageToBeLoaded == Program.PageBMainAction) { return; } if (__embedRad.Checked) { if (__embedList.SelectedItem == null) { MessageBox.Show(this, InstallerResources.GetString("C_A_selectEmbeddedPackageFirst"), "Anolis Installer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); e.Cancel = true; return; } EmbeddedPackage package = __embedList.SelectedItem as EmbeddedPackage; Stream stream = PackageUtility.GetEmbeddedPackage(package); PackageInfo.Source = PackageSource.Embedded; PackageInfo.SourcePath = package.Name; PackageInfo.Archive = PackageArchive.FromStream(package.Name, PackageSubclass.LzmaTarball, stream); } else if (__packRad.Checked) { if (!File.Exists(__packFilename.Text)) { String message = String.Format(CultureInfo.InvariantCulture, InstallerResources.GetString("C_A_notFileExists"), __anopFilename.Text); MessageBox.Show(this, message, "Anolis Installer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); e.Cancel = true; return; } String packageName = new DirectoryInfo(Path.GetDirectoryName(__packFilename.Text)).Name; PackageInfo.Source = PackageSource.File; PackageInfo.SourcePath = __packFilename.Text; } else if (__anopRad.Checked) { if (!File.Exists(__anopFilename.Text)) { String message = String.Format(CultureInfo.InvariantCulture, InstallerResources.GetString("C_A_notFileExists"), __anopFilename.Text); MessageBox.Show(this, message, "Anolis Installer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); e.Cancel = true; return; } String packageName = Path.GetFileNameWithoutExtension(__anopFilename.Text); Stream stream = File.OpenRead(__anopFilename.Text); PackageInfo.Source = PackageSource.Archive; PackageInfo.SourcePath = __anopFilename.Text; PackageInfo.Archive = PackageArchive.FromStream(packageName, PackageSubclass.LzmaTarball, stream); } }
private void InstallationOptionsPage_PageLoad(object sender, EventArgs e) { _oldNextText = WizardForm.NextText; WizardForm.NextText = InstallerResources.GetString("C_F_installButton"); }
private void InstantiatePackage(String path) { try { PackageInfo.Package = Package.FromFile(path); if (InstallationInfo.UseSelector == null) { InstallationInfo.UseSelector = PackageInfo.Package.Presets.Count > 0; } } catch (PackageValidationException pve) { __packageMessages.Visible = true; StringBuilder sb = new StringBuilder(); sb.AppendLine(pve.Message); foreach (System.Xml.Schema.ValidationEventArgs ve in pve.ValidationErrors) { sb.Append(ve.Severity); sb.Append(" "); sb.Append(ve.Message); sb.Append(" "); if (ve.Exception != null) { sb.Append(ve.Exception.Message); sb.Append(" ("); sb.Append(ve.Exception.LineNumber); sb.Append(", "); sb.Append(ve.Exception.LinePosition); sb.Append(")"); } sb.AppendLine(); } __packageMessages.Text = sb.ToString(); __packageMessages.Visible = true; _prev = Program.PageCASelectPackage; WizardForm.EnableBack = true; return; } catch (Exception ex) { StringBuilder sb = new StringBuilder(); while (ex != null) { sb.Append(ex.GetType().Name); sb.Append(" - "); sb.AppendLine(ex.Message); sb.AppendLine(ex.StackTrace); sb.AppendLine(); ex = ex.InnerException; } __packageMessages.Text = sb.ToString(); __packageMessages.Visible = true; _prev = Program.PageCASelectPackage; WizardForm.EnableBack = true; return; } ////////////////////////////////////////////////// if (!PackageInfo.IgnoreCondition) { EvaluationResult result = PackageInfo.Package.Evaluate(); if (result == EvaluationResult.False || result == EvaluationResult.FalseParent) { String message = PackageInfo.Package.ConditionDesc; MessageBox.Show(this, message, "Anolis Installer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); InstallationInfo.FailedCondition = true; } else if (result == EvaluationResult.Error) { MessageBox.Show(this, InstallerResources.GetString("C_B_conditionError"), "Anolis Installer", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); WizardForm.LoadPage(Program.PageCASelectPackage); return; } } WizardForm.LoadPage(Program.PageCCUpdatePackage); }