示例#1
0
        internal Controller(IntPtr nativeInstance)
        {
            m_nativeInstance = nativeInstance;
            m_commands       = new List <Command>();

            m_managedCallback = HandleCallback;
            m_nativeCallback  = Marshal.GetFunctionPointerForDelegate <ControllerNative.CommandChangedDelegate>(m_managedCallback);
            ControllerNative.RegisterCommandCallback(m_nativeInstance, m_nativeCallback);
        }
示例#2
0
        public void Dispose()
        {
            while (m_commands.Count > 0)
            {
                m_commands[0].Dispose();
            }

            if (m_nativeCallback != IntPtr.Zero)
            {
                ControllerNative.UnregisterCommandCallback(m_nativeInstance, m_nativeCallback);
                m_nativeCallback  = IntPtr.Zero;
                m_managedCallback = null;
            }

            m_nativeInstance = IntPtr.Zero;
            m_commands       = null;
        }