コード例 #1
0
ファイル: ClickBehavior.cs プロジェクト: P3PPP/MapExtensions
        protected override void OnDetachingFrom(Map bindable)
        {
            bindable?.Effects?.Remove(effect);
            effect = null;
            mapClickExtension.MapClicked     -= OnMapClicked;
            mapClickExtension.MapLongClicked -= OnMapLongClicked;
            mapClickExtension = null;

            base.OnDetachingFrom(bindable);
        }
コード例 #2
0
ファイル: ClickBehavior.cs プロジェクト: P3PPP/MapExtensions
        protected override void OnAttachedTo(Map bindable)
        {
            base.OnAttachedTo(bindable);

            if (bindable as Map == null)
            {
                throw new NotSupportedException(bindable.GetType() + " is not supported.");
            }

            effect = MapClickEffect.Create();
            if (effect == null)
            {
                throw new NotImplementedException("This functionality is not implemented in the portable version of this assembly.  You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.");
            }

            // PlatformEffectから地図のタップイベントを貰う
            mapClickExtension                 = effect as IMapClickExtension;
            mapClickExtension.MapClicked     += OnMapClicked;
            mapClickExtension.MapLongClicked += OnMapLongClicked;

            bindable.Effects.Add(effect);
        }