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); }
void ReleaseDesignerOutlets() { if (ButtonAbout != null) { ButtonAbout.Dispose(); ButtonAbout = null; } if (ButtonPrivacy != null) { ButtonPrivacy.Dispose(); ButtonPrivacy = null; } if (LabelFaceSubscriptionKey != null) { LabelFaceSubscriptionKey.Dispose(); LabelFaceSubscriptionKey = null; } if (LabelShowDescriptionOnFaceIdentification != null) { LabelShowDescriptionOnFaceIdentification.Dispose(); LabelShowDescriptionOnFaceIdentification = null; } if (LabelShowOriginalDescription != null) { LabelShowOriginalDescription.Dispose(); LabelShowOriginalDescription = null; } if (LabelShowRecognitionConfidence != null) { LabelShowRecognitionConfidence.Dispose(); LabelShowRecognitionConfidence = null; } if (LabelTextToSpeech != null) { LabelTextToSpeech.Dispose(); LabelTextToSpeech = null; } if (LabelTranslatorSubscriptionKey != null) { LabelTranslatorSubscriptionKey.Dispose(); LabelTranslatorSubscriptionKey = null; } if (LabelVisionSubscriptionKey != null) { LabelVisionSubscriptionKey.Dispose(); LabelVisionSubscriptionKey = null; } if (LinkSubscribeVision != null) { LinkSubscribeVision.Dispose(); LinkSubscribeVision = null; } if (LinkSubscribeFace != null) { LinkSubscribeFace.Dispose(); LinkSubscribeFace = null; } if (LinkTranslatorSubscriptionKey != null) { LinkTranslatorSubscriptionKey.Dispose(); LinkTranslatorSubscriptionKey = null; } if (SwitchShowDescriptionConfidence != null) { SwitchShowDescriptionConfidence.Dispose(); SwitchShowDescriptionConfidence = null; } if (SwitchShowDescriptionOnFaceIdentification != null) { SwitchShowDescriptionOnFaceIdentification.Dispose(); SwitchShowDescriptionOnFaceIdentification = null; } if (SwitchShowOriginalDescription != null) { SwitchShowOriginalDescription.Dispose(); SwitchShowOriginalDescription = null; } if (SwitchTextToSpeech != null) { SwitchTextToSpeech.Dispose(); SwitchTextToSpeech = null; } if (TextFaceSubscriptionKey != null) { TextFaceSubscriptionKey.Dispose(); TextFaceSubscriptionKey = null; } if (TextTranslatorSubscriptionKey != null) { TextTranslatorSubscriptionKey.Dispose(); TextTranslatorSubscriptionKey = null; } if (TextVisionSubscriptionKey != null) { TextVisionSubscriptionKey.Dispose(); TextVisionSubscriptionKey = null; } }