File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -158,15 +158,17 @@ public static void ApplyTheme(string value)
158158 } ;
159159 }
160160
161+ public static string WebViewUserDataFolder { get ; } =
162+ Path . Join ( Path . GetTempPath ( ) , "UniGetUI" , "WebView" ) ;
163+
161164 private static void SetUpWebViewUserDataFolder ( )
162165 {
163166 try
164167 {
165- string webViewPath = Path . Join ( Path . GetTempPath ( ) , "UniGetUI" , "WebView" ) ;
166- if ( ! Directory . Exists ( webViewPath ) )
167- Directory . CreateDirectory ( webViewPath ) ;
168+ if ( ! Directory . Exists ( WebViewUserDataFolder ) )
169+ Directory . CreateDirectory ( WebViewUserDataFolder ) ;
168170
169- Environment . SetEnvironmentVariable ( "WEBVIEW2_USER_DATA_FOLDER" , webViewPath ) ;
171+ Environment . SetEnvironmentVariable ( "WEBVIEW2_USER_DATA_FOLDER" , WebViewUserDataFolder ) ;
170172 }
171173 catch ( Exception e )
172174 {
Original file line number Diff line number Diff line change 1+ using Avalonia . Controls ;
2+ using Avalonia . Platform ;
3+
4+ namespace UniGetUI . Avalonia . Views . Controls ;
5+
6+ public sealed class UniGetUiWebView : NativeWebView
7+ {
8+ public UniGetUiWebView ( )
9+ {
10+ EnvironmentRequested += ( _ , args ) =>
11+ {
12+ if ( args is WindowsWebView2EnvironmentRequestedEventArgs winArgs )
13+ winArgs . UserDataFolder = App . WebViewUserDataFolder ;
14+ } ;
15+ }
16+ }
Original file line number Diff line number Diff line change 44 xmlns : automation =" clr-namespace:Avalonia.Automation;assembly=Avalonia.Controls"
55 xmlns : vm =" using:UniGetUI.Avalonia.ViewModels.Pages"
66 xmlns : controls =" using:UniGetUI.Avalonia.Views.Controls"
7- xmlns : wv =" using:Avalonia.Controls"
87 xmlns : t =" using:UniGetUI.Avalonia.MarkupExtensions"
98 xmlns : d =" http://schemas.microsoft.com/expression/blend/2008"
109 xmlns : mc =" http://schemas.openxmlformats.org/markup-compatibility/2006"
7574
7675 <!-- WebView -->
7776 <Border x : Name =" WebViewBorder" Grid.Row=" 2" CornerRadius =" 6" ClipToBounds =" True" >
78- <wv : NativeWebView x : Name =" WebViewControl" />
77+ <controls : UniGetUiWebView x : Name =" WebViewControl" />
7978 </Border >
8079
8180 <!-- Linux fallback -->
Original file line number Diff line number Diff line change 33 xmlns : x =" http://schemas.microsoft.com/winfx/2006/xaml"
44 xmlns : automation =" clr-namespace:Avalonia.Automation;assembly=Avalonia.Controls"
55 xmlns : vm =" using:UniGetUI.Avalonia.ViewModels.Pages"
6- xmlns : wv =" using:Avalonia.Controls"
6+ xmlns : controls =" using:UniGetUI. Avalonia.Views .Controls"
77 xmlns : t =" using:UniGetUI.Avalonia.MarkupExtensions"
88 xmlns : d =" http://schemas.microsoft.com/expression/blend/2008"
99 xmlns : mc =" http://schemas.openxmlformats.org/markup-compatibility/2006"
3636
3737 <!-- WebView -->
3838 <Border x : Name =" WebViewBorder" Grid.Row=" 2" CornerRadius =" 6" ClipToBounds =" True" >
39- <wv : NativeWebView x : Name =" WebViewControl" />
39+ <controls : UniGetUiWebView x : Name =" WebViewControl" />
4040 </Border >
4141
4242 <!-- Linux fallback -->
You can’t perform that action at this time.
0 commit comments