Inheritance: ILanguage
 private void LanguageOverrideComboBox_AddLanguage(Windows.Globalization.Language lang)
 {
     comboBoxValues.Add(new ComboBoxValue()
     {
         DisplayName = lang.DisplayName, LanguageTag = lang.LanguageTag
     });
 }
 private string ReportLanguageData(Language lang)
 {
     return "Display Name: " + lang.DisplayName + "\n" +
         "Language Tag: " + lang.LanguageTag + "\n" +
         "Native Name: " + lang.NativeName + "\n" +
         "Script Code: " + lang.Script + "\n\n";
 }
Beispiel #3
0
        /// <summary>
        ///   Gets the language the application is currently using.
        /// </summary>
        /// <returns>Name and BCP-47 language tag of the language the application is currently using.</returns>
        public static Language GetCurrentLanguage()
        {
#if WINDOWS_STORE
            // Get list of user's language preferences, in order of language preference, filtered by the list of supported languages in the app's manifest.
            // http://msdn.microsoft.com/en-us/library/windows/apps/hh967761.aspx#create_the_application_language_list.
            string preferredLanguage = ApplicationLanguages.Languages[0];
            Windows.Globalization.Language currentLanguage = new Windows.Globalization.Language(preferredLanguage);

            Language language = new Language
                {
                    DisplayName = currentLanguage.DisplayName,
                    Name = currentLanguage.LanguageTag,
                    NativeName = currentLanguage.NativeName
                };
#else
            // Get the locale the application is currently using.
            // http://stackoverflow.com/questions/5710127/get-operating-system-language-in-c-sharp
            CultureInfo currentCulture = CultureInfo.CurrentCulture;

            Language language = new Language
                {
                    DisplayName = currentCulture.DisplayName,
                    Name = currentCulture.Name,
                    NativeName = currentCulture.NativeName
                };
#endif
            return language;
        }
Beispiel #4
0
        /// <summary>
        ///   Gets the language the application is currently using.
        /// </summary>
        /// <returns>Name and BCP-47 language tag of the language the application is currently using.</returns>
        public static Language GetCurrentLanguage()
        {
#if WINDOWS_STORE
            // Get list of user's language preferences, in order of language preference, filtered by the list of supported languages in the app's manifest.
            // http://msdn.microsoft.com/en-us/library/windows/apps/hh967761.aspx#create_the_application_language_list.
            string preferredLanguage = ApplicationLanguages.Languages[0];
            Windows.Globalization.Language currentLanguage = new Windows.Globalization.Language(preferredLanguage);

            Language language = new Language
            {
                DisplayName = currentLanguage.DisplayName,
                Name        = currentLanguage.LanguageTag,
                NativeName  = currentLanguage.NativeName
            };
#else
            // Get the locale the application is currently using.
            // http://stackoverflow.com/questions/5710127/get-operating-system-language-in-c-sharp
            CultureInfo currentCulture = CultureInfo.CurrentCulture;

            Language language = new Language
            {
                DisplayName = currentCulture.DisplayName,
                Name        = currentCulture.Name,
                NativeName  = currentCulture.NativeName
            };
#endif
            return(language);
        }
