2 using System.Collections.Generic;
4 namespace Tizen.Applications.AttachPanel
7 /// Attach panel internal implementation
9 public partial class AttachPanel
11 private static IntPtr _attachPanel;
12 private bool isCreationSucceed;
14 private static event EventHandler<StateEventArgs> _eventEventHandler;
15 private static event EventHandler<ResultEventArgs> _resultEventHandler;
17 private static Interop.AttachPanel.AttachPanelEventCallback SetEventListener;
18 private static Interop.AttachPanel.AttachPanelResultCallback SetResultListener;
20 private void StateEventListenStart()
22 Interop.AttachPanel.ErrorCode err = 0;
24 SetEventListener = (attachPanel, eventType, eventInfo, userData) =>
26 _eventEventHandler?.Invoke(null, new StateEventArgs((EventType)eventType));
28 err = Interop.AttachPanel.SetEventCb(_attachPanel, SetEventListener, IntPtr.Zero);
32 private void StateEventListenStop()
34 Interop.AttachPanel.ErrorCode err = 0;
35 err = Interop.AttachPanel.UnsetEventCb(_attachPanel);
39 private void ResultEventListenStart()
41 Interop.AttachPanel.ErrorCode err = 0;
42 SetResultListener = (attachPanel, category, resulthandler, resultCode, userData) =>
44 SafeAppControlHandle handle = new SafeAppControlHandle(resulthandler, false);
45 AppControl result = new AppControl(handle);
46 _resultEventHandler?.Invoke(null, new ResultEventArgs((ContentCategory)category, result, (AppControlReplyResult)resultCode));
48 err = Interop.AttachPanel.SetResultCb(_attachPanel, SetResultListener, IntPtr.Zero);
52 private void ResultEventListenStop()
54 Interop.AttachPanel.ErrorCode err = 0;
55 err = Interop.AttachPanel.UnsetResultCb(_attachPanel);
59 internal static void CheckException(Interop.AttachPanel.ErrorCode err)
63 case Interop.AttachPanel.ErrorCode.InvalidParameter:
64 throw new ArgumentOutOfRangeException("Invalid parameter error at unmanaged code");
65 case Interop.AttachPanel.ErrorCode.OutOfMemory:
66 throw new OutOfMemoryException("Out of Memory");
67 case Interop.AttachPanel.ErrorCode.PermissionDenied:
68 throw new UnauthorizedAccessException();
69 case Interop.AttachPanel.ErrorCode.AlreadyExists:
70 throw new InvalidOperationException("Already Exists");
71 case Interop.AttachPanel.ErrorCode.NotInitialized:
72 throw new InvalidOperationException("Not initialized");
73 case Interop.AttachPanel.ErrorCode.UnsupportedContentCategory:
74 throw new NotSupportedException("Unsupported Content Category");
75 case Interop.AttachPanel.ErrorCode.AlreadyDestroyed:
76 throw new InvalidOperationException("Already Destroyed");