Example #1
0
        private void SetTranslation()
        {
            this.NavigationItem.Title = AppResources.Settings;

            LabelVisionSubscriptionKey.Text     = AppResources.VisionSubscriptionKey;
            LabelEmotionSubscriptionKey.Text    = AppResources.EmotionSubscriptionKey;
            LabelTranslatorSubscriptionKey.Text = AppResources.TranslatorSubscriptionKey;

            LabelTextToSpeech.Text = AppResources.TextToSpeech;
            LabelShowDescriptionConfidence.Text = AppResources.ShowDescriptionConfidence;
            LabelShowOriginalDescription.Text   = AppResources.ShowOriginalDescriptionOnTranslation;

            ButtonAbout.SetTitle(AppResources.AboutCommand, UIControlState.Normal);
            ButtonPrivacy.SetTitle(AppResources.PrivacyPolicyCommand, UIControlState.Normal);
        }
Example #2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ViewModel.Initialize();

            this.SetTranslation();

            this.bindings = new List <Binding>()
            {
                this.SetBinding(() => ViewModel.VisionSubscriptionKey, () => TextVisionSubscriptionKey.Text, BindingMode.TwoWay),
                this.SetBinding(() => ViewModel.FaceSubscriptionKey, () => TextFaceSubscriptionKey.Text, BindingMode.TwoWay),
                this.SetBinding(() => ViewModel.TranslatorSubscriptionKey, () => TextTranslatorSubscriptionKey.Text, BindingMode.TwoWay),

                this.SetBinding(() => ViewModel.IsTextToSpeechEnabled, () => SwitchTextToSpeech.On, BindingMode.TwoWay),
                this.SetBinding(() => ViewModel.ShowRecognitionConfidence, () => SwitchShowDescriptionConfidence.On, BindingMode.TwoWay),
                this.SetBinding(() => ViewModel.ShowOriginalDescriptionOnTranslation, () => SwitchShowOriginalDescription.On, BindingMode.TwoWay),
                this.SetBinding(() => ViewModel.ShowDescriptionOnFaceIdentification, () => SwitchShowDescriptionOnFaceIdentification.On, BindingMode.TwoWay),
            };

            TextVisionSubscriptionKey.DismissKeyboardOnReturn();
            TextFaceSubscriptionKey.DismissKeyboardOnReturn();
            TextTranslatorSubscriptionKey.DismissKeyboardOnReturn();

            ButtonAbout.SetCommand(this.ViewModel.GotoAboutCommand);
            ButtonPrivacy.SetCommand(this.ViewModel.GotoPrivacyPolicyCommand);

            this.NavigationItem.SetRightBarButtonItem(
                new UIBarButtonItem(UIBarButtonSystemItem.Save, (sender, args) =>
            {
                this.ViewModel.Save();
                NavigationController.PopViewController(true);
            })
                , true);

            //dismiss the keyboard if the user taps anywhere in the view
            var g = new UITapGestureRecognizer(() => View.EndEditing(true));

            g.CancelsTouchesInView = false;             //for iOS5
            View.AddGestureRecognizer(g);

            NavigationController.SetNavigationBarHidden(false, false);
        }
Example #3
0
 void ReleaseDesignerOutlets()
 {
     if (ButtonAbout != null)
     {
         ButtonAbout.Dispose();
         ButtonAbout = null;
     }
     if (ButtonLoadGame != null)
     {
         ButtonLoadGame.Dispose();
         ButtonLoadGame = null;
     }
     if (MapImage != null)
     {
         MapImage.Dispose();
         MapImage = null;
     }
     if (ProgressBar != null)
     {
         ProgressBar.Dispose();
         ProgressBar = null;
     }
 }
