Пример #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();
            }
        }
Пример #2
0
        void UpdateOverlayContent()
        {
            EvasObject nativeView = null;
            var        content    = Specific.GetOverlayContent(_application);

            if (content != null)
            {
                var renderer = Platform.GetOrCreateRenderer(content);
                (renderer as LayoutRenderer)?.RegisterOnLayoutUpdated();
                nativeView = renderer?.NativeView;
            }
            System.Maui.Maui.BaseLayout.SetPartContent("elm.swallow.overlay", nativeView);
        }
Пример #3
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();
         }
     }
 }
Пример #4
0
 protected virtual void UpdateRotaryInteraction(bool enable)
 {
     if (NativeView is IRotaryInteraction ri)
     {
         if (Specific.GetUseBezelInteraction(Application.Current))
         {
             if (enable)
             {
                 ri.RotaryWidget?.Activate();
                 System.Maui.Maui.RotaryFocusObject = Element;
             }
             else
             {
                 ri.RotaryWidget?.Deactivate();
                 if (System.Maui.Maui.RotaryFocusObject == Element)
                 {
                     System.Maui.Maui.RotaryFocusObject = null;
                 }
             }
         }
     }
 }