recoInit() публичный статический Метод

public static recoInit ( Android.Content.Context context ) : void
context Android.Content.Context
Результат void
Пример #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            WritePadAPI.recoInit(BaseContext);
            WritePadAPI.initializeFlags(BaseContext);

            var button         = FindViewById <Button>(Resource.Id.RecognizeButton);
            var inkView        = FindViewById <InkView>(Resource.Id.ink_view);
            var readyText      = FindViewById <TextView>(Resource.Id.ready_text);
            var readyTextTitle = FindViewById <TextView>(Resource.Id.ready_text_title);
            var languageBtn    = FindViewById <Button>(Resource.Id.LanguageButton);
            var optionsBtn     = FindViewById <Button>(Resource.Id.OptionsButton);

            readyText.MovementMethod = new ScrollingMovementMethod();
            readyTextTitle.Text      = Resources.GetString(Resource.String.Title) + " (" + WritePadAPI.getLanguageName() + ")";

            button.Click += delegate
            {
                readyText.Text = inkView.Recognize(false);
            };

            optionsBtn.Click += delegate
            {
                // show options dialog
                StartActivity(typeof(WritePadOptions));
            };

            languageBtn.Click += delegate
            {
                var builder = new AlertDialog.Builder(this);
                builder.SetTitle("Select language");
                var languages = new[] { "English", "English (UK)", "German", "French", "Spanish", "Portuguese",
                                        "Portuguese (Brazilian)", "Dutch", "Italian", "Finnish", "Sweddish", "Norwegian",
                                        "Danish", "Indonesian" };
                var selection = 0;
                switch (WritePadAPI.language)
                {
                case WritePadAPI.LanguageType.en:
                    selection = 0;
                    break;

                case WritePadAPI.LanguageType.en_uk:
                    selection = 1;
                    break;

                case WritePadAPI.LanguageType.de:
                    selection = 2;
                    break;

                case WritePadAPI.LanguageType.fr:
                    selection = 3;
                    break;

                case WritePadAPI.LanguageType.es:
                    selection = 4;
                    break;

                case WritePadAPI.LanguageType.pt_PT:
                    selection = 5;
                    break;

                case WritePadAPI.LanguageType.pt_BR:
                    selection = 6;
                    break;

                case WritePadAPI.LanguageType.nl:
                    selection = 7;
                    break;

                case WritePadAPI.LanguageType.it:
                    selection = 8;
                    break;

                case WritePadAPI.LanguageType.fi:
                    selection = 9;
                    break;

                case WritePadAPI.LanguageType.sv:
                    selection = 10;
                    break;

                case WritePadAPI.LanguageType.nb:
                    selection = 11;
                    break;

                case WritePadAPI.LanguageType.da:
                    selection = 12;
                    break;

                case WritePadAPI.LanguageType.id:
                    selection = 13;
                    break;
                }
                builder.SetSingleChoiceItems(languages, selection, (sender, args) =>
                {
                    WritePadAPI.recoFree();
                    switch (args.Which)
                    {
                    case 0:
                        WritePadAPI.language = WritePadAPI.LanguageType.en;
                        break;

                    case 1:
                        WritePadAPI.language = WritePadAPI.LanguageType.en_uk;
                        break;

                    case 2:
                        WritePadAPI.language = WritePadAPI.LanguageType.de;
                        break;

                    case 3:
                        WritePadAPI.language = WritePadAPI.LanguageType.fr;
                        break;

                    case 4:
                        WritePadAPI.language = WritePadAPI.LanguageType.es;
                        break;

                    case 5:
                        WritePadAPI.language = WritePadAPI.LanguageType.pt_PT;
                        break;

                    case 6:
                        WritePadAPI.language = WritePadAPI.LanguageType.pt_BR;
                        break;

                    case 7:
                        WritePadAPI.language = WritePadAPI.LanguageType.nl;
                        break;

                    case 8:
                        WritePadAPI.language = WritePadAPI.LanguageType.it;
                        break;

                    case 9:
                        WritePadAPI.language = WritePadAPI.LanguageType.fi;
                        break;

                    case 10:
                        WritePadAPI.language = WritePadAPI.LanguageType.sv;
                        break;

                    case 11:
                        WritePadAPI.language = WritePadAPI.LanguageType.nb;
                        break;

                    case 12:
                        WritePadAPI.language = WritePadAPI.LanguageType.da;
                        break;

                    case 13:
                        WritePadAPI.language = WritePadAPI.LanguageType.id;
                        break;
                    }
                    WritePadAPI.recoInit(BaseContext);
                    WritePadAPI.initializeFlags(BaseContext);
                    inkView.cleanView(true);
                    readyTextTitle.Text = Resources.GetString(Resource.String.Title) + " (" + WritePadAPI.getLanguageName() + ")";
                });
                var alert = builder.Create();
                alert.Show();
            };
            inkView.OnReturnGesture += () => readyText.Text = inkView.Recognize(true);
            inkView.OnReturnGesture += () => inkView.cleanView(true);
            inkView.OnCutGesture    += () => inkView.cleanView(true);
            var clearbtn = FindViewById <Button>(Resource.Id.ClearButton);

            clearbtn.Click += delegate
            {
                readyText.Text = "";
                inkView.cleanView(true);
            };
        }
