| using System.Configuration; |
| using System.Data; |
| using System.IO; |
| using System.Reflection; |
| using System.Windows; |
| using CefSharp; |
| using CefSharp.Wpf; |
| using mdict.Services; |
|
|
| namespace mdict |
| { |
| |
| |
| |
| public partial class App : Application |
| { |
| protected override void OnStartup(StartupEventArgs e) |
| { |
| base.OnStartup(e); |
| InitializeCef(); |
| } |
|
|
| private void InitializeCef() |
| { |
| var settings = new CefSettings(); |
| |
| |
| settings.RegisterScheme(new CefCustomScheme |
| { |
| SchemeName = "mdx", |
| SchemeHandlerFactory = new MdxSchemeHandlerFactory(), |
| IsStandard = true, |
| IsSecure = true, |
| IsCorsEnabled = false |
| }); |
| |
| |
| string exePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty; |
| string cachePath = Path.Combine(exePath, "Cache"); |
| Directory.CreateDirectory(cachePath); |
| settings.CachePath = cachePath; |
|
|
| settings.Locale = "zh-CN"; |
|
|
| |
| settings.CefCommandLineArgs.Add("enable-gpu", "1"); |
| settings.CefCommandLineArgs.Add("enable-gpu-compositing", "1"); |
| |
| Cef.Initialize(settings); |
| } |
| } |
| } |
|
|