Пример #1
0
        internal static ElmSharp.Wearable.CircleSurface GetSurface(this IVisualElementRenderer renderer)
        {
            if (null != renderer.Element)
            {
                Element element = renderer.Element;
                while (element != null)
                {
                    if (element is CirclePage)
                    {
                        var circlePageRenderer = Platform.GetRenderer(element) as CirclePageRenderer;
                        return(circlePageRenderer?.CircleSurface);
                    }
                    foreach (var effect in element.Effects)
                    {
                        if (effect is TizenCircleSurfaceEffect)
                        {
                            return(CircleSurfaceEffectBehavior.GetSurface(element) as ElmSharp.Wearable.CircleSurface);
                        }
                    }

                    element = element.Parent;
                }
            }
            throw new CircleSurfaceNotFoundException();
        }
Пример #2
0
        protected override void OnAttached()
        {
            var rect = Control.Geometry;

            _surfaceLayout = new ElmSharp.Layout(Container);
            _surfaceLayout.Show();
            _surface = new ElmSharp.Wearable.CircleSurface(_surfaceLayout);
            _surfaceLayout.Geometry = rect;
            _surfaceLayout.StackAbove(Control);

            CircleSurfaceEffectBehavior.SetSurface(Element, _surface);

            _showEvent    = new EvasObjectEvent(Control, EvasObjectCallbackType.Show);
            _hideEvent    = new EvasObjectEvent(Control, EvasObjectCallbackType.Hide);
            _restackEvent = new EvasObjectEvent(Control, EvasObjectCallbackType.Restack);
            _moveEvent    = new EvasObjectEvent(Control, EvasObjectCallbackType.Move);
            _resizeEvent  = new EvasObjectEvent(Control, EvasObjectCallbackType.Resize);

            _showEvent.On    += ControlShowed;
            _hideEvent.On    += ControlHided;
            _restackEvent.On += ControlRestacked;
            _moveEvent.On    += ControlChanged;
            _resizeEvent.On  += ControlChanged;

            Element.PropertyChanging += ElementPropertyChanging;
            Element.PropertyChanged  += ElementPropertyChanged;

            EcoreMainloop.Post(() =>
            {
                var obj = CircleSurfaceEffectBehavior.GetRotaryFocusObject(Element);
                ActivateRotaryFocusable(obj);
            });
        }
Пример #3
0
 void ElementPropertyChanging(object sender, PropertyChangingEventArgs e)
 {
     if (e.PropertyName == CircleSurfaceEffectBehavior.RotaryFocusObjectProperty.PropertyName)
     {
         var obj = CircleSurfaceEffectBehavior.GetRotaryFocusObject(Element);
         DeativateRotaryFocusable(obj);
     }
 }
Пример #4
0
 void ElementPropertyChanged(object sender, global::System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == CircleSurfaceEffectBehavior.RotaryFocusObjectProperty.PropertyName)
     {
         var obj = CircleSurfaceEffectBehavior.GetRotaryFocusObject(Element);
         ActivateRotaryFocusable(obj);
     }
 }
Пример #5
0
        protected override void OnDetached()
        {
            var obj = CircleSurfaceEffectBehavior.GetRotaryFocusObject(Element);

            DeativateRotaryFocusable(obj);

            _surface.Delete();
            _surface = null;
            _surfaceLayout.Unrealize();
            _surfaceLayout = null;
            CircleSurfaceEffectBehavior.SetSurface(Element, null);

            _showEvent.Dispose();
            _hideEvent.Dispose();
            _restackEvent.Dispose();
            _moveEvent.Dispose();
            _resizeEvent.Dispose();
        }
Пример #6
0
 internal static CircleSurface GetSurfaceRecursively(Element element)
 {
     while (element != null)
     {
         if (element is CirclePage)
         {
             var circlePageRenderer = Platform.GetRenderer(element) as CirclePageRenderer;
             return(circlePageRenderer?.CircleSurface);
         }
         foreach (var effect in element.Effects)
         {
             if (effect is TizenCircleSurfaceEffect)
             {
                 return(CircleSurfaceEffectBehavior.GetSurface(element) as CircleSurface);
             }
         }
         element = element.Parent;
     }
     return(null);
 }