Пример #2
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.MadMinute);

            //Get the username
            username = Intent.GetStringExtra("UserName");


            WritePadAPI.recoInit(BaseContext);
            WritePadAPI.initializeFlags(BaseContext);

            button          = FindViewById <Button> (Resource.Id.RecognizeButton);
            inkView         = FindViewById <InkView> (Resource.Id.ink_view);
            readyText       = FindViewById <TextView> (Resource.Id.ready_text);
            topLayerCount   = FindViewById <LinearLayout> (Resource.Id.topLayerCount);
            containerLayer  = FindViewById <FrameLayout> (Resource.Id.containerLayer);
            countdownView   = FindViewById <TextView> (Resource.Id.countdownStart);
            ReadyGoStop     = FindViewById <TextView> (Resource.Id.ReadyGoStop);
            questions_math  = FindViewById <TextView> (Resource.Id.questions_math);
            submitAnswer    = FindViewById <Button> (Resource.Id.submitAnswer);
            finalTotalScore = FindViewById <TextView> (Resource.Id.finalTotalScore);
            replayGame      = FindViewById <Button> (Resource.Id.replayGame);
            countDownView   = FindViewById <TextView> (Resource.Id.time_countdown);
            goBack          = FindViewById <Button> (Resource.Id.goBack);


            countVariable = 3;
            //calculateTime (countVariable);

            topLayerCount.Visibility = Android.Views.ViewStates.Invisible;
            if (endTime)
            {
                return;
            }
            ReadyGoStop.Text = "GO!";
            int minuteTime = 60;

            StartCountdownTimer(minuteTime);
            bool rightAnswer = false;

            ShowQuestions(rightAnswer);

            readyText.MovementMethod = new ScrollingMovementMethod();
            //readyTextTitle.Text = Resources.GetString (Resource.String.Title) + " (" + WritePadAPI.getLanguageName () + ")";

            button.Click += delegate {
                readyText.Text = inkView.Recognize(false);
            };

            goBack.Click += delegate {
                var activity2 = new Intent(this, typeof(Activity2));
                activity2.PutExtra("UserName", username);
                //activity2.PutExtra ("UserEmail", e.mProfile.Email);
                StartActivity(activity2);
            };

            replayGame.Click += delegate {
                replayGame.Enabled = false;
                restartSettings();
            };

            /* WritePad SDK recognizing what the user wrote.*/
            inkView.OnReturnGesture += () => readyText.Text = inkView.Recognize(true);
            inkView.OnReturnGesture += () => inkView.cleanView(true);
            inkView.OnCutGesture    += () => inkView.cleanView(true);
            var clearbtn = FindViewById <Button> (Resource.Id.ClearButton);

            clearbtn.Click += delegate {
                readyText.Text = "";
                inkView.cleanView(true);
            };
        }