예제 #1
0
        // are the current settings the old ones (i.e. we reset the settings)?
        void checkChanges(bool currentOld = false)
        {
            // no loaded project, no need to check changes
            if (VsUtils.GetCurrentProject() == null)
            {
                return;
            }

            Settings.UseStaticResourceXAML = !useDynamicXamlCB.Checked;

            // if the settings changed and they're not empty, update them
            if (Settings.SetLocaleOnStartup != selectLocaleStartCB.Checked)
            {
                Ensurer.EnsureAppXamlCs();
            }

            if (Settings.ResourcesFolderName != resFolderNameTB.Text &&
                resFolderNameTB.Text.Length > 0)
            {
                if (currentOld) // change the order depending on which are the old settings
                {
                    Ensurer.RenameResFolder(resFolderNameTB.Text, Settings.ResourcesFolderName);
                }
                else
                {
                    Ensurer.RenameResFolder(Settings.ResourcesFolderName, resFolderNameTB.Text);
                }
            }

            if (Settings.ResourcesManagerName != resManNameTB.Text &&
                resManNameTB.Text.Length > 0)
            {
                if (currentOld)
                {
                    Ensurer.RenameResManager(resManNameTB.Text, Settings.ResourcesManagerName);
                }
                else
                {
                    Ensurer.RenameResManager(Settings.ResourcesManagerName, resManNameTB.Text);
                }
            }
        }
예제 #2
0
        void addTranslation(string localeCode)
        {
            if (!string.IsNullOrWhiteSpace(localeCode))
            {
                var path = Resourcer.GetXamlResPath(localeCode);
                if (File.Exists(path)) // get the strings res path and check if it exists
                {
                    MessageBox.Show("This locale code was already added",
                                    "Existing locale", MessageBoxButtons.YesNo, MessageBoxIcon.Error);

                    statusCSL.SetError("Could not add an already existing locale");

                    return;
                }

                // create the xaml resources file and reload the available locales
                Resourcer.CreateXamlRes(path, false);
                Ensurer.EnsureAppXamlCs();

                loadLocales();

                statusCSL.SetStatus($"New locale {localeCode} has been added successfully");
            }
        }