Beispiel #1
0
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            if (e.Index == -1)
            {
                return;
            }

            InstallerResourceLanguage[] langs = InstallerResources.GetAvailableLanguages();
            InstallerResourceLanguage   lang  = langs[e.Index];

            e.DrawBackground();

            Graphics  g = e.Graphics;
            Rectangle r = e.Bounds;

            Int32 x = r.X + 2;
            Int32 y = r.Y + (r.Height / 2) - (lang.Flag.Height / 2);

            g.DrawImageUnscaled(lang.Flag, x, y);

            Size ts = TextRenderer.MeasureText(g, lang.LanguageName, SystemFonts.IconTitleFont);

            Int32 tx = r.X + lang.Flag.Width + 3;
            Int32 ty = r.Y + (r.Height / 2) - (ts.Height / 2);             // TODO: align by baseline, not by the rendered string size

// this code works, but it does make the list look funny
//			if( lang.RightToLeft ) {
//				tx = r.Width - ts.Width - 3;
//			}

            TextRenderer.DrawText(g, lang.LanguageName, SystemFonts.IconTitleFont, new Point(tx, ty), e.ForeColor);

            e.DrawFocusRectangle();
        }
Beispiel #2
0
        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);
                }
            }
        }
Beispiel #3
0
        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();
        }
Beispiel #4
0
        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();
            }
        }
Beispiel #5
0
        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);
                }
            }));
        }
Beispiel #6
0
        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;
            }
        }
Beispiel #7
0
        protected override void Localize()
        {
            base.Localize();

            base.WatermarkImage     = InstallerResources.GetImage("Background");
            base.WatermarkAlignment = ContentAlignment.BottomLeft;
            base.WatermarkWidth     = WatermarkImage.Width;             // 273;
        }
Beispiel #8
0
        protected override void Localize()
        {
            base.Localize();

            if (!SystemRestore.IsSystemRestoreAvailable())
            {
                __restoreDesc.Text = InstallerResources.GetString("C_F2_RestoreDescNA");
            }
        }
Beispiel #9
0
        protected override void Localize()
        {
            base.Localize();

            if (InstallerResources.IsCustomized)
            {
                __downloadInfo.Text = InstallerResources.GetString("C_C_downloadInfo_Cus", InstallerResources.CustomizedSettings.InstallerName);
            }
        }
Beispiel #10
0
        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);
            }
        }
Beispiel #11
0
        /////////////////////////////////
        // 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);
                }
            }
        }
Beispiel #12
0
        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);
            }
        }
Beispiel #13
0
        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);
            }
        }
Beispiel #14
0
        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;
        }
Beispiel #15
0
        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);
            }));
        }
Beispiel #16
0
        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);
            }
        }
Beispiel #17
0
        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
        }
Beispiel #18
0
        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;
            }));
        }
Beispiel #19
0
        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);
            }
        }
Beispiel #20
0
        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;
        }
Beispiel #21
0
        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;
            }
        }
Beispiel #22
0
        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");
            }
        }
Beispiel #23
0
        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"));
        }
Beispiel #24
0
        protected override void OnCreateControl()
        {
            base.OnCreateControl();

            if (DesignMode)
            {
                return;
            }

            if (!_isPopulated)
            {
                Items.Clear();

                InstallerResourceLanguage[] languages = InstallerResources.GetAvailableLanguages();
                Items.AddRange(languages);
                SelectedItem = InstallerResources.CurrentLanguage;

                _isPopulated = true;
            }
        }
Beispiel #25
0
        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;
            }
        }
Beispiel #26
0
        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);
                }
            }));
        }
Beispiel #27
0
 private static Bitmap GetBannerImage()
 {
     return(InstallerResources.GetImage("Banner") as Bitmap);
 }
Beispiel #28
0
 private String G(String name)
 {
     return(InstallerResources.GetString(LocalizePrefix + "_" + name));
 }
Beispiel #29
0
        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);
            }
        }
Beispiel #30
0
        private void InstallationOptionsPage_PageLoad(object sender, EventArgs e)
        {
            _oldNextText = WizardForm.NextText;

            WizardForm.NextText = InstallerResources.GetString("C_F_installButton");
        }