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); }); }
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(); }