Beispiel #5
0
        public async Task Init()
        {
            //TEST
            {
                bool isMicAvailable = true;
                try
                {
                    //var audioDevices = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(Windows.Devices.Enumeration.DeviceClass.AudioCapture);
                    //var audioId = audioDevices.ElementAt(0);

                    var mediaCapture = new Windows.Media.Capture.MediaCapture();
                    var settings     = new Windows.Media.Capture.MediaCaptureInitializationSettings();
                    settings.StreamingCaptureMode =
                        Windows.Media.Capture.StreamingCaptureMode.Audio;
                    settings.MediaCategory = Windows.Media.Capture.MediaCategory.Communications;

                    //var _capture = new Windows.Media.Capture.MediaCapture();
                    //var _stream = new InMemoryRandomAccessStream();
                    //await _capture.InitializeAsync(settings);
                    //await _capture.StartRecordToStreamAsync(MediaEncodingProfile.CreateWav(AudioEncodingQuality.Medium), _stream);


                    await mediaCapture.InitializeAsync(settings);
                }
                catch (Exception)
                {
                    isMicAvailable = false;
                }
                if (!isMicAvailable)
                {
                    await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:privacy-microphone"));
                }
                else
                {
                }
            }
            // セットアップ
            {
                var language = new Windows.Globalization.Language("en-US");
                recognizer_ = new SpeechRecognizer(language);

                //this.dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;

                recognizer_.ContinuousRecognitionSession.ResultGenerated +=
                    ContinuousRecognitionSession_ResultGenerated;

                recognizer_.ContinuousRecognitionSession.Completed +=
                    ContinuousRecognitionSession_Completed;

                recognizer_.HypothesisGenerated +=
                    SpeechRecognizer_HypothesisGenerated;

                SpeechRecognitionCompilationResult result = await recognizer_.CompileConstraintsAsync();

                System.Diagnostics.Debug.WriteLine(" compile res:" + result.Status.ToString());
            }
        }
        private void ShowResults()
        {
            // This scenario uses the Windows.System.UserProfile.GlobalizationPreferences class to
            // obtain the user's preferred language characteristics.
            var topUserLanguage = Windows.System.UserProfile.GlobalizationPreferences.Languages[0];
            var userLanguage = new Language(topUserLanguage);

            // This obtains the language characteristics by providing a BCP47 tag.
            var exampleLanguage = new Language("ja");

            // Display the results
            OutputTextBlock.Text = "User's Preferred Language\n" + ReportLanguageData(userLanguage) +
                "Example Language by BCP47 tag (ja)\n" + ReportLanguageData(exampleLanguage);
        }
        private void InitializeLanguages()
        {
            var languages = new List <ApplicationLanguage>();

            foreach (var langTag in ApplicationLanguages.ManifestLanguages)
            {
                var lang = new Windows.Globalization.Language(langTag);
                var name = (lang.NativeName == lang.DisplayName) ? lang.DisplayName : lang.DisplayName + " - " + lang.NativeName;

                languages.Add(new ApplicationLanguage {
                    Tag = langTag, DisplayName = name
                });
            }

            ManifestLanguages = new ObservableCollection <ApplicationLanguage>(languages);
            SelectedLanguage  = ManifestLanguages.FirstOrDefault(x => x.Tag == ApplicationLanguages.PrimaryLanguageOverride);
        }
Beispiel #8
0
        private async void InitRecognizer()
        {
            Language recognizerLanguage = new Windows.Globalization.Language("fr-FR");

            if (speechRecognizer != null)
            {
                // cleanup prior to re-initializing this scenario.
                speechRecognizer.StateChanged -= SpeechRecognizer_StateChanged;
                speechRecognizer.ContinuousRecognitionSession.Completed       -= ContinuousRecognitionSession_Completed;
                speechRecognizer.ContinuousRecognitionSession.ResultGenerated -= ContinuousRecognitionSession_ResultGenerated;
                speechRecognizer.HypothesisGenerated -= SpeechRecognizer_HypothesisGenerated;

                this.speechRecognizer.Dispose();
                this.speechRecognizer = null;
            }

            this.speechRecognizer = new SpeechRecognizer(recognizerLanguage);

            // Provide feedback to the user about the state of the recognizer. This can be used to provide visual feedback in the form
            // of an audio indicator to help the user understand whether they're being heard.
            speechRecognizer.StateChanged += SpeechRecognizer_StateChanged;

            // Apply the dictation topic constraint to optimize for dictated freeform speech.
            var dictationConstraint = new SpeechRecognitionTopicConstraint(SpeechRecognitionScenario.Dictation, "dictation");

            speechRecognizer.Constraints.Add(dictationConstraint);
            SpeechRecognitionCompilationResult result = await speechRecognizer.CompileConstraintsAsync();

            if (result.Status != SpeechRecognitionResultStatus.Success)
            {
                //rootPage.NotifyUser("Grammar Compilation Failed: " + result.Status.ToString(), NotifyType.ErrorMessage);
                //btnContinuousRecognize.IsEnabled = false;
            }

            // Handle continuous recognition events. Completed fires when various error states occur. ResultGenerated fires when
            // some recognized phrases occur, or the garbage rule is hit. HypothesisGenerated fires during recognition, and
            // allows us to provide incremental feedback based on what the user's currently saying.
            speechRecognizer.ContinuousRecognitionSession.Completed       += ContinuousRecognitionSession_Completed;
            speechRecognizer.ContinuousRecognitionSession.ResultGenerated += ContinuousRecognitionSession_ResultGenerated;
            speechRecognizer.HypothesisGenerated += SpeechRecognizer_HypothesisGenerated;
        }
