Ejemplo n.º 1
0
        /// <summary>
        /// Localizes the specified <see cref="ManagedProject"/> project.
        /// </summary>
        /// <param name="project">The <see cref="ManagedProject"/> project to localize.</param>
        public static void Localize(this ManagedProject project)
        {
            project.AddBinary(new Binary(new Id("fi_FI_xsl"), @"Files\Localization\WixUI_fi-FI.wxl"));
            project.AddBinary(new Binary(new Id("en_US_xsl"), @"Files\Localization\WixUI_en-US.wxl"));

            project.UIInitialized += e =>
            {
                MsiRuntime runtime = e.ManagedUI.Shell.MsiRuntime();


                var language = DetectLanguage();
                e.Session["LANGNAME"] = GetAttribute(language).Code;

                switch (language)
                {
                case SupportedLanguages.FinnishFinland:
                    runtime.UIText.InitFromWxl(e.Session.ReadBinary("fi_FI_xsl"));
                    break;

                case SupportedLanguages.EnglishUnitedStates:
                    runtime.UIText.InitFromWxl(e.Session.ReadBinary("en_US_xsl"));
                    break;

                default:     // default to English (US)..
                    runtime.UIText.InitFromWxl(e.Session.ReadBinary("en_US_xsl"));
                    break;
                }
            };
        }
        void dialog_Load(object sender, EventArgs e)
        {
            banner.Image = Runtime.Session.GetResourceBitmap("WixUI_Bmp_Banner");

            //resolve all Control.Text cases with embedded MSI properties (e.g. 'ProductName') and *.wxl file entries
            Localize();


            foreach (var association in Associations)
            {
                association.AssociationName = MsiRuntime.Localize(association.AssociationName);
            }

            Associations = Associations.OrderBy(f => f.AssociationName).ToList();
            clbFileAssociations.Items.AddRange(Associations.Cast <object>().ToArray());
            CheckAllItems(true);
        }
Ejemplo n.º 3
0
    static void Localize(this ManagedProject project)
    {
        project.AddBinary(new Binary(new Id("de_xsl"), "WixUI_de-DE.wxl"))
        .AddBinary(new Binary(new Id("gr_xsl"), "WixUI_el-GR.wxl"));

        project.UIInitialized += (SetupEventArgs e) =>
        {
            MsiRuntime runtime = e.ManagedUI.Shell.MsiRuntime();

            switch (DetectLanguage())
            {
            case SupportedLanguages.German:
                runtime.UIText.InitFromWxl(e.Session.ReadBinary("de_xsl"));
                break;

            case SupportedLanguages.Greek:
                runtime.UIText.InitFromWxl(e.Session.ReadBinary("gr_xsl"));
                break;
            }
        };
    }
Ejemplo n.º 4
0
        public void ShowModal(MsiRuntime msiRuntime, IManagedUI ui)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            shellView = new ShellView();

            UI = ui;
            MsiRuntime = msiRuntime;

            if (MsiRuntime.Session.IsInstalling())
            {
                Dialogs = ui.InstallDialogs;
            }
            else if (MsiRuntime.Session.IsRepairing())
            {
                Dialogs = ui.ModifyDialogs;
            }

            GoNext();

            shellView.ShowDialog();
        }