Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
lindexi_gd
Uno
提交
8517bd79
U
Uno
项目概览
lindexi_gd
/
Uno
11 个月 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
Uno
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
8517bd79
编写于
6月 05, 2023
作者:
E
Elie Bariche
提交者:
GitHub
6月 05, 2023
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #12489 from unoplatform/dev/eb/csp
perf: Misc bindings V
上级
c63e841e
41cd6209
变更
42
隐藏空白更改
内联
并排
Showing
42 changed file
with
328 addition
and
55 deletion
+328
-55
src/Uno.UI/UI/Xaml/Application.wasm.cs
src/Uno.UI/UI/Xaml/Application.wasm.cs
+3
-0
src/Uno.UI/UI/Xaml/Controls/FocusVisual/SystemFocusVisual.wasm.cs
...UI/UI/Xaml/Controls/FocusVisual/SystemFocusVisual.wasm.cs
+3
-0
src/Uno.UI/UI/Xaml/DragDrop/DragDropExtension.wasm.cs
src/Uno.UI/UI/Xaml/DragDrop/DragDropExtension.wasm.cs
+6
-1
src/Uno.UI/UI/Xaml/FontFamilyLoader.wasm.cs
src/Uno.UI/UI/Xaml/FontFamilyLoader.wasm.cs
+9
-1
src/Uno.UI/ts/Clipboard.ts
src/Uno.UI/ts/Clipboard.ts
+7
-3
src/Uno.UI/ts/Windows/ApplicationModel/DataTransfer/DragAndDropExtension.ts
...ows/ApplicationModel/DataTransfer/DragAndDropExtension.ts
+5
-1
src/Uno.UI/ts/Windows/Devices/Sensors/Gyrometer.ts
src/Uno.UI/ts/Windows/Devices/Sensors/Gyrometer.ts
+5
-1
src/Uno.UI/ts/Windows/Graphics/Display/DisplayInformation.ts
src/Uno.UI/ts/Windows/Graphics/Display/DisplayInformation.ts
+14
-6
src/Uno.UI/ts/Windows/Helpers/Theming/SystemThemeHelper.ts
src/Uno.UI/ts/Windows/Helpers/Theming/SystemThemeHelper.ts
+5
-1
src/Uno.UI/ts/Windows/Networking/Connectivity/NetworkInformation.ts
.../ts/Windows/Networking/Connectivity/NetworkInformation.ts
+7
-3
src/Uno.UI/ts/Windows/Storage/NativeStorageItem.ts
src/Uno.UI/ts/Windows/Storage/NativeStorageItem.ts
+5
-1
src/Uno.UI/ts/Windows/Storage/StorageFolder.ts
src/Uno.UI/ts/Windows/Storage/StorageFolder.ts
+7
-3
src/Uno.UI/ts/Windows/UI/Core/SystemNavigationManager.ts
src/Uno.UI/ts/Windows/UI/Core/SystemNavigationManager.ts
+3
-1
src/Uno.UI/ts/Windows/UI/Xaml/Application.ts
src/Uno.UI/ts/Windows/UI/Xaml/Application.ts
+5
-1
src/Uno.UI/ts/Windows/UI/Xaml/Input/FocusVisual.ts
src/Uno.UI/ts/Windows/UI/Xaml/Input/FocusVisual.ts
+6
-2
src/Uno.UI/ts/Windows/UI/Xaml/Media/FontFamily.ts
src/Uno.UI/ts/Windows/UI/Xaml/Media/FontFamily.ts
+12
-4
src/Uno.UWP/ApplicationModel/Calls/PhoneCallManager.Interop.wasm.cs
...P/ApplicationModel/Calls/PhoneCallManager.Interop.wasm.cs
+0
-13
src/Uno.UWP/ApplicationModel/Calls/PhoneCallManager.wasm.cs
src/Uno.UWP/ApplicationModel/Calls/PhoneCallManager.wasm.cs
+6
-1
src/Uno.UWP/ApplicationModel/DataTransfer/Clipboard.wasm.cs
src/Uno.UWP/ApplicationModel/DataTransfer/Clipboard.wasm.cs
+5
-0
src/Uno.UWP/Devices/Sensors/Gyrometer.Interop.wasm.cs
src/Uno.UWP/Devices/Sensors/Gyrometer.Interop.wasm.cs
+11
-1
src/Uno.UWP/Devices/Sensors/Gyrometer.wasm.cs
src/Uno.UWP/Devices/Sensors/Gyrometer.wasm.cs
+19
-0
src/Uno.UWP/Devices/Sensors/LightSensor.Interop.wasm.cs
src/Uno.UWP/Devices/Sensors/LightSensor.Interop.wasm.cs
+11
-1
src/Uno.UWP/Devices/Sensors/LightSensor.wasm.cs
src/Uno.UWP/Devices/Sensors/LightSensor.wasm.cs
+14
-0
src/Uno.UWP/Devices/Sensors/Magnetometer.Interop.wasm.cs
src/Uno.UWP/Devices/Sensors/Magnetometer.Interop.wasm.cs
+12
-1
src/Uno.UWP/Devices/Sensors/Magnetometer.wasm.cs
src/Uno.UWP/Devices/Sensors/Magnetometer.wasm.cs
+14
-0
src/Uno.UWP/Graphics/Display/DisplayInformation.wasm.cs
src/Uno.UWP/Graphics/Display/DisplayInformation.wasm.cs
+8
-0
src/Uno.UWP/Helpers/ProtocolActivation.wasm.cs
src/Uno.UWP/Helpers/ProtocolActivation.wasm.cs
+17
-1
src/Uno.UWP/Helpers/Theming/SystemThemeHelper.wasm.cs
src/Uno.UWP/Helpers/Theming/SystemThemeHelper.wasm.cs
+5
-0
src/Uno.UWP/Networking/Connectivity/NetworkInformation.Interop.wasm.cs
...etworking/Connectivity/NetworkInformation.Interop.wasm.cs
+8
-1
src/Uno.UWP/Networking/Connectivity/NetworkInformation.wasm.cs
...no.UWP/Networking/Connectivity/NetworkInformation.wasm.cs
+15
-0
src/Uno.UWP/Phone/Devices/Notification/VibrationDevice.Interop.wasm.cs
...hone/Devices/Notification/VibrationDevice.Interop.wasm.cs
+8
-1
src/Uno.UWP/Phone/Devices/Notification/VibrationDevice.wasm.cs
...no.UWP/Phone/Devices/Notification/VibrationDevice.wasm.cs
+12
-0
src/Uno.UWP/Security/ExchangeActiveSyncProvisioning/EasClientDeviceInformation.Interop.wasm.cs
...ncProvisioning/EasClientDeviceInformation.Interop.wasm.cs
+3
-1
src/Uno.UWP/Security/ExchangeActiveSyncProvisioning/EasClientDeviceInformation.wasm.cs
...ActiveSyncProvisioning/EasClientDeviceInformation.wasm.cs
+10
-1
src/Uno.UWP/Storage/NativeStorageItem.wasm.cs
src/Uno.UWP/Storage/NativeStorageItem.wasm.cs
+8
-1
src/Uno.UWP/Storage/StorageFolder.wasm.cs
src/Uno.UWP/Storage/StorageFolder.wasm.cs
+7
-0
src/Uno.UWP/System/Launcher.Interop.wasm.cs
src/Uno.UWP/System/Launcher.Interop.wasm.cs
+3
-1
src/Uno.UWP/System/Launcher.wasm.cs
src/Uno.UWP/System/Launcher.wasm.cs
+4
-0
src/Uno.UWP/UI/Core/SystemNavigationManager.Interop.wasm.cs
src/Uno.UWP/UI/Core/SystemNavigationManager.Interop.wasm.cs
+6
-1
src/Uno.UWP/UI/Core/SystemNavigationManager.wasm.cs
src/Uno.UWP/UI/Core/SystemNavigationManager.wasm.cs
+13
-0
src/Uno.UWP/UI/Popups/MessageDialog.Interop.wasm.cs
src/Uno.UWP/UI/Popups/MessageDialog.Interop.wasm.cs
+3
-1
src/Uno.UWP/UI/Popups/MessageDialog.wasm.cs
src/Uno.UWP/UI/Popups/MessageDialog.wasm.cs
+4
-0
未找到文件。
src/Uno.UI/UI/Xaml/Application.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -60,6 +60,9 @@ namespace Windows.UI.Xaml
ObserveApplicationVisibility
();
}
#if NET7_0_OR_GREATER
[
JSExport
]
#endif
public
static
int
DispatchVisibilityChange
(
bool
isVisible
)
{
var
application
=
Windows
.
UI
.
Xaml
.
Application
.
Current
;
...
...
src/Uno.UI/UI/Xaml/Controls/FocusVisual/SystemFocusVisual.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -39,6 +39,9 @@ internal partial class SystemFocusVisual : Control
#endif
}
#if NET7_0_OR_GREATER
[
JSExport
]
#endif
public
static
int
DispatchNativePositionChange
(
int
focusVisualId
)
{
var
element
=
UIElement
.
GetElementFromHandle
(
focusVisualId
)
as
SystemFocusVisual
;
...
...
src/Uno.UI/UI/Xaml/DragDrop/DragDropExtension.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -31,6 +31,8 @@ using Uno.UI.Xaml;
using
System.Diagnostics.CodeAnalysis
;
#if NET7_0_OR_GREATER
using
System.Runtime.InteropServices.JavaScript
;
using
NativeMethods
=
__Windows
.
ApplicationModel
.
DataTransfer
.
DragDrop
.
Core
.
DragDropExtension
.
NativeMethods
;
#endif
...
...
@@ -39,7 +41,7 @@ using NativeMethods = __Windows.ApplicationModel.DataTransfer.DragDrop.Core.Drag
namespace
Windows.ApplicationModel.DataTransfer.DragDrop.Core
{
internal
class
DragDropExtension
:
IDragDropExtension
internal
partial
class
DragDropExtension
:
IDragDropExtension
{
private
const
long
_textReadTimeoutTicks
=
10
*
TimeSpan
.
TicksPerSecond
;
...
...
@@ -124,6 +126,9 @@ namespace Windows.ApplicationModel.DataTransfer.DragDrop.Core
[
Preserve
]
[
EditorBrowsable
(
EditorBrowsableState
.
Never
)]
#if NET7_0_OR_GREATER
[
JSExport
]
#endif
public
static
string
OnNativeDropEvent
()
{
try
...
...
src/Uno.UI/UI/Xaml/FontFamilyLoader.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -9,6 +9,8 @@ using Uno.UI.DataBinding;
using
Windows.Storage.Helpers
;
#if NET7_0_OR_GREATER
using
System.Runtime.InteropServices.JavaScript
;
using
NativeMethods
=
__Windows
.
UI
.
Xaml
.
Media
.
FontFamilyLoader
.
NativeMethods
;
#endif
...
...
@@ -17,7 +19,7 @@ namespace Windows.UI.Xaml.Media;
/// <summary>
/// WebAssembly-specific asynchronous font loader
/// </summary>
internal
class
FontFamilyLoader
internal
partial
class
FontFamilyLoader
{
private
static
readonly
Dictionary
<
FontFamily
,
FontFamilyLoader
>
_loaders
=
new
(
new
FontFamilyComparer
());
private
static
readonly
Dictionary
<
string
,
FontFamilyLoader
>
_loadersFromCssName
=
new
();
...
...
@@ -61,6 +63,9 @@ internal class FontFamilyLoader
/// <summary>
/// Typescript-invoked method to notify that a font has been loaded properly
/// </summary>
#if NET7_0_OR_GREATER
[
JSExport
]
#endif
internal
static
void
NotifyFontLoaded
(
string
cssFontName
)
{
if
(
_loadersFromCssName
.
TryGetValue
(
cssFontName
,
out
var
loader
))
...
...
@@ -101,6 +106,9 @@ internal class FontFamilyLoader
/// <summary>
/// Typescript-invoked method to notify that a font failed to load properly
/// </summary>
#if NET7_0_OR_GREATER
[
JSExport
]
#endif
internal
static
void
NotifyFontLoadFailed
(
string
cssFontName
)
{
if
(
_loadersFromCssName
.
TryGetValue
(
cssFontName
,
out
var
loader
))
...
...
src/Uno.UI/ts/Clipboard.ts
浏览文件 @
8517bd79
...
...
@@ -60,9 +60,13 @@ namespace Uno.Utils {
private
static
onClipboardChanged
()
{
if
(
!
Clipboard
.
dispatchContentChanged
)
{
Clipboard
.
dispatchContentChanged
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Windows.ApplicationModel.DataTransfer.Clipboard:DispatchContentChanged
"
);
if
((
<
any
>
globalThis
).
DotnetExports
!==
undefined
)
{
Clipboard
.
dispatchContentChanged
=
(
<
any
>
globalThis
).
DotnetExports
.
Uno
.
Windows
.
ApplicationModel
.
DataTransfer
.
Clipboard
.
DispatchContentChanged
;
}
else
{
Clipboard
.
dispatchContentChanged
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Windows.ApplicationModel.DataTransfer.Clipboard:DispatchContentChanged
"
);
}
}
Clipboard
.
dispatchContentChanged
();
}
...
...
src/Uno.UI/ts/Windows/ApplicationModel/DataTransfer/DragAndDropExtension.ts
浏览文件 @
8517bd79
...
...
@@ -15,7 +15,11 @@
public
static
enable
(
pArgs
:
number
):
void
{
if
(
!
DragDropExtension
.
_dispatchDropEventMethod
)
{
DragDropExtension
.
_dispatchDropEventMethod
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno.UI] Windows.ApplicationModel.DataTransfer.DragDrop.Core.DragDropExtension:OnNativeDropEvent
"
);
if
((
<
any
>
globalThis
).
DotnetExports
!==
undefined
)
{
DragDropExtension
.
_dispatchDropEventMethod
=
(
<
any
>
globalThis
).
DotnetExports
.
UnoUI
.
Windows
.
ApplicationModel
.
DataTransfer
.
DragDrop
.
Core
.
DragDropExtension
.
OnNativeDropEvent
;
}
else
{
DragDropExtension
.
_dispatchDropEventMethod
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno.UI] Windows.ApplicationModel.DataTransfer.DragDrop.Core.DragDropExtension:OnNativeDropEvent
"
);
}
}
if
(
DragDropExtension
.
_current
)
{
...
...
src/Uno.UI/ts/Windows/Devices/Sensors/Gyrometer.ts
浏览文件 @
8517bd79
...
...
@@ -17,7 +17,11 @@ namespace Windows.Devices.Sensors {
public
static
initialize
():
boolean
{
try
{
if
(
typeof
window
.
Gyroscope
===
"
function
"
)
{
this
.
dispatchReading
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Windows.Devices.Sensors.Gyrometer:DispatchReading
"
);
if
((
<
any
>
globalThis
).
DotnetExports
!==
undefined
)
{
this
.
dispatchReading
=
(
<
any
>
globalThis
).
DotnetExports
.
Uno
.
Windows
.
Devices
.
Sensors
.
Gyrometer
.
DispatchReading
;
}
else
{
this
.
dispatchReading
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Windows.Devices.Sensors.Gyrometer:DispatchReading
"
);
}
let
GyroscopeClass
:
any
=
window
.
Gyroscope
;
this
.
gyroscope
=
new
GyroscopeClass
({
referenceFrame
:
"
device
"
});
return
true
;
...
...
src/Uno.UI/ts/Windows/Graphics/Display/DisplayInformation.ts
浏览文件 @
8517bd79
...
...
@@ -142,9 +142,13 @@
const
currentDpi
=
window
.
devicePixelRatio
;
if
(
Math
.
abs
(
DisplayInformation
.
lastDpi
-
currentDpi
)
>
0.001
)
{
if
(
DisplayInformation
.
dispatchDpiChanged
==
null
)
{
DisplayInformation
.
dispatchDpiChanged
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Windows.Graphics.Display.DisplayInformation:DispatchDpiChanged
"
);
if
((
<
any
>
globalThis
).
DotnetExports
!==
undefined
)
{
DisplayInformation
.
dispatchDpiChanged
=
(
<
any
>
globalThis
).
DotnetExports
.
Uno
.
Windows
.
Graphics
.
Display
.
DisplayInformation
.
DispatchDpiChanged
;
}
else
{
DisplayInformation
.
dispatchDpiChanged
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Windows.Graphics.Display.DisplayInformation:DispatchDpiChanged
"
);
}
}
DisplayInformation
.
dispatchDpiChanged
(
currentDpi
);
}
...
...
@@ -153,9 +157,13 @@
private
static
onOrientationChange
()
{
if
(
DisplayInformation
.
dispatchOrientationChanged
==
null
)
{
DisplayInformation
.
dispatchOrientationChanged
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Windows.Graphics.Display.DisplayInformation:DispatchOrientationChanged
"
);
if
((
<
any
>
globalThis
).
DotnetExports
!==
undefined
)
{
DisplayInformation
.
dispatchOrientationChanged
=
(
<
any
>
globalThis
).
DotnetExports
.
Uno
.
Windows
.
Graphics
.
Display
.
DisplayInformation
.
DispatchOrientationChanged
;
}
else
{
DisplayInformation
.
dispatchOrientationChanged
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Windows.Graphics.Display.DisplayInformation:DispatchOrientationChanged
"
);
}
}
DisplayInformation
.
dispatchOrientationChanged
(
window
.
screen
.
orientation
.
type
);
}
...
...
src/Uno.UI/ts/Windows/Helpers/Theming/SystemThemeHelper.ts
浏览文件 @
8517bd79
...
...
@@ -17,7 +17,11 @@ namespace Uno.Helpers.Theming {
public
static
observeSystemTheme
()
{
if
(
!
SystemThemeHelper
.
dispatchThemeChange
)
{
SystemThemeHelper
.
dispatchThemeChange
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Uno.Helpers.Theming.SystemThemeHelper:DispatchSystemThemeChange
"
);
if
((
<
any
>
globalThis
).
DotnetExports
!==
undefined
)
{
SystemThemeHelper
.
dispatchThemeChange
=
(
<
any
>
globalThis
).
DotnetExports
.
Uno
.
Uno
.
Helpers
.
Theming
.
SystemThemeHelper
.
DispatchSystemThemeChange
;
}
else
{
SystemThemeHelper
.
dispatchThemeChange
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Uno.Helpers.Theming.SystemThemeHelper:DispatchSystemThemeChange
"
);
}
}
if
(
window
.
matchMedia
)
{
...
...
src/Uno.UI/ts/Windows/Networking/Connectivity/NetworkInformation.ts
浏览文件 @
8517bd79
...
...
@@ -15,9 +15,13 @@
public
static
networkStatusChanged
()
{
if
(
NetworkInformation
.
dispatchStatusChanged
==
null
)
{
NetworkInformation
.
dispatchStatusChanged
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Windows.Networking.Connectivity.NetworkInformation:DispatchStatusChanged
"
);
if
((
<
any
>
globalThis
).
DotnetExports
!==
undefined
)
{
NetworkInformation
.
dispatchStatusChanged
=
(
<
any
>
globalThis
).
DotnetExports
.
Uno
.
Windows
.
Networking
.
Connectivity
.
NetworkInformation
.
DispatchStatusChanged
;
}
else
{
NetworkInformation
.
dispatchStatusChanged
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Windows.Networking.Connectivity.NetworkInformation:DispatchStatusChanged
"
);
}
}
NetworkInformation
.
dispatchStatusChanged
();
}
...
...
src/Uno.UI/ts/Windows/Storage/NativeStorageItem.ts
浏览文件 @
8517bd79
...
...
@@ -75,7 +75,11 @@
private
static
generateGuids
(
count
:
number
):
string
[]
{
if
(
!
NativeStorageItem
.
generateGuidBinding
)
{
NativeStorageItem
.
generateGuidBinding
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Uno.Storage.NativeStorageItem:GenerateGuids
"
);
if
((
<
any
>
globalThis
).
DotnetExports
!==
undefined
)
{
NativeStorageItem
.
generateGuidBinding
=
(
<
any
>
globalThis
).
DotnetExports
.
Uno
.
Uno
.
Storage
.
NativeStorageItem
.
GenerateGuids
;
}
else
{
NativeStorageItem
.
generateGuidBinding
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Uno.Storage.NativeStorageItem:GenerateGuids
"
);
}
}
const
guids
=
NativeStorageItem
.
generateGuidBinding
(
count
);
...
...
src/Uno.UI/ts/Windows/Storage/StorageFolder.ts
浏览文件 @
8517bd79
...
...
@@ -69,9 +69,13 @@ namespace Windows.Storage {
private
static
onStorageInitialized
()
{
if
(
!
StorageFolder
.
dispatchStorageInitialized
)
{
StorageFolder
.
dispatchStorageInitialized
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Windows.Storage.StorageFolder:DispatchStorageInitialized
"
);
if
((
<
any
>
globalThis
).
DotnetExports
!==
undefined
)
{
StorageFolder
.
dispatchStorageInitialized
=
(
<
any
>
globalThis
).
DotnetExports
.
Uno
.
Windows
.
Storage
.
StorageFolder
.
DispatchStorageInitialized
;
}
else
{
StorageFolder
.
dispatchStorageInitialized
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Windows.Storage.StorageFolder:DispatchStorageInitialized
"
);
}
}
StorageFolder
.
dispatchStorageInitialized
();
}
...
...
src/Uno.UI/ts/Windows/UI/Core/SystemNavigationManager.ts
浏览文件 @
8517bd79
...
...
@@ -14,7 +14,9 @@
constructor
()
{
var
that
=
this
;
var
dispatchBackRequest
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Windows.UI.Core.SystemNavigationManager:DispatchBackRequest
"
);
var
dispatchBackRequest
=
(
<
any
>
globalThis
).
DotnetExports
!==
undefined
?
(
<
any
>
globalThis
).
DotnetExports
.
Uno
.
Windows
.
UI
.
Core
.
SystemNavigationManager
.
DispatchBackRequest
:
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno] Windows.UI.Core.SystemNavigationManager:DispatchBackRequest
"
);
window
.
history
.
replaceState
(
0
,
document
.
title
,
null
);
window
.
addEventListener
(
"
popstate
"
,
function
(
evt
)
{
...
...
src/Uno.UI/ts/Windows/UI/Xaml/Application.ts
浏览文件 @
8517bd79
...
...
@@ -5,7 +5,11 @@
public
static
observeVisibility
()
{
if
(
!
Application
.
dispatchVisibilityChange
)
{
Application
.
dispatchVisibilityChange
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno.UI] Windows.UI.Xaml.Application:DispatchVisibilityChange
"
);
if
((
<
any
>
globalThis
).
DotnetExports
!==
undefined
)
{
Application
.
dispatchVisibilityChange
=
(
<
any
>
globalThis
).
DotnetExports
.
UnoUI
.
Windows
.
UI
.
Xaml
.
Application
.
DispatchVisibilityChange
;
}
else
{
Application
.
dispatchVisibilityChange
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno.UI] Windows.UI.Xaml.Application:DispatchVisibilityChange
"
);
}
}
if
(
document
.
onvisibilitychange
!==
undefined
)
{
...
...
src/Uno.UI/ts/Windows/UI/Xaml/Input/FocusVisual.ts
浏览文件 @
8517bd79
...
...
@@ -25,8 +25,12 @@
private
static
onDocumentScroll
()
{
if
(
!
FocusVisual
.
dispatchPositionChange
)
{
FocusVisual
.
dispatchPositionChange
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno.UI] Uno.UI.Xaml.Controls.SystemFocusVisual:DispatchNativePositionChange
"
);
if
((
<
any
>
globalThis
).
DotnetExports
!==
undefined
)
{
FocusVisual
.
dispatchPositionChange
=
(
<
any
>
globalThis
).
DotnetExports
.
UnoUI
.
Uno
.
UI
.
Xaml
.
Controls
.
SystemFocusVisual
.
DispatchNativePositionChange
;
}
else
{
FocusVisual
.
dispatchPositionChange
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno.UI] Uno.UI.Xaml.Controls.SystemFocusVisual:DispatchNativePositionChange
"
);
}
}
FocusVisual
.
updatePosition
();
...
...
src/Uno.UI/ts/Windows/UI/Xaml/Media/FontFamily.ts
浏览文件 @
8517bd79
...
...
@@ -49,8 +49,12 @@
private
static
notifyFontLoaded
(
fontFamilyName
:
string
):
void
{
if
(
!
FontFamily
.
managedNotifyFontLoaded
)
{
FontFamily
.
managedNotifyFontLoaded
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno.UI] Windows.UI.Xaml.Media.FontFamilyLoader:NotifyFontLoaded
"
);
if
((
<
any
>
globalThis
).
DotnetExports
!==
undefined
)
{
FontFamily
.
managedNotifyFontLoaded
=
(
<
any
>
globalThis
).
DotnetExports
.
UnoUI
.
Windows
.
UI
.
Xaml
.
Media
.
FontFamilyLoader
.
NotifyFontLoaded
;
}
else
{
FontFamily
.
managedNotifyFontLoaded
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno.UI] Windows.UI.Xaml.Media.FontFamilyLoader:NotifyFontLoaded
"
);
}
}
FontFamily
.
managedNotifyFontLoaded
(
fontFamilyName
);
...
...
@@ -59,8 +63,12 @@
private
static
notifyFontLoadFailed
(
fontFamilyName
:
string
):
void
{
if
(
!
FontFamily
.
managedNotifyFontLoadFailed
)
{
FontFamily
.
managedNotifyFontLoadFailed
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno.UI] Windows.UI.Xaml.Media.FontFamilyLoader:NotifyFontLoadFailed
"
);
if
((
<
any
>
globalThis
).
DotnetExports
!==
undefined
)
{
FontFamily
.
managedNotifyFontLoadFailed
=
(
<
any
>
globalThis
).
DotnetExports
.
UnoUI
.
Windows
.
UI
.
Xaml
.
Media
.
FontFamilyLoader
.
NotifyFontLoadFailed
;
}
else
{
FontFamily
.
managedNotifyFontLoadFailed
=
(
<
any
>
Module
).
mono_bind_static_method
(
"
[Uno.UI] Windows.UI.Xaml.Media.FontFamilyLoader:NotifyFontLoadFailed
"
);
}
}
FontFamily
.
managedNotifyFontLoadFailed
(
fontFamilyName
);
...
...
src/Uno.UWP/ApplicationModel/Calls/PhoneCallManager.Interop.wasm.cs
已删除
100644 → 0
浏览文件 @
c63e841e
#
if
NET7_0_OR_GREATER
using
System.Runtime.InteropServices.JavaScript
;
namespace
__Windows.ApplicationModel.Calls
{
internal
partial
class
PhoneCallManager
{
internal
static
partial
class
NativeMethods
{
}
}
}
#
endif
\ No newline at end of file
src/Uno.UWP/ApplicationModel/Calls/PhoneCallManager.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -4,7 +4,7 @@ using System.Collections.Generic;
using
System.Text
;
#if NET7_0_OR_GREATER
using
NativeMethods
=
__Windows
.
ApplicationModel
.
Calls
.
PhoneCallManag
er
.
NativeMethods
;
using
NativeMethods
=
__Windows
.
__System
.
Launch
er
.
NativeMethods
;
#endif
namespace
Windows.ApplicationModel.Calls
...
...
@@ -14,8 +14,13 @@ namespace Windows.ApplicationModel.Calls
private
static
void
ShowPhoneCallUIImpl
(
string
phoneNumber
,
string
displayName
)
{
var
uri
=
new
Uri
(
$"tel:
{
phoneNumber
}
"
);
#if NET7_0_OR_GREATER
NativeMethods
.
Open
(
uri
.
AbsoluteUri
);
#else
var
command
=
$"Uno.UI.WindowManager.current.open(\"
{
uri
.
AbsoluteUri
}
\");"
;
Uno
.
Foundation
.
WebAssemblyRuntime
.
InvokeJS
(
command
);
#endif
}
}
}
...
...
src/Uno.UWP/ApplicationModel/DataTransfer/Clipboard.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -9,6 +9,8 @@ using Uno.Foundation;
using
System.Threading
;
#if NET7_0_OR_GREATER
using
System.Runtime.InteropServices.JavaScript
;
using
NativeMethods
=
__Windows
.
ApplicationModel
.
DataTransfer
.
Clipboard
.
NativeMethods
;
#endif
...
...
@@ -91,6 +93,9 @@ namespace Windows.ApplicationModel.DataTransfer
#endif
}
#if NET7_0_OR_GREATER
[
JSExport
]
#endif
public
static
int
DispatchContentChanged
()
{
OnContentChanged
();
...
...
src/Uno.UWP/Devices/Sensors/Gyrometer.Interop.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -7,7 +7,17 @@ namespace __Windows.Devices.Sensors
{
internal
static
partial
class
NativeMethods
{
private
const
string
JsType
=
"globalThis.Windows.Devices.Sensors.Gyrometer"
;
[
JSImport
(
$"
{
JsType
}
.initialize"
)]
internal
static
partial
bool
Initialize
();
[
JSImport
(
$"
{
JsType
}
.startReading"
)]
internal
static
partial
void
StartReading
();
[
JSImport
(
$"
{
JsType
}
.stopReading"
)]
internal
static
partial
void
StopReading
();
}
}
}
#
endif
\ No newline at end of file
#endif
src/Uno.UWP/Devices/Sensors/Gyrometer.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -5,6 +5,8 @@ using Uno;
using
Uno.Devices.Sensors.Helpers
;
#if NET7_0_OR_GREATER
using
System.Runtime.InteropServices.JavaScript
;
using
NativeMethods
=
__Windows
.
Devices
.
Sensors
.
Gyrometer
.
NativeMethods
;
#endif
...
...
@@ -12,7 +14,9 @@ namespace Windows.Devices.Sensors
{
public
partial
class
Gyrometer
{
#if !NET7_0_OR_GREATER
private
const
string
JsType
=
"Windows.Devices.Sensors.Gyrometer"
;
#endif
private
DateTimeOffset
_lastReading
=
DateTimeOffset
.
MinValue
;
...
...
@@ -24,6 +28,9 @@ namespace Windows.Devices.Sensors
private
static
Gyrometer
TryCreateInstance
()
{
#if NET7_0_OR_GREATER
return
NativeMethods
.
Initialize
()
?
new
()
:
null
;
#else
var
command
=
$"
{
JsType
}
.initialize()"
;
var
initialized
=
Uno
.
Foundation
.
WebAssemblyRuntime
.
InvokeJS
(
command
);
if
(
bool
.
Parse
(
initialized
)
==
true
)
...
...
@@ -31,18 +38,27 @@ namespace Windows.Devices.Sensors
return
new
Gyrometer
();
}
return
null
;
#endif
}
private
void
StartReading
()
{
#if NET7_0_OR_GREATER
NativeMethods
.
StartReading
();
#else
var
command
=
$"
{
JsType
}
.startReading()"
;
Uno
.
Foundation
.
WebAssemblyRuntime
.
InvokeJS
(
command
);
#endif
}
private
void
StopReading
()
{
#if NET7_0_OR_GREATER
NativeMethods
.
StopReading
();
#else
var
command
=
$"
{
JsType
}
.stopReading()"
;
Uno
.
Foundation
.
WebAssemblyRuntime
.
InvokeJS
(
command
);
#endif
}
/// <summary>
...
...
@@ -56,6 +72,9 @@ namespace Windows.Devices.Sensors
/// <param name="y">AngularVelocity Y in radians/s</param>
/// <param name="z">AngularVelocity Z in radians/s</param>
/// <returns>0 - needed to bind method from WASM</returns>
#if NET7_0_OR_GREATER
[
JSExport
]
#endif
public
static
int
DispatchReading
(
float
x
,
float
y
,
float
z
)
{
if
(
_instance
==
null
)
...
...
src/Uno.UWP/Devices/Sensors/LightSensor.Interop.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -7,7 +7,17 @@ namespace __Windows.Devices.Sensors
{
internal
static
partial
class
NativeMethods
{
private
const
string
JsType
=
"globalThis.Windows.Devices.Sensors.LightSensor"
;
[
JSImport
(
$"
{
JsType
}
.initialize"
)]
internal
static
partial
bool
Initialize
();
[
JSImport
(
$"
{
JsType
}
.startReading"
)]
internal
static
partial
void
StartReading
();
[
JSImport
(
$"
{
JsType
}
.stopReading"
)]
internal
static
partial
void
StopReading
();
}
}
}
#
endif
\ No newline at end of file
#endif
src/Uno.UWP/Devices/Sensors/LightSensor.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -11,10 +11,15 @@ namespace Windows.Devices.Sensors
{
public
partial
class
LightSensor
{
#if !NET7_0_OR_GREATER
private
const
string
JsType
=
"Windows.Devices.Sensors.LightSensor"
;
#endif
private
static
LightSensor
?
TryCreateInstance
()
{
#if NET7_0_OR_GREATER
return
NativeMethods
.
Initialize
()
?
new
()
:
null
;
#else
var
command
=
$"
{
JsType
}
.initialize()"
;
var
initialized
=
Uno
.
Foundation
.
WebAssemblyRuntime
.
InvokeJS
(
command
);
if
(
bool
.
Parse
(
initialized
)
==
true
)
...
...
@@ -22,18 +27,27 @@ namespace Windows.Devices.Sensors
return
new
LightSensor
();
}
return
null
;
#endif
}
private
void
StartReading
()
{
#if NET7_0_OR_GREATER
NativeMethods
.
StartReading
();
#else
var
command
=
$"
{
JsType
}
.startReading()"
;
Uno
.
Foundation
.
WebAssemblyRuntime
.
InvokeJS
(
command
);
#endif
}
private
void
StopReading
()
{
#if NET7_0_OR_GREATER
NativeMethods
.
StopReading
();
#else
var
command
=
$"
{
JsType
}
.stopReading()"
;
Uno
.
Foundation
.
WebAssemblyRuntime
.
InvokeJS
(
command
);
#endif
}
public
static
int
DispatchReading
(
float
lux
)
...
...
src/Uno.UWP/Devices/Sensors/Magnetometer.Interop.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -7,7 +7,18 @@ namespace __Windows.Devices.Sensors
{
internal
static
partial
class
NativeMethods
{
private
const
string
JsType
=
"globalThis.Windows.Devices.Sensors.Magnetometer"
;
[
JSImport
(
$"
{
JsType
}
.initialize"
)]
internal
static
partial
bool
Initialize
();
[
JSImport
(
$"
{
JsType
}
.startReading"
)]
internal
static
partial
void
StartReading
();
[
JSImport
(
$"
{
JsType
}
.stopReading"
)]
internal
static
partial
void
StopReading
();
}
}
}
#
endif
\ No newline at end of file
#endif
src/Uno.UWP/Devices/Sensors/Magnetometer.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -12,7 +12,9 @@ namespace Windows.Devices.Sensors
{
public
partial
class
Magnetometer
{
#if !NET7_0_OR_GREATER
private
const
string
JsType
=
"Windows.Devices.Sensors.Magnetometer"
;
#endif
private
DateTimeOffset
_lastReading
=
DateTimeOffset
.
MinValue
;
...
...
@@ -24,6 +26,9 @@ namespace Windows.Devices.Sensors
private
static
Magnetometer
TryCreateInstance
()
{
#if NET7_0_OR_GREATER
return
NativeMethods
.
Initialize
()
?
new
()
:
null
;
#else
var
command
=
$"
{
JsType
}
.initialize()"
;
var
initialized
=
Uno
.
Foundation
.
WebAssemblyRuntime
.
InvokeJS
(
command
);
if
(
bool
.
Parse
(
initialized
)
==
true
)
...
...
@@ -31,18 +36,27 @@ namespace Windows.Devices.Sensors
return
new
Magnetometer
();
}
return
null
;
#endif
}
private
void
StartReading
()
{
#if NET7_0_OR_GREATER
NativeMethods
.
StartReading
();
#else
var
command
=
$"
{
JsType
}
.startReading()"
;
Uno
.
Foundation
.
WebAssemblyRuntime
.
InvokeJS
(
command
);
#endif
}
private
void
StopReading
()
{
#if NET7_0_OR_GREATER
NativeMethods
.
StopReading
();
#else
var
command
=
$"
{
JsType
}
.stopReading()"
;
Uno
.
Foundation
.
WebAssemblyRuntime
.
InvokeJS
(
command
);
#endif
}
/// <summary>
...
...
src/Uno.UWP/Graphics/Display/DisplayInformation.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -7,6 +7,8 @@ using Uno;
using
Uno.Foundation
;
#if NET7_0_OR_GREATER
using
System.Runtime.InteropServices.JavaScript
;
using
NativeMethods
=
__Windows
.
Graphics
.
Display
.
DisplayInformation
.
NativeMethods
;
#endif
...
...
@@ -22,6 +24,9 @@ namespace Windows.Graphics.Display
private
const
string
JsType
=
"Windows.Graphics.Display.DisplayInformation"
;
#endif
#if NET7_0_OR_GREATER
[
JSExport
]
#endif
public
static
int
DispatchDpiChanged
()
{
if
(
_lazyInstance
.
IsValueCreated
)
...
...
@@ -31,6 +36,9 @@ namespace Windows.Graphics.Display
return
0
;
}
#if NET7_0_OR_GREATER
[
JSExport
]
#endif
public
static
int
DispatchOrientationChanged
()
{
if
(
_lazyInstance
.
IsValueCreated
)
...
...
src/Uno.UWP/Helpers/ProtocolActivation.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -7,9 +7,13 @@ using System.Web;
using
Uno.Extensions
;
using
Uno.Foundation.Logging
;
#if NET7_0_OR_GREATER
using
System.Runtime.InteropServices.JavaScript
;
#endif
namespace
Uno.Helpers
{
public
static
class
ProtocolActivation
public
static
partial
class
ProtocolActivation
{
internal
const
string
QueryKey
=
"unoprotocolactivation"
;
...
...
@@ -72,8 +76,12 @@ namespace Uno.Helpers
uriString
+=
"%s"
;
// register scheme
#if NET7_0_OR_GREATER
NativeMethods
.
RegisterProtocolHandler
(
scheme
,
uriString
,
prompt
);
#else
var
initialized
=
Uno
.
Foundation
.
WebAssemblyRuntime
.
InvokeJS
(
$"navigator.registerProtocolHandler('
{
scheme
}
', '
{
uriString
}
' , '
{
prompt
.
Replace
(
"'"
,
"\\'"
)}
')"
);
#endif
}
internal
static
bool
TryParseActivationUri
(
string
queryArguments
,
out
Uri
uri
)
...
...
@@ -107,6 +115,14 @@ namespace Uno.Helpers
// arguments did not contain activation URI or it could not be parsed
return
false
;
}
#if NET7_0_OR_GREATER
internal
static
partial
class
NativeMethods
{
[
JSImport
(
"globalThis.navigator.registerProtocolHandler"
)]
internal
static
partial
void
RegisterProtocolHandler
(
string
scheme
,
string
uri
,
string
prompt
);
}
#endif
}
}
#endif
src/Uno.UWP/Helpers/Theming/SystemThemeHelper.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -6,6 +6,8 @@ using Uno.Foundation;
using
Uno.Foundation.Logging
;
#if NET7_0_OR_GREATER
using
System.Runtime.InteropServices.JavaScript
;
using
NativeMethods
=
__Uno
.
Helpers
.
Theming
.
SystemThemeHelper
.
NativeMethods
;
#endif
...
...
@@ -54,6 +56,9 @@ internal static partial class SystemThemeHelper
#endif
}
#if NET7_0_OR_GREATER
[
JSExport
]
#endif
public
static
int
DispatchSystemThemeChange
()
{
RefreshSystemTheme
();
...
...
src/Uno.UWP/Networking/Connectivity/NetworkInformation.Interop.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -7,7 +7,14 @@ namespace __Windows.Networking.Connectivity
{
internal
static
partial
class
NativeMethods
{
private
const
string
JsType
=
"globalThis.Windows.Networking.Connectivity.NetworkInformation"
;
[
JSImport
(
$"
{
JsType
}
.startStatusChanged"
)]
internal
static
partial
void
StartStatusChanged
();
[
JSImport
(
$"
{
JsType
}
.stopStatusChanged"
)]
internal
static
partial
void
StopStatusChanged
();
}
}
}
#
endif
\ No newline at end of file
#endif
src/Uno.UWP/Networking/Connectivity/NetworkInformation.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -7,6 +7,8 @@ using System.Threading.Tasks;
using
Uno
;
#if NET7_0_OR_GREATER
using
System.Runtime.InteropServices.JavaScript
;
using
NativeMethods
=
__Windows
.
Networking
.
Connectivity
.
NetworkInformation
.
NativeMethods
;
#endif
...
...
@@ -14,20 +16,33 @@ namespace Windows.Networking.Connectivity
{
public
partial
class
NetworkInformation
{
#if !NET7_0_OR_GREATER
private
const
string
JsType
=
"Windows.Networking.Connectivity.NetworkInformation"
;
#endif
private
static
void
StartNetworkStatusChanged
()
{
#if NET7_0_OR_GREATER
NativeMethods
.
StartStatusChanged
();
#else
var
command
=
$"
{
JsType
}
.startStatusChanged()"
;
Uno
.
Foundation
.
WebAssemblyRuntime
.
InvokeJS
(
command
);
#endif
}
private
static
void
StopNetworkStatusChanged
()
{
#if NET7_0_OR_GREATER
NativeMethods
.
StopStatusChanged
();
#else
var
command
=
$"
{
JsType
}
.stopStatusChanged()"
;
Uno
.
Foundation
.
WebAssemblyRuntime
.
InvokeJS
(
command
);
#endif
}
#if NET7_0_OR_GREATER
[
JSExport
]
#endif
public
static
int
DispatchStatusChanged
()
{
OnNetworkStatusChanged
();
...
...
src/Uno.UWP/Phone/Devices/Notification/VibrationDevice.Interop.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -7,7 +7,14 @@ namespace __Windows.Phone.Devices.Notification
{
internal
static
partial
class
NativeMethods
{
private
const
string
JsType
=
"globalThis.Windows.Phone.Devices.Notification.VibrationDevice"
;
[
JSImport
(
$"
{
JsType
}
.initialize"
)]
internal
static
partial
bool
Initialize
();
[
JSImport
(
$"
{
JsType
}
.vibrate"
)]
internal
static
partial
void
Vibrate
(
string
duration
);
}
}
}
#
endif
\ No newline at end of file
#endif
src/Uno.UWP/Phone/Devices/Notification/VibrationDevice.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -11,7 +11,10 @@ namespace Windows.Phone.Devices.Notification
{
public
partial
class
VibrationDevice
{
#if !NET7_0_OR_GREATER
private
const
string
JsType
=
"Windows.Phone.Devices.Notification.VibrationDevice"
;
#endif
private
static
VibrationDevice
_instance
;
private
static
bool
_initializationAttempted
;
...
...
@@ -23,12 +26,17 @@ namespace Windows.Phone.Devices.Notification
{
if
(!
_initializationAttempted
&&
_instance
==
null
)
{
#if NET7_0_OR_GREATER
_instance
=
NativeMethods
.
Initialize
()
?
new
()
:
null
;
#else
var
command
=
$"
{
JsType
}
.initialize()"
;
var
initialized
=
Uno
.
Foundation
.
WebAssemblyRuntime
.
InvokeJS
(
command
);
if
(
bool
.
Parse
(
initialized
)
==
true
)
{
_instance
=
new
VibrationDevice
();
}
#endif
_initializationAttempted
=
true
;
}
return
_instance
;
...
...
@@ -42,8 +50,12 @@ namespace Windows.Phone.Devices.Notification
private
void
WasmVibrate
(
TimeSpan
duration
)
{
#if NET7_0_OR_GREATER
NativeMethods
.
Vibrate
(
$"
{(
long
)
duration
.
TotalMilliseconds
}
"
);
#else
var
command
=
$"
{
JsType
}
.vibrate(\"
{(
long
)
duration
.
TotalMilliseconds
}
\");"
;
Uno
.
Foundation
.
WebAssemblyRuntime
.
InvokeJS
(
command
);
#endif
}
}
}
...
...
src/Uno.UWP/Security/ExchangeActiveSyncProvisioning/EasClientDeviceInformation.Interop.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -7,7 +7,9 @@ namespace __Windows.Security.ExchangeActiveSyncProvisioning
{
internal
static
partial
class
NativeMethods
{
[
JSImport
(
"globalThis.Windows.System.Profile.AnalyticsVersionInfo.getUserAgent"
)]
internal
static
partial
string
GetUserAgent
();
}
}
}
#
endif
\ No newline at end of file
#endif
src/Uno.UWP/Security/ExchangeActiveSyncProvisioning/EasClientDeviceInformation.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -9,7 +9,10 @@ namespace Windows.Security.ExchangeActiveSyncProvisioning
public
partial
class
EasClientDeviceInformation
{
private
const
string
BrowserVersionFallback
=
"Unknown"
;
#if !NET7_0_OR_GREATER
private
const
string
JsType
=
"Windows.System.Profile.AnalyticsVersionInfo"
;
#endif
partial
void
Initialize
()
{
...
...
@@ -19,7 +22,13 @@ namespace Windows.Security.ExchangeActiveSyncProvisioning
private
string
GetUserAgent
()
{
var
userAgent
=
InvokeJS
(
JsType
+
".getUserAgent()"
);
var
userAgent
=
#if NET7_0_OR_GREATER
NativeMethods
.
GetUserAgent
();
#else
InvokeJS
(
JsType
+
".getUserAgent()"
);
#endif
if
(!
string
.
IsNullOrEmpty
(
userAgent
))
{
return
userAgent
;
...
...
src/Uno.UWP/Storage/NativeStorageItem.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -3,12 +3,19 @@
using
System
;
using
System.Linq
;
#if NET7_0_OR_GREATER
using
System.Runtime.InteropServices.JavaScript
;
#endif
namespace
Uno.Storage
{
public
class
NativeStorageItem
public
partial
class
NativeStorageItem
{
private
const
string
GuidSplit
=
";"
;
#if NET7_0_OR_GREATER
[
JSExport
]
#endif
public
static
string
GenerateGuids
(
int
count
)
=>
string
.
Join
(
GuidSplit
,
Enumerable
.
Range
(
0
,
count
).
Select
(
i
=>
Guid
.
NewGuid
().
ToString
()));
}
}
src/Uno.UWP/Storage/StorageFolder.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -9,6 +9,10 @@ using Uno.Extensions;
using
System.Threading.Tasks
;
using
Uno.Foundation.Logging
;
#if NET7_0_OR_GREATER
using
System.Runtime.InteropServices.JavaScript
;
#endif
namespace
Windows.Storage
{
partial
class
StorageFolder
...
...
@@ -54,6 +58,9 @@ namespace Windows.Storage
public
string
[]
Paths
;
}
#if NET7_0_OR_GREATER
[
JSExport
]
#endif
internal
static
void
DispatchStorageInitialized
()
{
if
(
typeof
(
StorageFolder
).
Log
().
IsEnabled
(
Uno
.
Foundation
.
Logging
.
LogLevel
.
Debug
))
...
...
src/Uno.UWP/System/Launcher.Interop.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -7,7 +7,9 @@ namespace __Windows.__System
{
internal
static
partial
class
NativeMethods
{
[
JSImport
(
"globalThis.Uno.UI.WindowManager.current.open"
)]
internal
static
partial
string
Open
(
string
url
);
}
}
}
#
endif
\ No newline at end of file
#endif
src/Uno.UWP/System/Launcher.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -13,8 +13,12 @@ namespace Windows.System
{
public
static
Task
<
bool
>
LaunchUriPlatformAsync
(
Uri
uri
)
{
#if NET7_0_OR_GREATER
var
result
=
NativeMethods
.
Open
(
uri
.
OriginalString
);
#else
var
command
=
$"Uno.UI.WindowManager.current.open(\"
{
uri
.
OriginalString
}
\");"
;
var
result
=
WebAssemblyRuntime
.
InvokeJS
(
command
);
#endif
return
Task
.
FromResult
(
result
==
"True"
);
}
}
...
...
src/Uno.UWP/UI/Core/SystemNavigationManager.Interop.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -7,7 +7,12 @@ namespace __Windows.UI.Core
{
internal
static
partial
class
NativeMethods
{
[
JSImport
(
"globalThis.Windows.UI.Core.SystemNavigationManager.current.disable"
)]
internal
static
partial
void
Disable
();
[
JSImport
(
"globalThis.Windows.UI.Core.SystemNavigationManager.current.enable"
)]
internal
static
partial
void
Enable
();
}
}
}
#
endif
\ No newline at end of file
#endif
src/Uno.UWP/UI/Core/SystemNavigationManager.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -5,6 +5,8 @@ using Uno;
using
Uno.Foundation
;
#if NET7_0_OR_GREATER
using
System.Runtime.InteropServices.JavaScript
;
using
NativeMethods
=
__Windows
.
UI
.
Core
.
SystemNavigationManager
.
NativeMethods
;
#endif
...
...
@@ -17,17 +19,28 @@ namespace Windows.UI.Core
switch
(
visibility
)
{
case
AppViewBackButtonVisibility
.
Visible
:
#if NET7_0_OR_GREATER
NativeMethods
.
Enable
();
#else
WebAssemblyRuntime
.
InvokeJS
(
"Windows.UI.Core.SystemNavigationManager.current.enable();"
);
#endif
break
;
case
AppViewBackButtonVisibility
.
Collapsed
:
default
:
// Disabled value is not present in currently supported UWP API, but should be mapped to collapsed
#if NET7_0_OR_GREATER
NativeMethods
.
Disable
();
#else
WebAssemblyRuntime
.
InvokeJS
(
"Windows.UI.Core.SystemNavigationManager.current.disable();"
);
#endif
break
;
}
}
[
Preserve
]
#if NET7_0_OR_GREATER
[
JSExport
]
#endif
public
static
bool
DispatchBackRequest
()
=>
GetForCurrentView
().
RequestBack
();
}
}
src/Uno.UWP/UI/Popups/MessageDialog.Interop.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -7,7 +7,9 @@ namespace __Windows.UI.Popups
{
internal
static
partial
class
NativeMethods
{
[
JSImport
(
"globalThis.alert"
)]
internal
static
partial
void
Alert
(
string
message
);
}
}
}
#
endif
\ No newline at end of file
#endif
src/Uno.UWP/UI/Popups/MessageDialog.wasm.cs
浏览文件 @
8517bd79
...
...
@@ -23,8 +23,12 @@ public partial class MessageDialog
{
VisualTreeHelperProxy
.
CloseAllFlyouts
();
#if NET7_0_OR_GREATER
NativeMethods
.
Alert
(
Content
);
#else
var
command
=
$"Uno.UI.WindowManager.current.alert(\"
{
Uno
.
Foundation
.
WebAssemblyRuntime
.
EscapeJs
(
Content
)}
\");"
;
Uno
.
Foundation
.
WebAssemblyRuntime
.
InvokeJS
(
command
);
#endif
return
AsyncOperation
.
FromTask
<
IUICommand
>(
ct
=>
Task
.
FromResult
<
IUICommand
>(
new
UICommand
(
"OK"
))
// TODO: Localize (PBI 28711)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录