|
@@ -12,6 +12,7 @@ using System.Threading;
|
|
|
using System.Runtime.InteropServices;
|
|
|
using System.Collections.Generic;
|
|
|
using Xilium.CefGlue.Common.Handlers;
|
|
|
+using fis.Win.Dev.Utilities;
|
|
|
|
|
|
namespace fis
|
|
|
{
|
|
@@ -30,7 +31,7 @@ namespace fis
|
|
|
ExtendClientAreaTitleBarHeightHint = -1;
|
|
|
MainThreadSyncContext = SynchronizationContext.Current;
|
|
|
#if DEBUG
|
|
|
- this.AttachDevTools();
|
|
|
+ this.AttachDevTools();
|
|
|
#endif
|
|
|
}
|
|
|
|
|
@@ -42,7 +43,8 @@ namespace fis
|
|
|
internal void ChangeContent(string host, Dictionary<string, string> keyValuePairs)
|
|
|
{
|
|
|
var browserContainer = this.FindControl<Border>("BrowserBorder");
|
|
|
-
|
|
|
+ _host = host;
|
|
|
+ _parameters = keyValuePairs;
|
|
|
var parameter = "";
|
|
|
var index = 0;
|
|
|
foreach (var p in _parameters)
|
|
@@ -58,6 +60,8 @@ namespace fis
|
|
|
browserContainer.Child = _browser;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 初始化参数和组件
|
|
|
/// </summary>
|
|
@@ -68,7 +72,6 @@ namespace fis
|
|
|
_parameters = dictionary;
|
|
|
_host = host;
|
|
|
InitializeComponent();
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void InitializeComponent()
|
|
@@ -93,9 +96,10 @@ namespace fis
|
|
|
{
|
|
|
throw new NotSupportedException($"Platform {Environment.OSVersion.Platform} is not suppoorted.");
|
|
|
}
|
|
|
+
|
|
|
if (_host.Contains(ShellConfig.Instance.DistHost))
|
|
|
{
|
|
|
- var appHandler = new FileSystemHostHandler(ShellConfig.Instance.DistHost + "/index.html", ShellConfig.Instance.DistResourcePath);
|
|
|
+ var appHandler = new FileSystemHostHandler(ShellConfig.Instance.DistHost , ShellConfig.Instance.DistResourcePath);
|
|
|
var handler = new HostRequestHandler();
|
|
|
handler.RegisterHostHandler(appHandler);
|
|
|
_browser = new AvaloniaCefBrowser
|
|
@@ -137,15 +141,9 @@ namespace fis
|
|
|
_browser.BrowserInitialized += () =>
|
|
|
{
|
|
|
#if DEBUG
|
|
|
- _browser!.ShowDeveloperTools();
|
|
|
+ _browser!.ShowDeveloperTools();
|
|
|
#endif
|
|
|
};
|
|
|
- browserContainer.Child = _browser;
|
|
|
- WindowStartupLocation = WindowStartupLocation.Manual;
|
|
|
- Position = new PixelPoint();
|
|
|
- WindowState = WindowState.Maximized;
|
|
|
- MinWidth = 1366;
|
|
|
- MinHeight = 768;
|
|
|
var language = CultureInfo.CurrentCulture.Name;
|
|
|
if (_title != null)
|
|
|
{
|
|
@@ -158,6 +156,18 @@ namespace fis
|
|
|
_title.Text = "FLYINSONO";
|
|
|
}
|
|
|
}
|
|
|
+ if (_title != null)
|
|
|
+ {
|
|
|
+ var scriptObj = new FisBrowserScriptObject(_title, platformService);
|
|
|
+ _browser.RegisterJavascriptObject(scriptObj, "FisShellApi");
|
|
|
+ }
|
|
|
+ browserContainer.Child = _browser;
|
|
|
+ WindowStartupLocation = WindowStartupLocation.Manual;
|
|
|
+ Position = new PixelPoint();
|
|
|
+ WindowState = WindowState.Maximized;
|
|
|
+ MinWidth = 1366;
|
|
|
+ MinHeight = 768;
|
|
|
+
|
|
|
var assembly = Assembly.GetExecutingAssembly();
|
|
|
Stream? resourceStream = null;
|
|
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|