2 using System.Collections.Generic;
4 namespace Tizen.Applications.AttachPanel
6 public partial class AttachPanel
8 private static IntPtr _attachPanel;
9 private bool isCreationSucceed;
11 private static event EventHandler<StateEventArgs> _eventEventHandler;
12 private static event EventHandler<ResultEventArgs> _resultEventHandler;
14 private static Interop.AttachPanel.AttachPanelEventCallback SetEventListener;
15 private static Interop.AttachPanel.AttachPanelResultCallback SetResultListener;
17 private void StateEventListenStart()
19 Interop.AttachPanel.ErrorCode err = 0;
21 SetEventListener = (attachPanel, eventType, eventInfo, userData) =>
23 _eventEventHandler?.Invoke(null, new StateEventArgs(attachPanel, (EventType)eventType, eventInfo, userData));
25 err = Interop.AttachPanel.SetEventCb(_attachPanel, SetEventListener, IntPtr.Zero);
28 private void StateEventListenStop()
30 Interop.AttachPanel.ErrorCode err = 0;
31 err = Interop.AttachPanel.UnsetEventCb(_attachPanel);
35 private void ResultEventListenStart()
37 Interop.AttachPanel.ErrorCode err = 0;
38 SetResultListener = (attachPanel, category, resulthandler, resultCode, userData) =>
40 SafeAppControlHandle handle = new SafeAppControlHandle(resulthandler, false);
41 AppControl result = new AppControl(handle);
42 _resultEventHandler?.Invoke(null, new ResultEventArgs(attachPanel, (ContentCategory)category, result, (AppControlReplyResult)resultCode, userData));
44 err = Interop.AttachPanel.SetResultCb(_attachPanel, SetResultListener, IntPtr.Zero);
48 private void ResultEventListenStop()
50 Interop.AttachPanel.ErrorCode err = 0;
51 err = Interop.AttachPanel.UnsetResultCb(_attachPanel);
55 internal static void checkException(Interop.AttachPanel.ErrorCode err)
59 case Interop.AttachPanel.ErrorCode.InvalidParameter:
60 throw new ArgumentOutOfRangeException("Invalid parameter error at unmanaged code");
61 case Interop.AttachPanel.ErrorCode.OutOfMemory:
62 throw new OutOfMemoryException("Out of Memory");
63 case Interop.AttachPanel.ErrorCode.PermissionDenied:
64 throw new UnauthorizedAccessException();
65 case Interop.AttachPanel.ErrorCode.AlreadyExists:
66 throw new InvalidOperationException("Already Exists");
67 case Interop.AttachPanel.ErrorCode.NotInitialized:
68 throw new InvalidOperationException("Not initialized");
69 case Interop.AttachPanel.ErrorCode.UnsupportedContentCategory:
70 throw new NotSupportedException("Unsupported Content Category");
71 case Interop.AttachPanel.ErrorCode.AlreadyDestroyed:
72 throw new InvalidOperationException("Already Destroyed");