Пример #1
0
        private void bUpdateTranslations_Click(object sender, EventArgs e)
        {
            List <string> lPlugins = new List <string>();

            foreach (UpdateInfo ui in Plugin.Plugins)
            {
                if (ui == null)
                {
                    continue;
                }
                if (!lPlugins.Contains(ui.Name))
                {
                    lPlugins.Add(ui.Name);
                }
            }
            using (TranslationUpdateForm t = new TranslationUpdateForm())
            {
                t.InitEx(lPlugins);
                if (t.ShowDialog() == DialogResult.OK)
                {
                    lPlugins = t.SelectedPlugins;
                    Plugin.UpdatePluginTranslations(PluginConfig.DownloadActiveLanguage, lPlugins);
                }
            }
        }
Пример #2
0
        private void CheckPluginLanguages(object o)
        {
            PluginUpdateHandler.LoadPlugins(false);
            if (!PluginConfig.Active)
            {
                return;
            }
            if (m_bPluginLanguagesChecked)
            {
                return;
            }
            m_bPluginLanguagesChecked = true;
            string translations             = string.Empty;
            List <OwnPluginUpdate> lPlugins = new List <OwnPluginUpdate>();

            foreach (PluginUpdate pu in PluginUpdateHandler.Plugins)
            {
                if (!PluginUpdateHandler.VersionsEqual(pu.VersionInstalled, pu.VersionAvailable))
                {
                    continue;
                }
                foreach (var t in pu.Translations)
                {
                    if (t.NewTranslationAvailable || (PluginConfig.DownloadActiveLanguage && t.TranslationForCurrentLanguageAvailable))
                    {
                        lPlugins.Add(pu as OwnPluginUpdate);
                        break;
                    }
                }
            }
            if (lPlugins.Count == 0)
            {
                return;
            }
            var arrPlugins = lPlugins.ConvertAll(x => x.ToString()).ToArray();

            PluginDebug.AddInfo("Available translation updates", 0, arrPlugins);
            KeePassLib.Delegates.GAction DisplayTranslationForm = () =>
            {
                using (TranslationUpdateForm t = new TranslationUpdateForm())
                {
                    t.InitEx(lPlugins);
                    if (t.ShowDialog() == DialogResult.OK)
                    {
                        UpdatePluginTranslations(PluginConfig.DownloadActiveLanguage, t.SelectedPlugins);
                    }
                }
            };
            m_host.MainWindow.BeginInvoke(DisplayTranslationForm);
        }
Пример #3
0
        private void bUpdateTranslations_Click(object sender, EventArgs e)
        {
            List <OwnPluginUpdate> lPlugins = new List <OwnPluginUpdate>();

            foreach (PluginUpdate pu in PluginUpdateHandler.Plugins)
            {
                OwnPluginUpdate opu = pu as OwnPluginUpdate;
                if (opu == null)
                {
                    continue;
                }
                if (!PluginUpdateHandler.VersionsEqual(pu.VersionInstalled, pu.VersionAvailable))
                {
                    continue;
                }
                if (opu.Translations.Count == 0)
                {
                    continue;
                }
                if (!lPlugins.Contains(opu))
                {
                    lPlugins.Add(opu);
                }
            }
            if (lPlugins.Count == 0)
            {
                PluginTools.PluginDebug.AddInfo("No plugins where translations can be updated", 0);
                return;
            }
            using (TranslationUpdateForm t = new TranslationUpdateForm())
            {
                t.InitEx(lPlugins);
                if (t.ShowDialog() == DialogResult.OK)
                {
                    Plugin.UpdatePluginTranslations(PluginConfig.DownloadActiveLanguage, t.SelectedPlugins);
                }
            }
        }