internal static void execute_command(IntPtr gcHandlePtr, IntPtr menu_model, out int menu_model_release, int command_id, int event_flags)
        {
            var self = (CfxMenuModelDelegate)System.Runtime.InteropServices.GCHandle.FromIntPtr(gcHandlePtr).Target;

            if (self == null || self.CallbacksDisabled)
            {
                menu_model_release = 1;
                return;
            }
            var e = new CfxExecuteCommandEventArgs(menu_model, command_id, event_flags);

            self.m_ExecuteCommand?.Invoke(self, e);
            e.m_isInvalid      = true;
            menu_model_release = e.m_menu_model_wrapped == null? 1 : 0;
        }
示例#2
0
        internal static void execute_command(IntPtr gcHandlePtr, IntPtr menu_model, int command_id, int event_flags)
        {
            var self = (CfxMenuModelDelegate)System.Runtime.InteropServices.GCHandle.FromIntPtr(gcHandlePtr).Target;

            if (self == null || self.CallbacksDisabled)
            {
                return;
            }
            var e            = new CfxExecuteCommandEventArgs(menu_model, command_id, event_flags);
            var eventHandler = self.m_ExecuteCommand;

            if (eventHandler != null)
            {
                eventHandler(self, e);
            }
            e.m_isInvalid = true;
            if (e.m_menu_model_wrapped == null)
            {
                CfxApi.cfx_release(e.m_menu_model);
            }
        }