File tree Expand file tree Collapse file tree 5 files changed +137
-11
lines changed Expand file tree Collapse file tree 5 files changed +137
-11
lines changed Original file line number Diff line number Diff line change 1717            <ColumnDefinition  Width =" *" 
1818        </Grid .ColumnDefinitions>
1919
20-         
21- 
2220        <wpfui : NavigationCompact 
2321            x : Name =" RootNavigation" 
2422            Grid.Column=" 0" 
7068
7169                <!--   Contains buttons responsible for maximizing, minimizing and closing the app. It also has a background colored strip that allows you to move the application around  --> 
7270                <wpfui : TitleBar 
73-                 x : Name =" RootTitleBar" 
74-                 Grid.Row=" 0" 
75-                 ForceShutdown =" False" 
76-                 MinimizeToTray =" False" 
77-                 ShowHelp =" False" 
78-                 UseSnapLayout =" True" 
79-                 Title =" Wishmaster" 
71+                      x : Name =" RootTitleBar" 
72+                      Grid.Row=" 0" 
73+                      ForceShutdown =" False" 
74+                      MinimizeToTray =" False" 
75+                      ShowHelp =" False" 
76+                      UseSnapLayout =" True" 
77+                      Title =" Wishmaster" 
8078                </wpfui : TitleBar >
8179
8280                <Grid  Grid.Row=" 1" 
Original file line number Diff line number Diff line change 55      xmlns : d =" http://schemas.microsoft.com/expression/blend/2008" 
66      xmlns : local =" clr-namespace:Wishmaster.Views.Pages" 
77      xmlns : wv2 =" clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf" 
8+       xmlns : wpfui =" clr-namespace:WPFUI.Controls;assembly=WPFUI" 
89      mc : Ignorable =" d" 
910      d : DesignHeight =" 400" d : DesignWidth =" 400" 
1011      Title =" BrowserPage" 
1112
1213    <Grid >
14+         <Grid .RowDefinitions>
15+             <RowDefinition  Height =" Auto" 
16+             <RowDefinition  Height =" *" 
17+         </Grid .RowDefinitions>
18+ 
19+         <Grid  Grid.Row=" 0" 
20+             <Grid .ColumnDefinitions>
21+                 <ColumnDefinition  Width =" 5*" 
22+                 <ColumnDefinition  Width =" *" 
23+             </Grid .ColumnDefinitions>
24+ 
25+             <TextBox  Grid.Column=" 0" x : Name =" AddressTextBox" Text =" https://google.com" 
26+             <Button  Grid.Column=" 1" Content =" Go" Click =" GoButton_Click" 
27+         </Grid >
28+ 
1329        <wv2 : WebView2  
30+             Grid.Row=" 1" 
1431            Name =" WebView" 
15-             Source =" http://localhost:5080/index.html" 
32+             Source =" https://google.com" 
33+             NavigationStarting =" WebView_NavigationStarting" 
34+             NavigationCompleted =" WebView_NavigationCompleted" 
1635        />
36+ 
37+         <Grid  x : Name =" LoadingOverlay" Background =" #C222" " 1" 
38+             <wpfui : ProgressRing  IsIndeterminate =" True" 
39+         </Grid >
1740    </Grid >
1841</Page >
Original file line number Diff line number Diff line change 1- using  System . Windows . Controls ; 
1+ using  System ; 
2+ using  System . Windows . Controls ; 
23
34namespace  Wishmaster . Views . Pages 
45{ 
@@ -7,6 +8,41 @@ public partial class BrowserPage : Page
78        public  BrowserPage ( ) 
89        { 
910            InitializeComponent ( ) ; 
11+             Loaded  +=  BrowserPage_Loaded ; 
12+         } 
13+ 
14+         private  void  BrowserPage_Loaded ( object  sender ,  System . Windows . RoutedEventArgs  e ) 
15+         { 
16+             WebView . Source  =  new  Uri ( AddressTextBox . Text ) ; 
17+         } 
18+ 
19+         private  void  GoButton_Click ( object  sender ,  System . Windows . RoutedEventArgs  e ) 
20+         { 
21+             try 
22+             { 
23+                 var  url  =  AddressTextBox . Text ; 
24+ 
25+                 if  ( string . IsNullOrWhiteSpace ( url ) ) 
26+                 { 
27+                     return ; 
28+                 } 
29+ 
30+                 WebView . Source  =  new  Uri ( AddressTextBox . Text ) ; 
31+             } 
32+             catch 
33+             { 
34+                 return ; 
35+             } 
36+         } 
37+ 
38+         private  void  WebView_NavigationStarting ( object  sender ,  Microsoft . Web . WebView2 . Core . CoreWebView2NavigationStartingEventArgs  e ) 
39+         { 
40+             LoadingOverlay . Visibility  =  System . Windows . Visibility . Visible ; 
41+         } 
42+ 
43+         private  void  WebView_NavigationCompleted ( object  sender ,  Microsoft . Web . WebView2 . Core . CoreWebView2NavigationCompletedEventArgs  e ) 
44+         { 
45+             LoadingOverlay . Visibility  =  System . Windows . Visibility . Hidden ; 
1046        } 
1147    } 
1248} 
Original file line number Diff line number Diff line change 1+ <UserControl  x : Class =" Wishmaster.Views.Shared.WebView" 
2+              xmlns =" http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
3+              xmlns : x =" http://schemas.microsoft.com/winfx/2006/xaml" 
4+              xmlns : mc =" http://schemas.openxmlformats.org/markup-compatibility/2006" 
5+              xmlns : d =" http://schemas.microsoft.com/expression/blend/2008" 
6+              xmlns : local =" clr-namespace:Wishmaster.Views.Shared" 
7+              xmlns : wv2 =" clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf" 
8+              xmlns : wpfui =" clr-namespace:WPFUI.Controls;assembly=WPFUI" 
9+              mc : Ignorable =" d" 
10+              d : DesignHeight =" 400" 
11+              d : DesignWidth =" 400" 
12+     <Grid >
13+ 
14+         <Grid .RowDefinitions>
15+             <RowDefinition  Height =" Auto" 
16+             <RowDefinition  Height =" *" 
17+         </Grid .RowDefinitions>
18+ 
19+         <Grid  Grid.Row=" 0" 
20+             <Grid .ColumnDefinitions>
21+                 <ColumnDefinition  Width =" 5*" 
22+                 <ColumnDefinition  Width =" *" 
23+             </Grid .ColumnDefinitions>
24+ 
25+             <TextBox  Grid.Column=" 0" Text =" https://google.com" 
26+             <Button  Grid.Column=" 1" Content =" Go" 
27+         </Grid >
28+ 
29+         <wv2 : WebView2  
30+             Grid.Row=" 1" 
31+             Name =" WebViewElement" 
32+             Source =" http://localhost:5080/index.html" 
33+         />
34+ 
35+         <Grid  x : Name =" LoadingOverlay" Background =" #C222" " 1" 
36+             <wpfui : ProgressRing  IsIndeterminate =" True" 
37+         </Grid >
38+     </Grid >
39+ </UserControl >
Original file line number Diff line number Diff line change 1+ using  System ; 
2+ using  System . Collections . Generic ; 
3+ using  System . Text ; 
4+ using  System . Threading . Tasks ; 
5+ using  System . Windows ; 
6+ using  System . Windows . Controls ; 
7+ using  System . Windows . Data ; 
8+ using  System . Windows . Documents ; 
9+ using  System . Windows . Input ; 
10+ using  System . Windows . Media ; 
11+ using  System . Windows . Media . Imaging ; 
12+ using  System . Windows . Navigation ; 
13+ using  System . Windows . Shapes ; 
14+ 
15+ namespace  Wishmaster . Views . Shared 
16+ { 
17+     public  partial  class  WebView  :  UserControl 
18+     { 
19+         public  WebView ( ) 
20+         { 
21+             InitializeComponent ( ) ; 
22+             Loaded  +=  WebView_Loaded ; 
23+         } 
24+ 
25+         private  async  void  WebView_Loaded ( object  sender ,  RoutedEventArgs  e ) 
26+         { 
27+             await  WebViewElement . EnsureCoreWebView2Async ( ) ; 
28+         } 
29+     } 
30+ } 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments