Пример #1
0
        public App()
        {
            if (ApplicationData.Current.LocalSettings.Values["strCurrentLanguage"] != null)
            {
                strCurrentLanguage = ApplicationData.Current.LocalSettings.Values["strCurrentLanguage"].ToString();
                if (strCurrentLanguage == "auto")
                {
                    ApplicationLanguages.PrimaryLanguageOverride = LanguageHelper.GetCurLanguage();
                }
                else
                {
                    ApplicationLanguages.PrimaryLanguageOverride = strCurrentLanguage;
                }
            }
            else
            {
                ApplicationLanguages.PrimaryLanguageOverride = strCurrentLanguage = LanguageHelper.GetCurLanguage();
                //ApplicationLanguages.PrimaryLanguageOverride = strCurrentLanguage = "en-us";
            }

            InitializeComponent();

            // Deferred execution until used. Check https://msdn.microsoft.com/library/dd642331(v=vs.110).aspx for further info on Lazy<T> class.
            _activationService = new Lazy <ActivationService>(CreateActivationService);
        }
        public SettingsPage()
        {
            InitializeComponent();

            comboBoxLanguage.Items.Add("auto Auto");
            comboBoxLanguage.Items.Add("en-us English");
            comboBoxLanguage.Items.Add("zh-cn 简体中文");

            string strCurrentLanguage = (Application.Current as App).strCurrentLanguage;
            string strTempAutoLang    = strCurrentLanguage;

            if (strCurrentLanguage.ToLower().Equals("auto"))
            {
                strCurrentLanguage = LanguageHelper.GetCurLanguage();
            }

            comboBoxLanguage.SelectedIndex = 0;
            if (!strTempAutoLang.Equals("auto"))
            {
                for (int i = 0; i < comboBoxLanguage.Items.Count; i++)
                {
                    string   temp    = comboBoxLanguage.Items[i].ToString();
                    string[] tempArr = temp.Split(' ');
                    if (strCurrentLanguage == tempArr[0])
                    {
                        comboBoxLanguage.SelectedIndex = i;
                    }
                }
            }
        }
Пример #3
0
        public SettingsPage()
        {
            InitializeComponent();
            NavigationCacheMode = NavigationCacheMode.Enabled;

            toogleNeedCropImage.IsOn = (Application.Current as App).bNeedCropImage;

            comboBoxLanguage.Items.Add("auto Auto");
            comboBoxLanguage.Items.Add("en-us English");
            comboBoxLanguage.Items.Add("zh-cn 简体中文");

            comboBoxSegTagEngine.Items.Add("Boson AI");
            comboBoxSegTagEngine.Items.Add("Tencent AI");

            string strCurrentLanguage = (Application.Current as App).strCurrentLanguage;
            string strTempAutoLang    = strCurrentLanguage;

            if (strCurrentLanguage.ToLower().Equals("auto"))
            {
                strCurrentLanguage = LanguageHelper.GetCurLanguage();
            }

            comboBoxLanguage.SelectedIndex = 0;
            if (!strTempAutoLang.Equals("auto"))
            {
                for (int i = 0; i < comboBoxLanguage.Items.Count; i++)
                {
                    string   temp    = comboBoxLanguage.Items[i].ToString();
                    string[] tempArr = temp.Split(' ');
                    if (strCurrentLanguage == tempArr[0])
                    {
                        comboBoxLanguage.SelectedIndex = i;
                    }
                }
            }

            if ((Application.Current as App).strSegTagEngine == "")
            {
                comboBoxSegTagEngine.SelectedIndex = 0;
            }
            else
            {
                for (int i = 0; i < comboBoxSegTagEngine.Items.Count; i++)
                {
                    string temp = comboBoxSegTagEngine.Items[i].ToString();
                    if ((Application.Current as App).strSegTagEngine == temp)
                    {
                        comboBoxSegTagEngine.SelectedIndex = i;
                    }
                }
            }
        }
Пример #4
0
        public App()
        {
            if (ApplicationData.Current.LocalSettings.Values["strCurrentLanguage"] != null)
            {
                strCurrentLanguage = ApplicationData.Current.LocalSettings.Values["strCurrentLanguage"].ToString();
                if (strCurrentLanguage == "auto")
                {
                    ApplicationLanguages.PrimaryLanguageOverride = LanguageHelper.GetCurLanguage();
                }
                else
                {
                    ApplicationLanguages.PrimaryLanguageOverride = strCurrentLanguage;
                }
            }
            else
            {
                ApplicationLanguages.PrimaryLanguageOverride = strCurrentLanguage = LanguageHelper.GetCurLanguage();
                //ApplicationLanguages.PrimaryLanguageOverride = strCurrentLanguage = "en-us";
            }

            InitializeComponent();

            gPopup = new Popup();

            if (appLocalSettings.Values["SegTagEngine"] != null)
            {
                strSegTagEngine = appLocalSettings.Values["SegTagEngine"].ToString();
            }
            else
            {
                strSegTagEngine = "Boson AI";
            }
            if (appLocalSettings.Values["NeedCropImage"] != null)
            {
                bNeedCropImage = Convert.ToBoolean(appLocalSettings.Values["NeedCropImage"].ToString());
            }
            else
            {
                bNeedCropImage = false;
            }

            LoadJson();

            // Deferred execution until used. Check https://msdn.microsoft.com/library/dd642331(v=vs.110).aspx for further info on Lazy<T> class.
            _activationService = new Lazy <ActivationService>(CreateActivationService);
        }