Ejemplo n.º 1
0
        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();
            }
        }
Ejemplo n.º 2
0
 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);
                 }
             }
         }
     }
 }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
        void UpdateOverlayContent()
        {
            EvasObject nativeView = null;
            var        content    = Specific.GetOverlayContent(_application);

            if (content != null)
            {
                var renderer = Platform.GetOrCreateRenderer(content);
                (renderer as ILayoutRenderer)?.RegisterOnLayoutUpdated();
                nativeView = renderer?.NativeView;
            }
            Forms.BaseLayout.SetOverlayPart(nativeView);
        }
Ejemplo n.º 5
0
 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);
         }
     }
 }
Ejemplo n.º 6
0
 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();
         }
     }
 }