コード例 #1
0
        /* two design strategies:
         * - we could keep a reference to CONNECT_EVENT* with dz_object_retain and call method on the fly
         * - we extract all info in constructor and have pure managed object
         *
         * here we keep the second option, because we have to have a managed object anyway, and it's
         * a lot fewer unsafe method to expose, even though it's making a lot of calls in the constructor..
         */
        public unsafe static ConnectEvent newFromLibcEvent(CONNECT_EVENT *libcConnectEventHndl)
        {
            CONNECT_EVENT_TYPE eventType;

            unsafe
            {
                eventType = dz_connect_event_get_type(libcConnectEventHndl);
            }
            switch (eventType)
            {
            case CONNECT_EVENT_TYPE.USER_ACCESS_TOKEN_OK:
                string accessToken;
                unsafe
                {
                    IntPtr libcAccessTokenString = dz_connect_event_get_access_token(libcConnectEventHndl);
                    accessToken = Marshal.PtrToStringAnsi(libcAccessTokenString);
                }
                return(new NewAccessTokenConnectEvent(accessToken));

            default:
                return(new ConnectEvent(eventType));
            }
        }
コード例 #2
0
 public ConnectEvent(CONNECT_EVENT_TYPE eventType)
 {
     this.eventType = eventType;
 }