public async void LoadApplication(Application application) { if (RequestingUserConsentFunc != null) { await RequestingUserConsentFunc(); } if (null == MainWindow) { throw new InvalidOperationException("MainWindow is not prepared. This method should be called in OnCreated()."); } if (null == application) { throw new ArgumentNullException(nameof(application)); } _application = application; Application.Current = application; application.SendStart(); application.PropertyChanged += new PropertyChangedEventHandler(this.AppOnPropertyChanged); SetPage(_application.MainPage); if (Device.Idiom == TargetIdiom.Watch) { _useBezelInteration = Specific.GetUseBezelInteraction(_application); UpdateOverlayContent(); } }
protected virtual void UpdateRotaryInteraction(bool enable) { if (NativeView is IRotaryInteraction ri) { if (Specific.GetUseBezelInteraction(Application.Current)) { if (enable) { ri.RotaryWidget?.Activate(); Forms.RotaryFocusObject = Element; Specific.SetActiveBezelInteractionElement(Application.Current, Element); } else { ri.RotaryWidget?.Deactivate(); if (Forms.RotaryFocusObject == Element) { Forms.RotaryFocusObject = null; } if (Specific.GetActiveBezelInteractionElement(Application.Current) == Element) { Specific.SetActiveBezelInteractionElement(Application.Current, null); } } } } }
protected virtual void OnPickerOpened(object sender, EventArgs args) { if (Specific.GetUseBezelInteraction(Application.Current)) { // picker included in WatchDatePickedDialog has been activated, whenever the dialog is opend. Forms.RotaryFocusObject = Element; Specific.SetActiveBezelInteractionElement(Application.Current, Element); } }
protected virtual void OnPickerClosed(object sender, EventArgs args) { if (Specific.GetUseBezelInteraction(Application.Current)) { if (Forms.RotaryFocusObject == Element) { Forms.RotaryFocusObject = null; } if (Specific.GetActiveBezelInteractionElement(Application.Current) == Element) { Specific.SetActiveBezelInteractionElement(Application.Current, null); } } }
void AppOnPropertyChanged(object sender, PropertyChangedEventArgs args) { if ("MainPage" == args.PropertyName) { SetPage(_application.MainPage); } else if (Device.Idiom == TargetIdiom.Watch) { if (Specific.UseBezelInteractionProperty.PropertyName == args.PropertyName) { _useBezelInteration = Specific.GetUseBezelInteraction(_application); } else if (Specific.OverlayContentProperty.PropertyName == args.PropertyName) { UpdateOverlayContent(); } } }