// Called when radio button is selected
        public async void OnSelected(object sender, SelectedEventArgs args)
        {
            Console.WriteLine($"Radio.OnSoundSelected!! value:{args.Value}");
            Radio radio = sender as Radio;

            if (Application.Current.MainPage.Navigation.NavigationStack.Count > 0)
            {
                int index = Application.Current.MainPage.Navigation.NavigationStack.Count - 1;

                LanguageSelectionPage currPage = Application.Current.MainPage.Navigation.NavigationStack[index] as LanguageSelectionPage;
                //Error CS0023  Operator '!' cannot be applied to operand of type 'string'
                if (args.Value != null)
                {
                    Console.WriteLine("  < UNSELECTED >  XXXXXX sender " + sender + " -  " + radio.Value);
                    currPage.ignoreRadioSelection = false;
                    return;
                }
                else
                {
                    if (currPage.ignoreRadioSelection)
                    {
                        Console.WriteLine("\n\nRadio_Selected  >>>>>>>  SKIP!\n\n");
                        currPage.ignoreRadioSelection = false;
                        return;
                    }

                    Console.WriteLine("  < SELECTED >  XXXXXX sender " + sender + " -  " + radio.Value);
                    SttLanguage item = radio.BindingContext as SttLanguage;
                    ((MainPageModel)currPage.BindingContext).CurrentLanguage = item.Lang;

                    ((MainPageModel)currPage.BindingContext).SelectedItemIndex = item;
                    await currPage.Navigation.PopToRootAsync();
                }
            }
        }
Ejemplo n.º 2
0
        public static Page GetInstance(Pages page, Object o = null)
        {
            switch (page)
            {
            case Pages.StandBy:
                return(PageFactory.main ?? (main = new MainPage()));

            case Pages.Recording:
                var sttOn = System.Convert.ToBoolean(o);
                record?.Init(/*sttOn*/);
                return(PageFactory.record ?? (record = new RecordingPage(new RecordingPageModel(sttOn))));

            case Pages.TryCancel:
                //VoiceRecordingPageModel vm = o as VoiceRecordingPageModel;
                return(PageFactory.cancel ?? (cancel = new CancelPage(o as RecordingPageModel)));

            case Pages.Details:
                if (detail != null)
                {
                    //Console.WriteLine("<PageFactory> DetailsPageModel : " + ((DetailsPageModel)detail.BindingContext));
                    ((DetailsPageModel)detail.BindingContext).Init(o as Record);
                }
                //Console.WriteLine("<PageFactory> Return detail : " + detail);
                return(PageFactory.detail ?? (detail = new DetailsPage(new DetailsPageModel(o as Record))));

            case Pages.RecordList:
                return(PageFactory.list ?? (list = new RecordListPage((MainPageModel)o)));

            case Pages.PlayBack:
                if (playback != null)
                {
                    ((PlayBackPageModel)playback.BindingContext).Init(o as Record);
                }

                return(PageFactory.playback ?? (playback = new PlayBackPage(new PlayBackPageModel(o as Record))));

            case Pages.Languages:
                Console.WriteLine("<PageFactory>                ++++++++++++   Languages");
                lang?.Init();
                return(PageFactory.lang ?? (lang = new LanguageSelectionPage((MainPageModel)o)));

            default:
                return(null);
            }
        }