CEF framework uses Highlights


CEF framework uses highlights:

参考:
〓https: //github.com/NetDimension/NanUI/wiki/%E5%BC%80%E5%A7%8B%E4%BD%BF%E7%94%A8NanUI
〓https: //github.com/ NetDimension / NanUI / wiki /% E6% 89% 93% E5% 8C% 85% E5% B9% B6% E4% BD% BF% E7% 94% A8% E5% 86% 85% E5% B5% 8C% E5 % BC% 8F% E7% 9a% 84HTML-CSS-JS% E8% B5% 84% E6% BA% 90
〓https: //github.com/NetDimension/NanUI/wiki/%E4%BD%BF%E7% 94% A8% E7% BD% 91% E9% A1% B5% E6% 9D% A5% E8% æ% is% E8% æ% A1% E6% 95% B4% E4% B8% AA% E7% AA% 97% E5% 8F% A3
〓https: //github.com/NetDimension/NanUI/wiki/%E5%A6%82%E4%BD%95%E5%AE%9E%E7%8E%B0C%23%E4 % B8% 8EJavascript% E7% 9a% 84% E7% 9b% B8% E4% BA% 92% E9% 80% 9a% E4% BF% A1


Preface: NetDimension.NanUI integrated development framework CEF is limited to under VS2017 development


-------------------------------------------------- ----------
001 references NetDimension.NanUI.dll
-------------------------------- ----------------------------
002, will automatically load the corresponding frame by a CEF NuGet add a package manager, that will be needed to download CEF framework
------------------------------------------------ ------------
003, resources need to be placed in the frame CEF application root directory among:
(1) adaptive x86 [32 bit] or x64 [64 bit] operating environment, the "fx "directory in the root directory is placed
(2) if a specific operating environment, it is necessary to" "directory, FX
except" all directories x64 "and" x86 "is placed on the outside of all the root directory,
and then the corresponding Operating environment directory also placed in the root directory
---------------------------------------- --------------------
004, using Bootstrap.Load CEF framework of an initialization operation
, such as: logging is disabled, default language, cross-domain security is disabled detection
sample code:
/ / CEF architecture specified directory and file structure, and initialize the CEF
var loadFlag = Bootstrap.Loa D (Settings => {
// disable logging
settings.LogSeverity = Chromium.CfxLogSeverity.Disable;

Chinese language designated as the default // current CEF environment
settings.AcceptLanguageList = "ZH-the CN";
settings.Locale = "ZH-the CN";
}, the commandLine => {
// add the disable-web-security switch is in the startup parameters disable detecting cross-domain security
commandLine.AppendSwitch ( "Web-security-disable");
});
IF (loadFlag) {
the Application.Run (the MainForm new new ());
}
the else {
! MessageBox.Show ( "Sorry CEF framework not . normal loading, check the configuration setting, confirmation and then try again "," the system prompts "MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
----------------- -------------------------------------------
005, if it is a specific operation environments, you need to use the following initialization method, at the same time,
add a platform disposed in VS's configuration Manager, the project will target platform is specified as a platform needs.
Sample code:
// designate corresponding system architecture, if the designated parameter CEF directory structure is omitted, the need to manually adjust CEF directory structure.
var loadFlag = Bootstrap.
IF (loadFlag)
{
the Application.Run (the MainForm new new ());
}
---------------------------------- --------------------------
006, the WinForm form the inherited form of the type of change NanUI
(1) Formium NanUI using the borderless window body engine
(2) WinFormium NanUI using the native form style
(3) inherited form constructor, passing the required webpage address that appears to open the CEF framework NanUI trip
sample code:
// native form style
public partial class the MainForm: WinFormium {
public the MainForm ()
: Base ( "http://cn.bing.com") {
the InitializeComponent ();
}
}
// no window frame engine
public partial class the MainForm: Formium {
public the MainForm ()
: Base ( "http://cn.bing.com") {
the InitializeComponent ();
}
}
-------------------------------------------------- ----------
007 added in a project application manifest file: app.manifest,
and canceled ** enable subject and Windows common controls dialog box (Windows XP and later versions) ** section the comment:

<! - enable subject and Windows common controls dialog box (Windows XP and later) ->
<dependency>
<dependentAssembly>
<assemblyIdentity
of the type = "win32"
name = "Microsoft.Windows.Common- Controls "
Version =" 6.0.0.0 "
processorArchitecture =" * "
the publicKeyToken =" 6595b64144ccf1df "
Language =" * "
/>
</ dependentAssembly>
</ dependency>

and then the list of items found in the applications tab in the project properties, and specify where the content is just the app.manifest,
re-run the project, then the web page with the title attribute all tags will be able to properly display a tooltip
-------------------------- ----------------------------------
008, the WEB front-end HTML / CSS / JS and other files compiled as an embedded resource to the project, both to improve the loading speed, while avoiding malicious modification
------------------ ------------------------------------------
009, for use Bootstrap.Load when CEF framework initialization operation, you need to register a good project embedded resource information used by
the example code:

IF (loadFlag) {
// register embedded resources, and specify a fake domain name my.resource.local specified resource
Bootstrap.RegisterAssemblyResources (System.Reflection.Assembly.GetExecutingAssembly (), domainName: " my.resource.local");

// load separate resource
var separateAssembly = System.Reflection.Assembly.LoadFile (System.IO.Path.Combine (Application.StartupPath, "EmbeddedResourcesInSplitAssembly.dll"));
// external register embedded resources and resources for the specified specify a fake domain name separate.resource.local
Bootstrap.RegisterAssemblyResources (separateAssembly, domainName: "separate.resource.local");

Application.Run (new new MainForm ());
}

can register multiple programs embedded in the project resources, but must specify a different domain (domainName parameters), when the domain name by using the pointing mode.
-------------------------------------------------- ----------
010 after the completion of the embedded resource files, we can browse the web as usual,
according to a specified false domain name plus an embedded resource directory hierarchy path, we can successfully use in our NanUI embedded resource
(1) via http: index.html file //my.resource.local/index.html access the main project
(2) http: //separate.resource.local/index.html accessing external assembly EmbeddedResourcesInSplitAssembly.dll index.html file in the

use of sample code project:

public partial class the MainForm: Formium
{
public the MainForm ()
: Base ( "HTTP: //my.resource.local/index.html")
{
the InitializeComponent ();
}
}
--------------------------- ---------------------------------

 

Guess you like

Origin www.cnblogs.com/Jeely/p/11077421.html
Recommended