2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 using Layout = ElmSharp.Layout;
20 using EvasObject = ElmSharp.EvasObject;
21 using System.Collections.Generic;
26 /// Map View class to show a map on the screen.
28 public class MapView : Layout, IDisposable
30 internal Interop.ViewHandle handle;
31 private MapService _service;
33 private Dictionary<IntPtr, MapObject> _handleToObjectTable = new Dictionary<IntPtr, MapObject>();
35 private Interop.ViewOnEventCallback _gestureEventCallback;
36 private Interop.ViewOnEventCallback _objectEventCallback;
37 private Interop.ViewOnEventCallback _viewReadyEventCallback;
39 private event EventHandler<MapGestureEventArgs> _scrolledEventHandler;
40 private event EventHandler<MapGestureEventArgs> _zoomedEventHandler;
41 private event EventHandler<MapGestureEventArgs> _tappedEventHandler;
42 private event EventHandler<MapGestureEventArgs> _doubleTappedEventHandler;
43 private event EventHandler<MapGestureEventArgs> _twoFingerTappedEventHandler;
44 private event EventHandler<MapGestureEventArgs> _rotatedEventHandler;
45 private event EventHandler<MapGestureEventArgs> _longPressedEventHandler;
46 private event EventHandler _viewReadyEventHandler;
49 /// Creates the view and link it to the instance of map service.
51 /// <param name="parent">An instance of <see cref="EvasObject"/> object which map view will be drawn</param>
52 /// <param name="service">An instance of <see cref="MapService"/> object</param>
53 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
54 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
55 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
56 /// <exception cref="System.ArgumentException">Thrown when parameters are invalid</exception>
57 /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory, connect to service</exception>
58 public MapView(EvasObject parent, MapService service) : base(parent)
60 handle = new Interop.ViewHandle(service.handle, this);
61 Log.Info(string.Format("MapView is created"));
66 // We need to keep Gesture Tap event enabled for object event to work
67 handle.SetGestureEnabled(Interop.ViewGesture.Tap, true);
68 SetObjectEventCallback();
72 /// Adds or removes event handlers to deliver scrolled gesture event.
74 /// <value>Event handlers to get scrolled gesture event</value>
75 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
76 public event EventHandler<MapGestureEventArgs> Scrolled
80 SetGestureEventCallback();
81 handle.SetGestureEnabled(Interop.ViewGesture.Scroll, true);
82 _scrolledEventHandler += value;
83 Log.Info(string.Format("Scrolled event handler is added"));
87 _scrolledEventHandler -= value;
88 Log.Info(string.Format("Scrolled event handler is removed"));
89 if (_scrolledEventHandler == null)
91 handle.SetGestureEnabled(Interop.ViewGesture.Scroll, false);
92 UnsetGestureEventCallback();
98 /// Adds or removes event handlers to deliver zoomed gesture event.
100 /// <value>Event handlers to get zoomed gesture event</value>
101 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
102 public event EventHandler<MapGestureEventArgs> ZoomChanged
106 SetGestureEventCallback();
107 handle.SetGestureEnabled(Interop.ViewGesture.Zoom, true);
108 _zoomedEventHandler += value;
109 Log.Info(string.Format("ZoomChanged event handler is added"));
113 _zoomedEventHandler -= value;
114 Log.Info(string.Format("ZoomChanged event handler is removed"));
115 if (_zoomedEventHandler == null)
117 handle.SetGestureEnabled(Interop.ViewGesture.Zoom, false);
118 UnsetGestureEventCallback();
124 /// Adds or removes event handlers to deliver clicked gesture event.
126 /// <value>Event handlers to get clicked gesture event</value>
127 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
128 public event EventHandler<MapGestureEventArgs> Clicked
132 SetGestureEventCallback();
133 //handle.SetGestureEnabled(Interop.ViewGesture.Tap, true);
134 _tappedEventHandler += value;
135 Log.Info(string.Format("Clicked event handler is added"));
139 _tappedEventHandler -= value;
140 Log.Info(string.Format("Clicked event handler is removed"));
141 if (_tappedEventHandler == null)
143 //handle.SetGestureEnabled(Interop.ViewGesture.Tap, false);
144 UnsetGestureEventCallback();
150 /// Adds or removes event handlers to deliver double-clicked gesture event.
152 /// <value>Event handlers to get double-clicked gesture event</value>
153 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
154 public event EventHandler<MapGestureEventArgs> DoubleClicked
158 SetGestureEventCallback();
159 handle.SetGestureEnabled(Interop.ViewGesture.DoubleTap, true);
160 _doubleTappedEventHandler += value;
161 Log.Info(string.Format("DoubleClicked event handler is removed"));
165 _doubleTappedEventHandler -= value;
166 Log.Info(string.Format("DoubleClicked event handler is removed"));
167 if (_doubleTappedEventHandler == null)
169 handle.SetGestureEnabled(Interop.ViewGesture.DoubleTap, false);
170 UnsetGestureEventCallback();
176 /// Adds or removes event handlers to deliver clicked gesture event with two-fingers.
178 /// <value>Event handlers to get clicked gesture event</value>
179 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
180 public event EventHandler<MapGestureEventArgs> TwoFingerPressed
184 SetGestureEventCallback();
185 handle.SetGestureEnabled(Interop.ViewGesture.TwoFingerTap, true);
186 _twoFingerTappedEventHandler += value;
187 Log.Info(string.Format("TwoFingerPressed event handler is added"));
191 _twoFingerTappedEventHandler -= value;
192 Log.Info(string.Format("TwoFingerPressed event handler is removed"));
193 if (_twoFingerTappedEventHandler == null)
195 handle.SetGestureEnabled(Interop.ViewGesture.TwoFingerTap, false);
196 UnsetGestureEventCallback();
202 /// Adds or removes event handlers to deliver rotated gesture event.
204 /// <value>Event handlers to get rotated gesture event</value>
205 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
206 public event EventHandler<MapGestureEventArgs> Rotated
210 SetGestureEventCallback();
211 handle.SetGestureEnabled(Interop.ViewGesture.Rotate, true);
212 _rotatedEventHandler += value;
213 Log.Info(string.Format("Rotated event handler is added"));
217 _rotatedEventHandler -= value;
218 Log.Info(string.Format("Rotated event handler is removed"));
219 if (_rotatedEventHandler == null)
221 handle.SetGestureEnabled(Interop.ViewGesture.Rotate, false);
222 UnsetGestureEventCallback();
229 /// Adds or removes event handlers to deliver long-pressed gesture event.
231 /// <value>Event handlers to get long-pressed gesture event</value>
232 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
233 public event EventHandler<MapGestureEventArgs> LongPressed
237 SetGestureEventCallback();
238 handle.SetGestureEnabled(Interop.ViewGesture.LongPress, true);
239 _longPressedEventHandler += value;
240 Log.Info(string.Format("LongPressed event handler is added"));
244 _longPressedEventHandler -= value;
245 Log.Info(string.Format("LongPressed event handler is removed"));
246 if (_longPressedEventHandler == null)
248 handle.SetGestureEnabled(Interop.ViewGesture.LongPress, false);
249 UnsetGestureEventCallback();
255 /// Adds or removes event handlers to deliver a event representing the view is ready to be used.
257 /// <value>Event handlers to get view ready event</value>
258 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
259 public event EventHandler ViewReady
263 SetViewReadyEventCallback();
264 _viewReadyEventHandler += value;
265 Log.Info(string.Format("ViewReady event handler is added"));
269 _viewReadyEventHandler -= value;
270 Log.Info(string.Format("ViewReady event handler is removed"));
271 UnsetGestureEventCallback();
276 /// Gets or sets current zoom level.
278 /// <value>It is an integer value that representing current zoom level.</value>
279 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
280 /// <privilege>http://tizen.org/privilege/internet</privilege>
281 /// <privilege>http://tizen.org/privilege/network.get</privilege>
282 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
283 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
288 return handle.ZoomLevel;
292 Log.Info(string.Format("ZoomLevel is changed from {0} to {1}", handle.ZoomLevel, value));
293 handle.ZoomLevel = value;
298 /// Gets or sets minimum zoom level.
300 /// <value>It is an integer value that limits minimal zoom level within range of current map plug-in supported.</value>
301 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
302 /// <privilege>http://tizen.org/privilege/internet</privilege>
303 /// <privilege>http://tizen.org/privilege/network.get</privilege>
304 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
305 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
306 public int MinimumZoomLevel
310 return handle.MinimumZoomLevel;
314 Log.Info(string.Format("MinimumZoomLevel is changed from {0} to {1}", handle.MinimumZoomLevel, value));
315 handle.MinimumZoomLevel = value;
320 /// Gets or sets maximum zoom level.
322 /// <value>It is an integer value that limits maximum zoom level within range of current map plug-in supported.</value>
323 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
324 /// <privilege>http://tizen.org/privilege/internet</privilege>
325 /// <privilege>http://tizen.org/privilege/network.get</privilege>
326 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
327 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
328 public int MaximumZoomLevel
332 return handle.MaximumZoomLevel;
336 Log.Info(string.Format("MaximumZoomLevel is changed from {0} to {1}", handle.MaximumZoomLevel, value));
337 handle.MaximumZoomLevel = value;
342 /// Gets or sets orientation on the map view.
344 /// <value>It is an integer value from 0 to 360 that indicates orientation of the map view</value>
345 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
346 /// <privilege>http://tizen.org/privilege/internet</privilege>
347 /// <privilege>http://tizen.org/privilege/network.get</privilege>
348 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
349 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
350 public double Orientation
354 return handle.Orientation;
358 Log.Info(string.Format("Orientation is changed from {0} to {1}", handle.Orientation, value));
359 handle.Orientation = value;
364 /// Gets or sets theme type of the map view.
366 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
367 /// <privilege>http://tizen.org/privilege/internet</privilege>
368 /// <privilege>http://tizen.org/privilege/network.get</privilege>
369 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
370 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
371 public MapTypes MapType
375 return (MapTypes)handle.MapType;
379 Log.Info(string.Format("MapType is changed from {0} to {1}", handle.MapType, value));
380 handle.MapType = (Interop.ViewType)value;
385 /// Indicates whether the map should show the 3D buildings layer.
387 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
388 /// <privilege>http://tizen.org/privilege/internet</privilege>
389 /// <privilege>http://tizen.org/privilege/network.get</privilege>
390 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
391 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
392 public bool BuildingsEnabled
396 return handle.BuildingsEnabled;
400 Log.Info(string.Format("Showing the 3D buildings is {0}", (value ? "enabled" : "disabled")));
401 handle.BuildingsEnabled = value;
406 /// Indicates whether the map should show the traffic layer.
408 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
409 /// <privilege>http://tizen.org/privilege/internet</privilege>
410 /// <privilege>http://tizen.org/privilege/network.get</privilege>
411 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
412 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
413 public bool TrafficEnabled
417 return handle.TrafficEnabled;
421 Log.Info(string.Format("Showing the traffic is {0}", (value ? "enabled" : "disabled")));
422 handle.TrafficEnabled = value;
427 /// Indicates whether the map should show the public transit layer.
429 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
430 /// <privilege>http://tizen.org/privilege/internet</privilege>
431 /// <privilege>http://tizen.org/privilege/network.get</privilege>
432 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
433 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
434 public bool PublicTransitEnabled
438 return handle.PublicTransitEnabled;
442 Log.Info(string.Format("Showing the public transit is {0}", (value ? "enabled" : "disabled")));
443 handle.PublicTransitEnabled = value;
448 /// Indicates whether the scale-bar is enabled or not.
450 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
451 /// <privilege>http://tizen.org/privilege/internet</privilege>
452 /// <privilege>http://tizen.org/privilege/network.get</privilege>
453 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
454 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
455 public bool ScalebarEnabled
459 return handle.ScalebarEnabled;
463 Log.Info(string.Format("Showing the scale-bar is {0}", (value ? "enabled" : "disabled")));
464 handle.ScalebarEnabled = value;
469 /// Sets language of map view.
471 /// <value>The display language in the map.
472 /// A language is specified as an ISO 3166 alpha-2 two letter country-code
473 /// followed by ISO 639-1 for the two-letter language code.
474 /// Each language tag is composed of one or more "subtags" separated by hyphens (-).
475 /// Each subtag is composed of basic Latin letters or digits only.
476 /// For example, "ko-KR" for Korean, "en-US" for American English.</value>
477 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
478 /// <privilege>http://tizen.org/privilege/internet</privilege>
479 /// <privilege>http://tizen.org/privilege/network.get</privilege>
480 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
481 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
482 /// <exception cref="System.ArgumentException">Thrown when the value is invalid.</exception>
483 public string Language
487 return handle.Language;
491 Log.Info(string.Format("Language is changed from {0} to {1}", handle.Language, value));
492 handle.Language = value;
497 /// Gets or sets geographical coordinates for map view's center.
499 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
500 /// <privilege>http://tizen.org/privilege/internet</privilege>
501 /// <privilege>http://tizen.org/privilege/network.get</privilege>
502 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
503 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
504 /// <exception cref="System.ArgumentException">Thrown when the value is invalid.</exception>
505 public Geocoordinates Center
509 return new Geocoordinates(handle.Center);
513 Log.Info(string.Format("Center is changed from {0} to {1}", handle.Center, value.handle));
514 handle.Center = value.handle;
519 /// Gets a list of map object added to map view.
521 public IEnumerable<MapObject> Children
525 return _handleToObjectTable.Values;
530 /// Changes geographical coordinates to screen coordinates.
532 /// <param name="coordinates">Geographical coordinates</param>
533 /// <returns>Returns an instance of screen coordinates on the current screen</returns>
534 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
535 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
536 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
537 /// <exception cref="System.ArgumentException">Thrown when the value is invalid.</exception>
538 /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory, connect to service.</exception>
539 public Point GeolocationToScreen(Geocoordinates coordinates)
541 return handle.GeolocationToScreen(coordinates.handle);
545 /// Changes screen coordinates to geographical coordinates.
547 /// <param name="screenCoordinates">Screen coordinates</param>
548 /// <returns>Returns an instance of geographical coordinates object.</returns>
549 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
550 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
551 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
552 /// <exception cref="System.ArgumentException">Thrown when the value is invalid.</exception>
553 /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory, connect to service.</exception>
554 public Geocoordinates ScreenToGeolocation(Point screenCoordinates)
556 return new Geocoordinates(handle.ScreenToGeolocation(screenCoordinates));
560 /// Adds a map object to map view.
562 /// <param name="child">An instance of map object to be added</param>
563 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
564 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
565 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
566 /// <exception cref="System.ArgumentException">Thrown when the value is invalid.</exception>
567 /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory, connect to service.</exception>
568 public void Add(MapObject child)
570 Log.Info(string.Format("Add a object"));
571 var objectHandle = child.GetHandle();
572 if (!_handleToObjectTable.ContainsKey(objectHandle))
574 _handleToObjectTable[objectHandle] = child;
575 handle.AddObject(objectHandle);
577 // MapView take ownership of added map objects
578 objectHandle.HasOwnership = false;
583 /// Removes a map object from map view.
585 /// <param name="child">An instance of map object to be removed</param>
586 /// <remarks>Once removed, the child object will be become invalid</remarks>
587 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
588 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
589 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
590 /// <exception cref="System.ArgumentException">Thrown when the value is invalid.</exception>
591 /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory, connect to service.</exception>
592 public void Remove(MapObject child)
594 Log.Info(string.Format("Remove a object"));
595 var objectHandle = child.GetHandle();
596 if (_handleToObjectTable.Remove(objectHandle))
598 handle.RemoveObject(child.GetHandle());
600 // The object handle will be released automatically by the View, once RemoveObject call is successful
601 child.InvalidateMapObject();
606 /// Removes all map objects from map view.
608 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
609 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
610 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
611 /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory, connect to service.</exception>
612 public void RemoveAll()
614 Log.Info(string.Format("Remove all of objects"));
615 foreach (var child in _handleToObjectTable.Values)
617 child.InvalidateMapObject();
619 _handleToObjectTable.Clear();
620 handle.RemoveAllObjects();
624 /// Captures a snapshot of map view
626 /// <param name="type">Type of file format</param>
627 /// <param name="quality">A integer value which representing quality for encoding, from 1 to 100</param>
628 /// <param name="path">A string which representing The file path for snapshot</param>
629 /// <privilege>http://tizen.org/privilege/mapservice</privilege>
630 /// <exception cref="System.NotSupportedException">Thrown when the required feature is not supported.</exception>
631 /// <exception cref="System.UnauthorizedAccessException">Thrown when application does not have some privilege to access this method.</exception>
632 /// <exception cref="System.ArgumentException">Thrown when the value is invalid.</exception>
633 /// <exception cref="System.InvalidOperationException">Thrown when native operation failed to allocate memory, connect to service.</exception>
634 public void CaptureSnapshot(SnapshotType type, int quality, string path)
636 var err = Interop.ViewSnapshot.ViewCaptureSnapshot(handle, (Interop.ViewSnapshotFormatType)type, quality, path);
637 err.ThrowIfFailed("Failed to create snapshot for the view");
640 private void SetGestureEventCallback()
642 if (_gestureEventCallback == null)
644 _gestureEventCallback = (type, eventData, userData) =>
646 if (type != Interop.ViewEventType.Gesture) return;
647 var eventArg = new MapGestureEventArgs(eventData);
648 switch (eventArg.GestureType)
650 case GestureType.Scroll: _scrolledEventHandler?.Invoke(this, eventArg); break;
651 case GestureType.Zoom: _zoomedEventHandler?.Invoke(this, eventArg); break;
652 case GestureType.Tap: _tappedEventHandler?.Invoke(this, eventArg); break;
653 case GestureType.DoubleTap: _doubleTappedEventHandler?.Invoke(this, eventArg); break;
654 case GestureType.TwoFingerTap: _twoFingerTappedEventHandler?.Invoke(this, eventArg); break;
655 case GestureType.Rotate: _rotatedEventHandler?.Invoke(this, eventArg); break;
656 case GestureType.LongPress: _longPressedEventHandler?.Invoke(this, eventArg); break;
659 handle.SetEventCb(Interop.ViewEventType.Gesture, _gestureEventCallback, IntPtr.Zero);
660 Log.Info(string.Format("Gesture event callback is set"));
664 private void UnsetGestureEventCallback()
666 if (_scrolledEventHandler != null || _zoomedEventHandler != null
667 || _tappedEventHandler != null || _doubleTappedEventHandler != null
668 || _twoFingerTappedEventHandler != null || _rotatedEventHandler != null
669 || _longPressedEventHandler != null)
674 handle.UnsetEventCb(Interop.ViewEventType.Gesture);
675 _gestureEventCallback = null;
676 Log.Info(string.Format("Gesture event callback is unset"));
679 private void SetObjectEventCallback()
681 if (_objectEventCallback == null)
683 _objectEventCallback = (type, eventData, userData) =>
685 if (type != Interop.ViewEventType.Object) return;
686 var eventArg = new Interop.ObjectEventDataHandle(eventData);
687 switch (eventArg.GestureType)
689 case Interop.ViewGesture.Tap:
691 var mapObject = _handleToObjectTable[eventArg.ViewObject];
692 mapObject?.HandleClickedEvent();
697 handle.SetEventCb(Interop.ViewEventType.Object, _objectEventCallback, IntPtr.Zero);
698 Log.Info(string.Format("Object event callback is set"));
702 private void SetViewReadyEventCallback()
704 if (_viewReadyEventCallback == null)
706 _viewReadyEventCallback = (type, eventData, userData) =>
708 _viewReadyEventHandler?.Invoke(this, EventArgs.Empty);
710 handle.SetEventCb(Interop.ViewEventType.Ready, _viewReadyEventCallback, IntPtr.Zero);
711 Log.Info(string.Format("ViewReady event callback is set"));
715 private void UnsetViewReadyEventCallback()
717 if (_viewReadyEventHandler == null)
719 handle.UnsetEventCb(Interop.ViewEventType.Ready);
720 _viewReadyEventCallback = null;
721 Log.Info(string.Format("ViewReady event callback is unset"));
725 #region IDisposable Support
726 private bool _disposedValue = false;
728 protected virtual void Dispose(bool disposing)
737 _disposedValue = true;
742 /// Releases all resources used by this object.
744 public void Dispose()
747 GC.SuppressFinalize(this);