Example #4
0
        void ReleaseDesignerOutlets()
        {
            if (ButtonAbout != null)
            {
                ButtonAbout.Dispose();
                ButtonAbout = null;
            }

            if (ButtonPrivacy != null)
            {
                ButtonPrivacy.Dispose();
                ButtonPrivacy = null;
            }

            if (LabelEmotionSubscriptionKey != null)
            {
                LabelEmotionSubscriptionKey.Dispose();
                LabelEmotionSubscriptionKey = null;
            }

            if (LabelShowDescriptionConfidence != null)
            {
                LabelShowDescriptionConfidence.Dispose();
                LabelShowDescriptionConfidence = null;
            }

            if (LabelShowOriginalDescription != null)
            {
                LabelShowOriginalDescription.Dispose();
                LabelShowOriginalDescription = null;
            }

            if (LabelTextToSpeech != null)
            {
                LabelTextToSpeech.Dispose();
                LabelTextToSpeech = null;
            }

            if (LabelTranslatorSubscriptionKey != null)
            {
                LabelTranslatorSubscriptionKey.Dispose();
                LabelTranslatorSubscriptionKey = null;
            }

            if (LabelVisionSubscriptionKey != null)
            {
                LabelVisionSubscriptionKey.Dispose();
                LabelVisionSubscriptionKey = null;
            }

            if (LinkSubscribeEmotion != null)
            {
                LinkSubscribeEmotion.Dispose();
                LinkSubscribeEmotion = null;
            }

            if (LinkSubscribeVision != null)
            {
                LinkSubscribeVision.Dispose();
                LinkSubscribeVision = null;
            }

            if (LinkTranslatorSubscriptionKey != null)
            {
                LinkTranslatorSubscriptionKey.Dispose();
                LinkTranslatorSubscriptionKey = null;
            }

            if (SwitchShowDescriptionConfidence != null)
            {
                SwitchShowDescriptionConfidence.Dispose();
                SwitchShowDescriptionConfidence = null;
            }

            if (SwitchShowOriginalDescription != null)
            {
                SwitchShowOriginalDescription.Dispose();
                SwitchShowOriginalDescription = null;
            }

            if (SwitchTextToSpeech != null)
            {
                SwitchTextToSpeech.Dispose();
                SwitchTextToSpeech = null;
            }

            if (TextEmotionSubscriptionKey != null)
            {
                TextEmotionSubscriptionKey.Dispose();
                TextEmotionSubscriptionKey = null;
            }

            if (TextTranslatorSubscriptionKey != null)
            {
                TextTranslatorSubscriptionKey.Dispose();
                TextTranslatorSubscriptionKey = null;
            }

            if (TextVisionSubscriptionKey != null)
            {
                TextVisionSubscriptionKey.Dispose();
                TextVisionSubscriptionKey = null;
            }
        }
Example #5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            ViewModel.Initialize();

            this.RegisterMessages();
            this.SetTranslation();
            this.bindings = new List <Binding>()
            {
                this.SetBinding(() => ViewModel.VisionSubscriptionKey, () => TextVisionSubscriptionKey.Text, BindingMode.TwoWay),
                this.SetBinding(() => ViewModel.EmotionSubscriptionKey, () => TextEmotionSubscriptionKey.Text, BindingMode.TwoWay),
                this.SetBinding(() => ViewModel.TranslatorSubscriptionKey, () => TextTranslatorSubscriptionKey.Text, BindingMode.TwoWay),

                this.SetBinding(() => ViewModel.IsTextToSpeechEnabled, () => SwitchTextToSpeech.Selected, BindingMode.TwoWay),
                this.SetBinding(() => ViewModel.ShowDescriptionConfidence, () => SwitchShowDescriptionConfidence.Selected, BindingMode.TwoWay),
                this.SetBinding(() => ViewModel.ShowOriginalDescriptionOnTranslation, () => SwitchShowOriginalDescription.Selected, BindingMode.TwoWay),
            };

            TextVisionSubscriptionKey.DismissKeyboardOnReturn();
            TextEmotionSubscriptionKey.DismissKeyboardOnReturn();
            TextTranslatorSubscriptionKey.DismissKeyboardOnReturn();

            ButtonAbout.SetCommand(this.ViewModel.GotoAboutCommand);
            ButtonPrivacy.SetCommand(this.ViewModel.GotoPrivacyPolicyCommand);

            LinkSubscribeEmotion.UserInteractionEnabled = true;
            LinkSubscribeEmotion.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                this.ViewModel.SubscribeCognitiveServicesCommand.Execute(null);
            }));
            LinkSubscribeVision.UserInteractionEnabled = true;
            LinkSubscribeVision.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                this.ViewModel.SubscribeCognitiveServicesCommand.Execute(null);
            }));
            LinkTranslatorSubscriptionKey.UserInteractionEnabled = true;
            LinkTranslatorSubscriptionKey.AddGestureRecognizer(new UITapGestureRecognizer(() =>
            {
                this.ViewModel.SubscribeTranslatorServiceCommand.Execute(null);
            }));


            this.NavigationItem.SetRightBarButtonItem(
                new UIBarButtonItem(UIBarButtonSystemItem.Save, (sender, args) =>
            {
                this.ViewModel.Save();
            })
                , true);

            ButtonAbout.Hidden   = true;
            ButtonPrivacy.Hidden = true;

            //dismiss the keyboard if the user taps anywhere in the view
            var g = new UITapGestureRecognizer(() => View.EndEditing(true));

            g.CancelsTouchesInView = false;             //for iOS5
            View.AddGestureRecognizer(g);

            NavigationController.SetNavigationBarHidden(false, false);
        }