private void CheckSelf(cef_pdf_print_callback_t *self) { if (_self != self) { throw ExceptionBuilder.InvalidSelfReference(); } }
private void on_pdf_print_finished(cef_pdf_print_callback_t *self, cef_string_t *path, int ok) { CheckSelf(self); var m_path = cef_string_t.ToString(path); OnPdfPrintFinished(m_path, ok != 0); }
protected virtual void Dispose(bool disposing) { if (_self != null) { cef_pdf_print_callback_t.Free(_self); _self = null; } }
private static unsafe void OnPdfPrintFinishedImpl(cef_pdf_print_callback_t *self, cef_string_t *path, int ok) { var instance = GetInstance((IntPtr)self) as CefPdfPrintCallback; if (instance == null || ((ICefPdfPrintCallbackPrivate)instance).AvoidOnPdfPrintFinished()) { return; } instance.OnPdfPrintFinished(CefString.Read(path), ok != 0); }
public CefPdfPrintCallback() { cef_pdf_print_callback_t *self = this.NativeInstance; #if NET_LESS_5_0 self->on_pdf_print_finished = (void *)Marshal.GetFunctionPointerForDelegate(fnOnPdfPrintFinished); #else self->on_pdf_print_finished = (delegate * unmanaged[Stdcall] < cef_pdf_print_callback_t *, cef_string_t *, int, void >) & OnPdfPrintFinishedImpl; #endif }
private void add_ref(cef_pdf_print_callback_t *self) { lock (SyncRoot) { var result = ++_refct; if (result == 1) { lock (_roots) { _roots.Add((IntPtr)_self, this); } } } }
private int release(cef_pdf_print_callback_t *self) { lock (SyncRoot) { var result = --_refct; if (result == 0) { lock (_roots) { _roots.Remove((IntPtr)_self); } return(1); } return(0); } }
protected CefPdfPrintCallback() { _self = cef_pdf_print_callback_t.Alloc(); _ds0 = new cef_pdf_print_callback_t.add_ref_delegate(add_ref); _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0); _ds1 = new cef_pdf_print_callback_t.release_delegate(release); _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1); _ds2 = new cef_pdf_print_callback_t.has_one_ref_delegate(has_one_ref); _self->_base._has_one_ref = Marshal.GetFunctionPointerForDelegate(_ds2); _ds3 = new cef_pdf_print_callback_t.on_pdf_print_finished_delegate(on_pdf_print_finished); _self->_on_pdf_print_finished = Marshal.GetFunctionPointerForDelegate(_ds3); }
internal static void Free(cef_pdf_print_callback_t *ptr) { Marshal.FreeHGlobal((IntPtr)ptr); }
public CefPdfPrintCallback(cef_pdf_print_callback_t *instance) : base((cef_base_ref_counted_t *)instance) { }
public CefPdfPrintCallback() { cef_pdf_print_callback_t *self = this.NativeInstance; self->on_pdf_print_finished = (void *)Marshal.GetFunctionPointerForDelegate(fnOnPdfPrintFinished); }
private int has_one_ref(cef_pdf_print_callback_t *self) { lock (SyncRoot) { return(_refct == 1 ? 1 : 0); } }
public unsafe extern void PrintToPdf([Immutable] cef_string_t *path, [Immutable] cef_pdf_print_settings_t *settings, cef_pdf_print_callback_t *callback);
private int has_at_least_one_ref(cef_pdf_print_callback_t *self) { lock (SyncRoot) { return(_refct != 0 ? 1 : 0); } }
private void on_pdf_print_finished(cef_pdf_print_callback_t *self, cef_string_t *path, int ok) { CheckSelf(self); throw new NotImplementedException(); // TODO: CefPdfPrintCallback.OnPdfPrintFinished }
/// <summary> /// Print the current browser contents to the PDF file specified by |path| and /// execute |callback| on completion. The caller is responsible for deleting /// |path| when done. For PDF printing to work on Linux you must implement the /// CefPrintHandler::GetPdfPaperSize method. /// </summary> public void PrintToPDF(cef_string_t *path, cef_pdf_print_settings_t *settings, cef_pdf_print_callback_t *callback) { throw new NotImplementedException(); // TODO: CefBrowserHost.PrintToPDF }