private void ChangeLanguageAlert(object sender, EventArgs e)
        {
            var controller = UIAlertController.Create(_loc.GetLocalizedString(Localized.ChangeLanguage_Label), null,
                                                      UIAlertControllerStyle.ActionSheet);

            foreach (var language in Vm.Languages)
            {
                controller.AddAction(UIAlertAction.Create(_loc.GetLocalizedString(language), UIAlertActionStyle.Default,
                                                          a => Vm.ChangeLanguageCommand.Execute(language)));
            }

            PresentViewController(controller, true, null);
        }
Exemplo n.º 2
0
        private async Task UpdateSubmittingStatusAsync(SubmittingMessage message)
        {
            var bar = StatusBar.GetForCurrentView();

            if (message.Submitting)
            {
                bar.ProgressIndicator.Text = Loc.GetLocalizedString(Localized.Submitting);
                await bar.ProgressIndicator.ShowAsync();
            }
            else
            {
                await bar.ProgressIndicator.HideAsync();
            }
        }
Exemplo n.º 3
0
        protected async Task <LanguageCode> GetLanguageCodeAsync()
        {
            LanguageCode code;
            string       fromCache;

            try
            {
                fromCache = await Cache.GetObject <string>(nameof(LanguageCode));
            }
            catch (Exception)
            {
                fromCache = null;
            }
            if (fromCache != null)
            {
                if (Enum.TryParse(fromCache, true, out code))
                {
                    return(code);
                }
            }
            var fromResources = _localizedStringProvider.GetLocalizedString(Localized.LanguageCode);

            if (Enum.TryParse(fromResources, true, out code))
            {
                return(code);
            }
            return(default(LanguageCode));
        }
        public override string TitleForHeader(UITableView tableView, nint section)
        {
            switch (section)
            {
            case 0:
                return(LocalizedStringProvider.GetLocalizedString(Localized.CompanyInfo));

            case 1:
                return(LocalizedStringProvider.GetLocalizedString(Localized.Participants_Text));

            case 2:
                return(LocalizedStringProvider.GetLocalizedString(Localized.AddParticipant_Content));

            default:
                return(base.TitleForHeader(tableView, section));
            }
        }
Exemplo n.º 5
0
            public override View GetView(int position, View convertView, ViewGroup parent)
            {
                var view = convertView ?? _activity.LayoutInflater.Inflate(Resource.Layout.TextListItem, parent, false);
                var tv   = view.FindViewById <TextView>(Resource.Id.TvText);

                tv.Text = _localizedStringProvider.GetLocalizedString(Languages[position]);
                return(view);
            }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _loc    = ServiceLocator.Current.GetInstance <ILocalizedStringProvider>();
            _button = new UIBarButtonItem {
                Title = _loc.GetLocalizedString(Localized.ChangeLanguage_Label)
            };
            _button.Clicked += ChangeLanguageAlert;

            NavigationItem.SetRightBarButtonItem(_button, false);
        }
Exemplo n.º 7
0
        /// <exception cref="ConnectionException">Could not send feedback because the device is not connected to the web.</exception>
        public async Task SendFeedbackAsync(int sessionId, ScoredFeedback feedback)
        {
            if (!CrossConnectivity.Current.IsConnected)
            {
                throw new ConnectionException();
            }

            try
            {
                await _apiService.SendFeedbackAsync(sessionId, feedback).ConfigureAwait(false);

                _dispatcherHelper.ExecuteOnUiThread(
                    () =>
                    _dialogService.ShowMessageBox(_loc.GetLocalizedString(Localized.FeedbackSent),
                                                  _loc.GetLocalizedString(Localized.Success)));
            }
            catch (Exception e)
            {
                await CatchExceptionAsync(e);
            }
            finally
            {
                Messenger.Default.Send(new SubmittingMessage(false));
            }
        }
 protected void AuthenticatorOnError(object sender       = null,
                                     EventArgs eventArgs = null)
 {
     DialogService.ShowError(Loc.GetLocalizedString(Localized.AuthenticationError), null, null,
                             null);
 }