Esempio n. 1
0
        public void SetTaskbarIcon()
        {
            if (ResourcesUtils.EmbeddedResourceExists(null, ".ico"))
            {
                Icon = new System.Drawing.Icon(ResourcesUtils.GetEmbeddedResourceStream(null, ".ico"));
            }
            else
            {
#if DEBUG
                Logger.GetLogger().Warning("Set at least one icon as embedded resource so that it will be found by " + GetType().Name);
#endif
            }
        }
Esempio n. 2
0
        private void SetLocaleCode()
        {
            LocaleCode = GetConfigValue(ConfigConsts.DEFAULT_LOCALE, "en");
            string tmpLocale = LocaleCode;

            switch (GetConfigValue(ConfigConsts.LOCALE).ToLower())
            {
            case "oslang":
                CultureInfo ci = CultureInfo.CurrentUICulture;
                string      localeCodeCandidate = ci.TwoLetterISOLanguageName;
#if DEBUG
                Logger.GetLogger().Info("Detected OS display language code: " + localeCodeCandidate);
#endif
                if (ResourcesUtils.EmbeddedResourceExists(null, localeCodeCandidate + ".locale"))
                {
                    tmpLocale = localeCodeCandidate;
                }
                break;

            case "userselected":
                tmpLocale = string.IsNullOrEmpty(userSelectedLocale) ? tmpLocale : userSelectedLocale;
                break;
            }

            if (!ResourcesUtils.EmbeddedResourceExists(null, tmpLocale + ".locale"))
            {
#if DEBUG
                Logger.GetLogger().Info($"requested locale ({tmpLocale}) is missing from resources. default locale will be taken: {LocaleCode}");
#endif
                tmpLocale = LocaleCode;
            }
            LocaleCode = tmpLocale;
            Stream localeXmlStream = ResourcesUtils.GetEmbeddedResourceStream(null, LocaleCode + ".locale");
#if DEBUG
            Logger.GetLogger().Info($"Chosen locale: {LocaleCode}");
            if (localeXmlStream == null)
            {
                Logger.GetLogger().Fatal($"Chosen locale: {LocaleCode} is missing from resources");
            }
#endif
            ReadXmlFiles(new Stream[] { localeXmlStream });
        }