public void RegisterGetProcessHighlightingColorHandler(GeneralGetHighlightingColorDelegate handler) { if (handler == null) { throw new InvalidOperationException("Delegate handler can not be null."); } CallbackRegistration registration = new CallbackRegistration( NativeApi.PhGetGeneralCallback(PhGeneralCallback.GetProcessHighlightingColor), (parameter, context) => { PhPluginGetHighlightingColor *pargs = (PhPluginGetHighlightingColor *)parameter; GeneralGetHighlightingColorArgs args; args.Parameter = (IntPtr)pargs->Parameter; args.BackColor = ColorTranslator.FromWin32(pargs->BackColor); args.Handled = pargs->Handled; args.Cache = pargs->Cache; handler(this, ref args); pargs->BackColor = ColorTranslator.ToWin32(args.BackColor); pargs->Handled = args.Handled; pargs->Cache = args.Cache; } ); _registrations.Add(registration); }
public void RegisterGetProcessHighlightingColorHandler(GeneralGetHighlightingColorDelegate handler) { if (handler == null) throw new InvalidOperationException("Delegate handler can not be null."); CallbackRegistration registration = new CallbackRegistration( NativeApi.PhGetGeneralCallback(PhGeneralCallback.GetProcessHighlightingColor), (parameter, context) => { PhPluginGetHighlightingColor* pargs = (PhPluginGetHighlightingColor*)parameter; GeneralGetHighlightingColorArgs args; args.Parameter = (IntPtr)pargs->Parameter; args.BackColor = ColorTranslator.FromWin32(pargs->BackColor); args.Handled = pargs->Handled; args.Cache = pargs->Cache; handler(this, ref args); pargs->BackColor = ColorTranslator.ToWin32(args.BackColor); pargs->Handled = args.Handled; pargs->Cache = args.Cache; } ); _registrations.Add(registration); }