Beispiel #9
0
        void Language_Loaded(object sender, RoutedEventArgs e)
        {
            // 获取当前的语言
            string currentLanguage;

            ResourceContext.GetForCurrentView().QualifierValues.TryGetValue("Language", out currentLanguage);
            lblMsg.Text  = "current language: " + currentLanguage;
            lblMsg.Text += Environment.NewLine;


            // ApplicationLanguages.ManifestLanguages - 遍历 Package.appxmanifest 中的语言列表
            foreach (string strLang in ApplicationLanguages.ManifestLanguages)
            {
                // 关于 Language 的说明详见 GlobalizationDemo.xaml
                var lang = new Windows.Globalization.Language(strLang);
                cmbLanguage.Items.Add(string.Format("DisplayName:{0}, NativeName:{1}, LanguageTag:{2}, Script:{3}",
                                                    lang.DisplayName, lang.NativeName, lang.LanguageTag, lang.Script));
            }
            cmbLanguage.SelectionChanged += cmbLanguage_SelectionChanged;


            // 获取当前语言环境的指定资源(更多用法请参见 LocalizationDemo.xaml)
            lblMsg.Text += ResourceLoader.GetForViewIndependentUse().GetString("Hello");


            // 当前语言环境发生改变时所触发的事件(通过 API 更改或者通过“电脑设置 -> 常规 -> 语言首选项”更改都会触发此事件)
            // 注:当通过 API(ApplicationLanguages.PrimaryLanguageOverride)修改语言环境时,如果监听了 MapChanged 事件的话,则有很大的几率会导致崩溃,本例就是这样,原因未知
            ResourceContext.GetForCurrentView().QualifierValues.MapChanged += async(s, m) =>
            {
                await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                {
                    lblMsg.Text += Environment.NewLine;
                    lblMsg.Text += ResourceLoader.GetForViewIndependentUse().GetString("Hello");
                });
            };
        }
Beispiel #10
0
    /// <summary>
    /// WindowsのOCRエンジンによる文字認識及び, 後処理を実行
    /// </summary>
    /// <param name="softwareBitmap">ビットマップ</param>
    /// <param name="languageCode">言語コード</param>
    /// <returns>テキスト</returns>
    public async Task <string> UwpOcrEngineWithPostProcessing(SoftwareBitmap softwareBitmap, UwpLanguage languageCode)
    {
        string resultText = string.Empty;


        if (this.currentLanguageCode != languageCode)
        {
            this.ocrEngine = UwpOcrEngine.TryCreateFromLanguage(languageCode);
        }


        UwpOcrResult ocrResult = await ocrEngine.RecognizeAsync(softwareBitmap);

        foreach (var ocrLine in ocrResult.Lines)
        {
            resultText += (ocrLine.Text + " ");
        }

        return(resultText.Replace("- ", ""));
    }
