示例#1
0
        void UpdatePreferredConversationLanguage()
        {
            var showLanguagePicker = UIAlertController.Create(
                StringResources.settings_chooseConvoLanguage,
                "\n\n\n\n\n\n",
                UIAlertControllerStyle.Alert);

            var pickerModel = new LanguagePickerViewModel(SupportedLanguages, (lang) => {
                if (lang == null || lang.Id == 0)
                {
                    return;
                }
                CurrentSelectedPrefLanguageID = lang.Id;
            });

            var picker = new UIPickerView {
                Model = pickerModel, Frame = new CoreGraphics.CGRect(0, 20, 250, 140)
            };

            pickerModel.SelectById(picker, Session.ActiveUser.Lang);

            showLanguagePicker.View.AddSubview(picker);

            showLanguagePicker.AddAction(UIAlertAction.Create(StringResources.common_comms_cancel, UIAlertActionStyle.Cancel, (_) => { }));
            showLanguagePicker.AddAction(UIAlertAction.Create(StringResources.common_comms_ok, UIAlertActionStyle.Default, SaveLanguageSelectedFromPicker));

            PresentViewController(showLanguagePicker, true, null);
        }
示例#2
0
        private async void LoadLanguages()
        {
            List <LanguageChoice> languages = await LanguageChoiceManager.GetLanguageChoices();

            if (languages != null && languages.Count > 0)
            {
                pickerModel          = new LanguagePickerViewModel(languages, PickerSelected);
                LanguagePicker.Model = pickerModel;
                pickerModel.SelectById(LanguagePicker, Session.ActiveUser.Lang);
            }
        }