本文整理汇总了C#中ManagedCefBrowserAdapter类的典型用法代码示例。如果您正苦于以下问题:C# ManagedCefBrowserAdapter类的具体用法?C# ManagedCefBrowserAdapter怎么用?C# ManagedCefBrowserAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ManagedCefBrowserAdapter类属于命名空间,在下文中一共展示了ManagedCefBrowserAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChromiumWebBrowser
/// <summary>
/// Create a new OffScreen Chromium Browser
/// </summary>
/// <param name="address">Initial address (url) to load</param>
/// <param name="browserSettings">The browser settings to use. If null, the default settings are used.</param>
public ChromiumWebBrowser(string address, BrowserSettings browserSettings = null)
{
if (!Cef.IsInitialized && !Cef.Initialize())
{
throw new InvalidOperationException("Cef::Initialize() failed");
}
ResourceHandler = new DefaultResourceHandler();
Cef.AddDisposable(this);
Address = address;
managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);
managedCefBrowserAdapter.CreateOffscreenBrowser(IntPtr.Zero, browserSettings ?? new BrowserSettings(), address);
}
示例2: ChromiumWebBrowser
/// <summary>
/// Initializes a new instance of the <see cref="ChromiumWebBrowser"/> class.
/// </summary>
/// <param name="address">The address.</param>
/// <exception cref="System.InvalidOperationException">Cef::Initialize() failed</exception>
public ChromiumWebBrowser(string address)
{
if (!Cef.IsInitialized && !Cef.Initialize())
{
throw new InvalidOperationException("Cef::Initialize() failed");
}
Cef.AddDisposable(this);
Address = address;
Dock = DockStyle.Fill;
FocusHandler = new DefaultFocusHandler(this);
ResourceHandlerFactory = new DefaultResourceHandlerFactory();
BrowserSettings = new BrowserSettings();
managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, false);
}
示例3: ChromiumWebBrowser
/// <summary>
/// Create a new OffScreen Chromium Browser
/// </summary>
/// <param name="address">Initial address (url) to load</param>
/// <param name="browserSettings">The browser settings to use. If null, the default settings are used.</param>
/// <param name="requestcontext">See <see cref="RequestContext"/> for more details. Defaults to null</param>
public ChromiumWebBrowser(string address = "", BrowserSettings browserSettings = null, RequestContext requestcontext = null)
{
if (!Cef.IsInitialized && !Cef.Initialize())
{
throw new InvalidOperationException("Cef::Initialize() failed");
}
BitmapFactory = new BitmapFactory(BitmapLock);
ResourceHandlerFactory = new DefaultResourceHandlerFactory();
BrowserSettings = browserSettings ?? new BrowserSettings();
RequestContext = requestcontext;
Cef.AddDisposable(this);
Address = address;
managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);
managedCefBrowserAdapter.CreateOffscreenBrowser(IntPtr.Zero, BrowserSettings, RequestContext, address);
}
示例4: Initialize
protected void Initialize()
{
Application.ApplicationExit += OnApplicationExit;
Cef.AddDisposable(this);
// Dock = DockStyle.Fill;
FocusHandler = new DefaultFocusHandler(this);
ResourceHandler = new DefaultResourceHandler();
managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this);
}
示例5: ChromiumWebBrowser
/// <summary>
/// Create a new OffScreen Chromium Browser
/// </summary>
/// <param name="address">Initial address (url) to load</param>
/// <param name="browserSettings">The browser settings to use. If null, the default settings are used.</param>
/// <param name="requestContext">See <see cref="RequestContext" /> for more details. Defaults to null</param>
/// <param name="automaticallyCreateBrowser">automatically create the underlying Browser</param>
/// <param name="blendPopup">Should the popup be blended in the background in the rendering</param>
/// <exception cref="System.InvalidOperationException">Cef::Initialize() failed</exception>
public ChromiumWebBrowser(string address = "", BrowserSettings browserSettings = null,
RequestContext requestContext = null, bool automaticallyCreateBrowser = true)
{
if (!Cef.IsInitialized && !Cef.Initialize())
{
throw new InvalidOperationException("Cef::Initialize() failed");
}
BitmapFactory = new BitmapFactory(BitmapLock);
ResourceHandlerFactory = new DefaultResourceHandlerFactory();
BrowserSettings = browserSettings ?? new BrowserSettings();
RequestContext = requestContext;
Cef.AddDisposable(this);
Address = address;
managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);
if (automaticallyCreateBrowser)
{
CreateBrowser(IntPtr.Zero);
}
popupPosition = new Point();
popupSize = new Size();
}
示例6: ChromiumWebBrowser
public ChromiumWebBrowser()
{
Cef.AddDisposable(this);
Focusable = true;
FocusVisualStyle = null;
IsTabStop = true;
Dispatcher.BeginInvoke((Action)(() => WebBrowser = this));
Loaded += OnLoaded;
Unloaded += OnUnloaded;
GotKeyboardFocus += OnGotKeyboardFocus;
LostKeyboardFocus += OnLostKeyboardFocus;
IsVisibleChanged += OnIsVisibleChanged;
ToolTip = toolTip = new ToolTip();
toolTip.StaysOpen = true;
toolTip.Visibility = Visibility.Collapsed;
toolTip.Closed += OnTooltipClosed;
BackCommand = new DelegateCommand(Back, () => CanGoBack);
ForwardCommand = new DelegateCommand(Forward, () => CanGoForward);
ReloadCommand = new DelegateCommand(Reload, () => CanReload);
PrintCommand = new DelegateCommand(Print);
ZoomInCommand = new DelegateCommand(ZoomIn);
ZoomOutCommand = new DelegateCommand(ZoomOut);
ZoomResetCommand = new DelegateCommand(ZoomReset);
ViewSourceCommand = new DelegateCommand(ViewSource);
CleanupCommand = new DelegateCommand(Dispose);
StopCommand = new DelegateCommand(Stop);
managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this);
managedCefBrowserAdapter.CreateOffscreenBrowser(BrowserSettings ?? new BrowserSettings());
disposables.Add(managedCefBrowserAdapter);
disposables.Add(new DisposableEventWrapper(this, ActualHeightProperty, OnActualSizeChanged));
disposables.Add(new DisposableEventWrapper(this, ActualWidthProperty, OnActualSizeChanged));
}
示例7: ChromiumWebBrowser
public ChromiumWebBrowser()
{
if (!Cef.IsInitialized && !Cef.Initialize())
{
throw new InvalidOperationException("Cef::Initialize() failed");
}
BitmapFactory = new BitmapFactory();
Cef.AddDisposable(this);
Focusable = true;
FocusVisualStyle = null;
IsTabStop = true;
Dispatcher.BeginInvoke((Action)(() => WebBrowser = this));
Loaded += OnLoaded;
GotKeyboardFocus += OnGotKeyboardFocus;
LostKeyboardFocus += OnLostKeyboardFocus;
// Drag Drop events
DragEnter += OnDragEnter;
DragOver += OnDragOver;
DragLeave += OnDragLeave;
Drop += OnDrop;
IsVisibleChanged += OnIsVisibleChanged;
ToolTip = toolTip = new ToolTip();
toolTip.StaysOpen = true;
toolTip.Visibility = Visibility.Collapsed;
toolTip.Closed += OnTooltipClosed;
BackCommand = new DelegateCommand(this.Back, () => CanGoBack);
ForwardCommand = new DelegateCommand(this.Forward, () => CanGoForward);
ReloadCommand = new DelegateCommand(this.Reload, () => !IsLoading);
PrintCommand = new DelegateCommand(this.Print);
ZoomInCommand = new DelegateCommand(ZoomIn);
ZoomOutCommand = new DelegateCommand(ZoomOut);
ZoomResetCommand = new DelegateCommand(ZoomReset);
ViewSourceCommand = new DelegateCommand(this.ViewSource);
CleanupCommand = new DelegateCommand(Dispose);
StopCommand = new DelegateCommand(this.Stop);
CutCommand = new DelegateCommand(this.Cut);
CopyCommand = new DelegateCommand(this.Copy);
PasteCommand = new DelegateCommand(this.Paste);
SelectAllCommand = new DelegateCommand(this.SelectAll);
UndoCommand = new DelegateCommand(this.Undo);
RedoCommand = new DelegateCommand(this.Redo);
managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this, true);
disposables.Add(managedCefBrowserAdapter);
disposables.Add(new DisposableEventWrapper(this, ActualHeightProperty, OnActualSizeChanged));
disposables.Add(new DisposableEventWrapper(this, ActualWidthProperty, OnActualSizeChanged));
ResourceHandlerFactory = new DefaultResourceHandlerFactory();
BrowserSettings = new BrowserSettings();
PresentationSource.AddSourceChangedHandler(this, PresentationSourceChangedHandler);
}
示例8: OnHandleCreated
protected override void OnHandleCreated(EventArgs e)
{
base.OnHandleCreated(e);
managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this);
managedCefBrowserAdapter.CreateBrowser(BrowserSettings ?? new BrowserSettings(), Handle, Address);
}
示例9: WebView
public WebView()
{
Focusable = true;
FocusVisualStyle = null;
IsTabStop = true;
Dispatcher.BeginInvoke((Action)(() => WebBrowser = this));
Loaded += OnLoaded;
Unloaded += OnUnloaded;
this.IsVisibleChanged += OnIsVisibleChanged;
ToolTip = toolTip = new ToolTip();
toolTip.StaysOpen = true;
toolTip.Visibility = Visibility.Collapsed;
toolTip.Closed += OnTooltipClosed;
BackCommand = new DelegateCommand(Back, CanGoBack);
ForwardCommand = new DelegateCommand(Forward, CanGoForward);
ReloadCommand = new DelegateCommand(Reload, CanReload);
browserCore = new BrowserCore("about:blank");
browserCore.PropertyChanged += OnBrowserCorePropertyChanged;
managedCefBrowserAdapter = new ManagedCefBrowserAdapter(this);
managedCefBrowserAdapter.CreateOffscreenBrowser(BrowserSettings ?? new BrowserSettings());
disposables.Add(managedCefBrowserAdapter);
disposables.Add(new DisposableEventWrapper(this, ActualHeightProperty, OnActualSizeChanged));
disposables.Add(new DisposableEventWrapper(this, ActualWidthProperty, OnActualSizeChanged));
}
示例10: Dispose
protected override void Dispose(bool disposing)
{
Cef.RemoveDisposable(this);
if (disposing)
{
if (managedCefBrowserAdapter != null)
{
managedCefBrowserAdapter.Dispose();
managedCefBrowserAdapter = null;
}
}
base.Dispose(disposing);
}
示例11: Dispose
protected override void Dispose(bool disposing)
{
// Don't utilize any of the handlers anymore:
this.SetHandlersToNull();
Cef.RemoveDisposable(this);
if (disposing)
{
IsBrowserInitialized = false;
if (BrowserSettings != null)
{
BrowserSettings.Dispose();
BrowserSettings = null;
}
if (parentFormMessageInterceptor != null)
{
parentFormMessageInterceptor.Dispose();
parentFormMessageInterceptor = null;
}
if (managedCefBrowserAdapter != null)
{
managedCefBrowserAdapter.Dispose();
managedCefBrowserAdapter = null;
}
// Don't maintain a reference to event listeners anylonger:
LoadError = null;
FrameLoadStart = null;
FrameLoadEnd = null;
LoadingStateChanged = null;
ConsoleMessage = null;
StatusMessage = null;
AddressChanged = null;
TitleChanged = null;
IsBrowserInitializedChanged = null;
}
base.Dispose(disposing);
}
示例12: Dispose
protected override void Dispose(bool disposing)
{
// Don't utilize any of the handlers anymore:
DialogHandler = null;
JsDialogHandler = null;
KeyboardHandler = null;
RequestHandler = null;
DownloadHandler = null;
LifeSpanHandler = null;
MenuHandler = null;
DragHandler = null;
GeolocationHandler = null;
FocusHandler = null;
ResourceHandlerFactory = null;
Cef.RemoveDisposable(this);
if (disposing)
{
IsBrowserInitialized = false;
if (BrowserSettings != null)
{
BrowserSettings.Dispose();
BrowserSettings = null;
}
if (parentFormMessageInterceptor != null)
{
parentFormMessageInterceptor.Dispose();
parentFormMessageInterceptor = null;
}
if (managedCefBrowserAdapter != null)
{
managedCefBrowserAdapter.Dispose();
managedCefBrowserAdapter = null;
}
// Don't maintain a reference to event listeners anylonger:
LoadError = null;
FrameLoadStart = null;
FrameLoadEnd = null;
NavStateChanged = null;
ConsoleMessage = null;
StatusMessage = null;
AddressChanged = null;
TitleChanged = null;
IsBrowserInitializedChanged = null;
IsLoadingChanged = null;
}
base.Dispose(disposing);
}
示例13: Dispose
/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose(bool disposing)
{
// Don't reference event listeners any longer:
LoadError = null;
FrameLoadStart = null;
FrameLoadEnd = null;
ConsoleMessage = null;
BrowserInitialized = null;
StatusMessage = null;
LoadingStateChanged = null;
AddressChanged = null;
Cef.RemoveDisposable(this);
if (disposing)
{
browser = null;
IsBrowserInitialized = false;
if (Bitmap != null)
{
Bitmap.Dispose();
Bitmap = null;
}
if (BrowserSettings != null)
{
BrowserSettings.Dispose();
BrowserSettings = null;
}
if (managedCefBrowserAdapter != null)
{
if (!managedCefBrowserAdapter.IsDisposed)
{
managedCefBrowserAdapter.Dispose();
}
managedCefBrowserAdapter = null;
}
}
// Release reference to handlers, make sure this is done after we dispose managedCefBrowserAdapter
// otherwise the ILifeSpanHandler.DoClose will not be invoked. (More important in the WinForms version,
// we do it here for consistency)
this.SetHandlersToNull();
}
示例14: Dispose
protected virtual void Dispose(bool isdisposing)
{
Loaded -= OnLoaded;
Unloaded -= OnUnloaded;
GotKeyboardFocus -= OnGotKeyboardFocus;
LostKeyboardFocus -= OnLostKeyboardFocus;
IsVisibleChanged -= OnIsVisibleChanged;
Cef.RemoveDisposable(this);
RemoveSourceHook();
foreach (var disposable in disposables)
{
disposable.Dispose();
}
disposables.Clear();
UiThreadRunAsync(() => WebBrowser = null);
managedCefBrowserAdapter = null;
ConsoleMessage = null;
FrameLoadStart = null;
FrameLoadEnd = null;
LoadError = null;
}
示例15: Dispose
/// <summary>
/// Releases the unmanaged resources used by the <see cref="T:System.Windows.Forms.Control" /> and its child controls and optionally releases the managed resources.
/// </summary>
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
protected override void Dispose(bool disposing)
{
Cef.RemoveDisposable(this);
if (disposing)
{
browser = null;
IsBrowserInitialized = false;
if (BrowserSettings != null)
{
BrowserSettings.Dispose();
BrowserSettings = null;
}
if (parentFormMessageInterceptor != null)
{
parentFormMessageInterceptor.Dispose();
parentFormMessageInterceptor = null;
}
if (managedCefBrowserAdapter != null)
{
managedCefBrowserAdapter.Dispose();
managedCefBrowserAdapter = null;
}
// Don't maintain a reference to event listeners anylonger:
LoadError = null;
FrameLoadStart = null;
FrameLoadEnd = null;
LoadingStateChanged = null;
ConsoleMessage = null;
StatusMessage = null;
AddressChanged = null;
TitleChanged = null;
IsBrowserInitializedChanged = null;
}
// Release reference to handlers, make sure this is done after we dispose managedCefBrowserAdapter
// otherwise the ILifeSpanHandler.DoClose will not be invoked.
this.SetHandlersToNull();
base.Dispose(disposing);
}