This repository was archived by the owner on Nov 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree
adrilight/View/SettingsWindowComponents Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020 </UserControl .Resources>
2121 <Grid >
2222 <materialDesign : Card Margin =" 4 4 4 4" Width =" 900" VerticalAlignment =" Stretch" Height =" auto" >
23- <WebBrowser x : Name =" browser" ></WebBrowser >
23+ <WebBrowser x : Name =" browser" Navigating = " Browser_Navigating " ></WebBrowser >
2424 </materialDesign : Card >
2525 </Grid >
2626</UserControl >
Original file line number Diff line number Diff line change 11using adrilight . ViewModel ;
22using System ;
33using System . Collections . Generic ;
4+ using System . Diagnostics ;
45using System . Linq ;
56using System . Text ;
67using System . Threading . Tasks ;
@@ -21,10 +22,13 @@ namespace adrilight.View.SettingsWindowComponents
2122 /// </summary>
2223 public partial class WhatsNew : UserControl
2324 {
25+ public SettingsViewModel SettingsViewModel { get ; }
26+
2427 public WhatsNew ( SettingsViewModel settingsViewModel )
2528 {
2629 InitializeComponent ( ) ;
27- browser . Source = settingsViewModel . WhatsNewUrl ;
30+ SettingsViewModel = settingsViewModel ?? throw new ArgumentNullException ( nameof ( settingsViewModel ) ) ;
31+ browser . Source = SettingsViewModel . WhatsNewUrl ;
2832 }
2933
3034
@@ -44,5 +48,16 @@ public WhatsNewSetupSelectableViewPart(Lazy<WhatsNew> lazyContent)
4448
4549 public object Content => lazyContent . Value ;
4650 }
51+
52+ private void Browser_Navigating ( object sender , NavigatingCancelEventArgs e )
53+ {
54+ var isWhatsNewUrl = e . Uri == SettingsViewModel . WhatsNewUrl ;
55+
56+ if ( ! isWhatsNewUrl )
57+ {
58+ e . Cancel = true ;
59+ Process . Start ( e . Uri . AbsoluteUri ) ;
60+ }
61+ }
4762 }
4863}
You can’t perform that action at this time.
0 commit comments