Beispiel #11
0
        private async void LoadSettings()
        {
            //TODO: Settings
            HighlightEveryone.IsChecked = Storage.Settings.HighlightEveryone;
            //Toasts.IsChecked = Storage.Settings.Toasts;
            LiveTile.IsChecked                    = Storage.Settings.LiveTile;
            Badge.IsChecked                       = Storage.Settings.Badge;
            Vibrate.IsChecked                     = Storage.Settings.Vibrate;
            FontSizeSlider.Value                  = Storage.Settings.MSGFontSize;
            CompactMode.IsChecked                 = Storage.Settings.CompactMode;
            FriendsNotifyDMs.IsChecked            = Storage.Settings.FriendsNotifyDMs;
            FriendsNotifyFriendRequests.IsChecked = Storage.Settings.FriendsNotifyFriendRequest;
            //Storage.Settings.FriendsNotifyIncoming = (bool)FriendsNotifyIncomingFriendRequests.IsChecked;
            //Storage.Settings.FriendsNotifyOutgoing = (bool)FriendsNotifyOutgoingFriendRequests.IsChecked;
            RespUI_M.Value  = Storage.Settings.RespUiM;
            RespUI_L.Value  = Storage.Settings.RespUiL;
            RespUI_XL.Value = Storage.Settings.RespUiXl;
            //AppBarAtBottom_checkbox.IsChecked = Storage.Settings.AppBarAtBottom;
            ShowWelcome.IsChecked = Storage.Settings.ShowWelcomeMessage;
            ShowNoPermissionsChannels.IsChecked = Storage.Settings.ShowNoPermissionChannels;
            HideMutedChannels.IsChecked         = Storage.Settings.HideMutedChannels;
            EnableAcrylic.IsChecked             = Storage.Settings.Acrylics;
            EnableBackgroundVoice.IsChecked     = Storage.Settings.BackgroundVoice;
            ExpensiveUI.IsChecked = Storage.Settings.ExpensiveRender;
            //DropShadowPresence.IsChecked = Storage.Settings.DropShadowPresence;
            UseCompression.IsChecked = Storage.Settings.UseCompression;
            RichPresence.IsChecked   = Storage.Settings.RichPresence;
            if (App.IsXbox)
            {
                Scaling.Visibility = Visibility.Visible;
                Scaling.IsChecked  = Storage.Settings.Scaling;
            }
            //VoiceChannels.IsChecked = Storage.Settings.VoiceChannels;
            //GifsOnHover.IsChecked = Storage.Settings.GifsOnHover;

            //NotificationSounds.IsChecked = Storage.Settings.SoundNotifications;
            //if (Storage.Settings.DiscordSounds)
            //{
            //    radio_DiscordSounds.IsChecked = true;
            //}
            //else
            //{
            //    radio_WindowsSounds.IsChecked = true;
            //}

            MentionGlow.IsChecked    = Storage.Settings.GlowOnMention;
            ShowServerMute.IsChecked = Storage.Settings.ServerMuteIcons;

            MessageNotification.IsChecked   = Storage.Settings.MessageSound;
            VoiceDCNotification.IsChecked   = Storage.Settings.VoiceDCSound;
            UserJoinNotification.IsChecked  = Storage.Settings.UserJoinSound;
            UserLeaveNotification.IsChecked = Storage.Settings.UserLeaveSound;

            if (Storage.Settings.BackgroundTaskTime == 0)
            {
                bgEnabler.IsOn       = false;
                timeSlider.IsEnabled = false;
                timeSlider.Value     = 9;
            }
            else
            {
                bgEnabler.IsOn       = true;
                timeSlider.IsEnabled = true;
                timeSlider.Value     = Storage.Settings.BackgroundTaskTime;
            }
            bgEnabler_Toggled(null, null);

            bgNotifyFriend.IsChecked       = GetSetting("bgNotifyFriend");
            bgNotifyDM.IsChecked           = GetSetting("bgNotifyDM");
            bgNotifyMention.IsChecked      = bgNotifyMutedMention.IsEnabled = GetSetting("bgNotifyMention");
            bgNotifyMutedMention.IsChecked = GetSetting("bgNotifyMutedMention");

            if (Windows.Storage.ApplicationData.Current.LocalSettings.Values.ContainsKey("bgTaskLastrunStatus"))
            {
                string lastrunstatus = (string)Windows.Storage.ApplicationData.Current.LocalSettings.Values["bgTaskLastrunStatus"];
                if (string.IsNullOrWhiteSpace(lastrunstatus))
                {
                    bgLastRuntimeStatus.Visibility = Visibility.Collapsed;
                }
                else
                {
                    bgLastRuntimeStatus.Visibility = Visibility.Visible;
                    bgLastRuntimeStatus.Text       = lastrunstatus;
                }
            }
            else
            {
                bgLastRuntimeStatus.Visibility = Visibility.Collapsed;
            }

            if (!Windows.Storage.ApplicationData.Current.LocalSettings.Values.ContainsKey("bgTaskLastrun"))
            {
                if (bgLastRuntimeStatus.Visibility == Visibility.Collapsed)
                {
                    bgLastRuntime.Text = App.GetString("/Settings/BGTaskNoRun");
                }
                else
                {
                    bgLastRuntime.Text = App.GetString("/Settings/BGTaskNoSuccessfulRun");
                }
            }
            else
            {
                var lastrun = Windows.Storage.ApplicationData.Current.LocalSettings.Values["bgTaskLastrun"];
                var status  = GetSettingString("bgTaskLastrunStatus");

                if (lastrun.GetType() == typeof(long))
                {
                    var time = DateTimeOffset.FromUnixTimeSeconds((long)lastrun).ToLocalTime();
                    bgLastRuntime.Text = "The background task last ran succesfully ";
                    if (time.Date == DateTime.Now.Date)
                    {
                        bgLastRuntime.Text += "today at ";
                    }
                    else if (time.Date == DateTime.Now.Date.AddDays(-1))
                    {
                        bgLastRuntime.Text += "yesterday at ";
                    }
                    else
                    {
                        bgLastRuntime.Text += "on " + time.ToString("MM/dd/yyyy") + " at ";
                    }
                    bgLastRuntime.Text += time.ToString("HH:mm");
                }
            }

            if (Storage.Settings.AccentBrush)
            {
                radioAccent_Windows.IsChecked = true;
            }
            else
            {
                radioAccent_Discord.IsChecked = true;
            }

            DerviedColor.IsChecked = Storage.Settings.DerivedColor;


            switch (Storage.Settings.TimeFormat)
            {
            case "hh:mm":
                TimeFormat.SelectedIndex = 0;
                break;

            case "H:mm":
                TimeFormat.SelectedIndex = 1;
                break;

            case "hh:mm:ss tt":
                TimeFormat.SelectedIndex = 2;
                break;

            case "HH:mm:ss":
                TimeFormat.SelectedIndex = 3;
                break;

            default:
                TimeFormat.SelectedIndex = 4;
                CustomTimeF.Text         = Storage.Settings.TimeFormat;
                break;
            }

            if (TimeFormat.SelectedIndex == 4)
            {
                CustomTimeF.Visibility = Visibility.Visible;
            }
            else
            {
                CustomTimeF.Visibility = Visibility.Collapsed;
            }

            switch (Storage.Settings.DateFormat)
            {
            case "M/d/yyyy":
                DateFormat.SelectedIndex = 0;
                break;

            case "M/d/yy":
                DateFormat.SelectedIndex = 1;
                break;

            case "MM/dd/yy":
                DateFormat.SelectedIndex = 2;
                break;

            case "MMM/dd/yy":
                DateFormat.SelectedIndex = 3;
                break;

            default:
                DateFormat.SelectedIndex = 4;
                CustomDateF.Text         = Storage.Settings.DateFormat;
                break;
            }

            if (DateFormat.SelectedIndex == 4)
            {
                CustomDateF.Visibility = Visibility.Visible;
            }
            else
            {
                CustomDateF.Visibility = Visibility.Collapsed;
            }

            if (!(OLED.IsChecked = Storage.Settings.OLED).Value)
            {
                if (Storage.Settings.Theme == Theme.Dark)
                {
                    radio_Dark.IsChecked = true;
                }
                else if (Storage.Settings.Theme == Theme.Light)
                {
                    radio_Light.IsChecked = true;
                }
                else if (Storage.Settings.Theme == Theme.Windows)
                {
                    radio_Windows.IsChecked = true;
                }
                else if (Storage.Settings.Theme == Theme.Discord)
                {
                    radio_Discord.IsChecked = true;
                }
            }

            //if (!Storage.Settings.OLED)
            //{
            //    if (Storage.Settings.Theme == Theme.Dark)
            //        radio_Dark.IsChecked = true;
            //    else if (Storage.Settings.Theme == Theme.Light)
            //        radio_Light.IsChecked = true;
            //    else if (Storage.Settings.Theme == Theme.Windows)
            //        radio_Windows.IsChecked = true;
            //    else if (Storage.Settings.Theme == Theme.Discord)
            //        radio_Discord.IsChecked = true;
            //}

            //OLED.IsChecked = Storage.Settings.OLED;


            if (Storage.Settings.collapseOverride == CollapseOverride.None)
            {
                NoOverride.IsChecked = true;
            }
            else if (Storage.Settings.collapseOverride == CollapseOverride.Mention)
            {
                OverrideMention.IsChecked = true;
            }
            else if (Storage.Settings.collapseOverride == CollapseOverride.Unread)
            {
                OverrideUnread.IsChecked = true;
            }

            NoiseSensitivity.Value = Storage.Settings.NoiseSensitivity;

            //MainPanelBlur.Value = Storage.Settings.MainOpacity;
            //SecondaryPanelBlur.Value = Storage.Settings.SecondaryOpacity;
            //TertiaryPanelBlur.Value = Storage.Settings.TertiaryOpacity;
            //CommandBarBlur.Value = Storage.Settings.CmdOpacity;

            //CustomBGToggle.IsOn = Storage.Settings.CustomBG;
            //FilePath.Text = Storage.Settings.BGFilePath;


            //Output Devices
            OutputDevices.Items.Clear();
            var odevices = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(Windows.Devices.Enumeration.DeviceClass.AudioRender);

            OutputDevices.Items.Add(new ComboBoxItem()
            {
                Content = "Default", Tag = "Default"
            });
            OutputDevices.SelectedIndex = 0;
            int i = 1;

            foreach (var device in odevices)
            {
                OutputDevices.Items.Add(new ComboBoxItem()
                {
                    Content = device.Name, Tag = device.Id, IsEnabled = device.IsEnabled
                });
                if (device.Id == Storage.Settings.OutputDevice)
                {
                    OutputDevices.SelectedIndex = i;
                }
                i++;
            }

            //Input Devices
            InputDevices.Items.Clear();
            var idevices = await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(Windows.Devices.Enumeration.DeviceClass.AudioCapture);

            InputDevices.Items.Add(new ComboBoxItem()
            {
                Content = "Default", Tag = "Default"
            });
            InputDevices.SelectedIndex = 0;
            i = 1;
            foreach (var device in idevices)
            {
                InputDevices.Items.Add(new ComboBoxItem()
                {
                    Content = device.Name, Tag = device.Id, IsEnabled = device.IsEnabled
                });
                if (device.Id == Storage.Settings.OutputDevice)
                {
                    InputDevices.SelectedIndex = i;
                }
                i++;
            }


            foreach (var language in ApplicationLanguages.ManifestLanguages)
            {
                var          lang = new Windows.Globalization.Language(language);
                ComboBoxItem item = new ComboBoxItem();
                item.Content = UppercaseFirst(lang.NativeName);
                if (lang.NativeName != lang.DisplayName)
                {
                    item.Content += " (" + lang.DisplayName + ")";
                }
                item.Tag = language;
                LanguageSelection.Items.Add(item);
            }

            if (string.IsNullOrWhiteSpace(ApplicationLanguages.PrimaryLanguageOverride))
            {
                LanguageSelection.SelectedIndex = 0;
            }
            else
            {
                foreach (var item in LanguageSelection.Items)
                {
                    if (((ComboBoxItem)item).Tag.ToString() == ApplicationLanguages.PrimaryLanguageOverride)
                    {
                        LanguageSelection.SelectedItem = item;
                        break;
                    }
                }
            }

            if (LanguageSelection.SelectedIndex == -1)
            {
                LanguageSelection.SelectedIndex = 0;
            }

            standardNetwork = new NetworkSettings(Storage.Settings.StandardData);
            mobileNetwork   = new NetworkSettings(Storage.Settings.MobileData);

            TTLAttachments.IsChecked   = standardNetwork.TTL;
            HideSIcons.IsChecked       = standardNetwork.SmallIcons;
            TTLAttachmentsMD.IsChecked = mobileNetwork.TTL;
            HideSIconsMD.IsChecked     = mobileNetwork.SmallIcons;
        }
Beispiel #12
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // 首选语言
            lblMsg.Text  = "Current Languages: " + string.Join(", ", GlobalizationPreferences.Languages);
            lblMsg.Text += Environment.NewLine;
            // 首选日历(比如:GregorianCalendar 提供了世界上大多数国家/地区使用的标准日历系统)
            lblMsg.Text += "Current Calendars: " + string.Join(", ", GlobalizationPreferences.Calendars);
            lblMsg.Text += Environment.NewLine;
            // 时钟显示(比如:24HourClock)
            lblMsg.Text += "Current Clocks: " + string.Join(", ", GlobalizationPreferences.Clocks);
            lblMsg.Text += Environment.NewLine;
            // 区域(比如:CN)
            lblMsg.Text += "Current HomeGeographicRegion: " + GlobalizationPreferences.HomeGeographicRegion;
            lblMsg.Text += Environment.NewLine;
            // 一周的第一天是周几(比如:中国是 Monday)
            lblMsg.Text += "Current WeekStartsOn: " + GlobalizationPreferences.WeekStartsOn.ToString();
            lblMsg.Text += Environment.NewLine;
            lblMsg.Text += Environment.NewLine;


            // Language - 语言对象,通过指定 BCP-47 语言标记来实例化语言对象
            Windows.Globalization.Language language = new Windows.Globalization.Language("zh-Hans-CN");
            // 判断指定的 BCP-47 语言标记的格式是否正确
            lblMsg.Text += "zh-Hans-CN IsWellFormed: " + Windows.Globalization.Language.IsWellFormed("zh-Hans-CN");
            lblMsg.Text += Environment.NewLine;
            // 语言的本地化名称
            lblMsg.Text += "zh-Hans-CN Language DisplayName: " + language.DisplayName;
            lblMsg.Text += Environment.NewLine;
            // 语言本身的名称
            lblMsg.Text += "zh-Hans-CN Language NativeName: " + language.NativeName;
            lblMsg.Text += Environment.NewLine;
            // 语言的 BCP-47 语言标记
            lblMsg.Text += "zh-Hans-CN Language LanguageTag: " + language.LanguageTag;
            lblMsg.Text += Environment.NewLine;
            // 语言的 ISO 15924 脚本代码
            lblMsg.Text += "zh-Hans-CN Language Script: " + language.Script;
            lblMsg.Text += Environment.NewLine;
            // 获取当前输入法编辑器 (IME) 的 BCP-47 语言标记
            lblMsg.Text += "zh-Hans-CN Language CurrentInputMethodLanguageTag: " + Windows.Globalization.Language.CurrentInputMethodLanguageTag;
            lblMsg.Text += Environment.NewLine;
            lblMsg.Text += Environment.NewLine;


            // GeographicRegion - 区域对象(关于 ISO 3166-1 请参见:http://zh.wikipedia.org/zh-cn/ISO_3166-1)
            GeographicRegion geographicRegion = new GeographicRegion(); // 获取当前的区域对象。

            // 区域的本地化名称
            lblMsg.Text += "Current Region DisplayName: " + geographicRegion.DisplayName;
            lblMsg.Text += Environment.NewLine;
            // 区域本身的名称
            lblMsg.Text += "Current Region NativeName: " + geographicRegion.NativeName;
            lblMsg.Text += Environment.NewLine;
            // 该区域内使用的货币类型
            lblMsg.Text += "Current Region CurrenciesInUse: " + string.Join(",", geographicRegion.CurrenciesInUse);
            lblMsg.Text += Environment.NewLine;
            // 该区域的 ISO 3166-1 二位字母标识
            lblMsg.Text += "Current Region CodeTwoLetter: " + geographicRegion.CodeTwoLetter;
            lblMsg.Text += Environment.NewLine;
            // 该区域的 ISO 3166-1 三位字母标识
            lblMsg.Text += "Current Region CodeThreeLetter: " + geographicRegion.CodeThreeLetter;
            // 该区域的 ISO 3166-1 数字标识
            lblMsg.Text += Environment.NewLine;
            lblMsg.Text += "Current Region CodeThreeDigit: " + geographicRegion.CodeThreeDigit;
            lblMsg.Text += Environment.NewLine;
            lblMsg.Text += Environment.NewLine;


            // Calendar - 日历对象,默认返回当前系统的默认日历
            Calendar calendarDefault = new Calendar();
            // 第一个参数:将日历转换为字符串时,优先使用的语言标识列表;第二个参数:指定日历的类型;第三个参数:指定是12小时制还是24小时制
            Calendar calendarHebrew = new Calendar(new[] { "zh-CN" }, CalendarIdentifiers.Hebrew, ClockIdentifiers.TwentyFourHour);

            lblMsg.Text += "Gregorian Day: " + calendarDefault.DayAsString(); // 公历的日期
            lblMsg.Text += Environment.NewLine;
            lblMsg.Text += "Hebrew Day: " + calendarHebrew.DayAsString();     // 希伯来历的日期
            // Calendar 还有很多属性和方法,不再一一介绍,需要时查 msdn
        }