Skip to content

Commit

Permalink
DYN-7531 Catch WebView2 initialization exception (#15685)
Browse files Browse the repository at this point in the history
  • Loading branch information
QilongTang authored Nov 27, 2024
1 parent 02b2f0e commit f840072
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions src/DynamoCoreWpf/Views/Core/DynamoView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1427,21 +1427,28 @@ private void LoadHomePage()
{
if (homePage == null && (startPage != null))
{
homePage = new UI.Views.HomePage();
homePage.DataContext = startPage;

var visibilityBinding = new System.Windows.Data.Binding
try
{
RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(DynamoView), 1),
Path = new PropertyPath("DataContext.ShowStartPage"),
Mode = BindingMode.OneWay,
Converter = new BooleanToVisibilityConverter(),
UpdateSourceTrigger = UpdateSourceTrigger.Explicit
};
homePage = new UI.Views.HomePage();
homePage.DataContext = startPage;

var visibilityBinding = new System.Windows.Data.Binding
{
RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(DynamoView), 1),
Path = new PropertyPath("DataContext.ShowStartPage"),
Mode = BindingMode.OneWay,
Converter = new BooleanToVisibilityConverter(),
UpdateSourceTrigger = UpdateSourceTrigger.Explicit
};

BindingOperations.SetBinding(homePage, UIElement.VisibilityProperty, visibilityBinding);
BindingOperations.SetBinding(homePage, UIElement.VisibilityProperty, visibilityBinding);

this.newHomePageContainer.Children.Add(homePage);
this.newHomePageContainer.Children.Add(homePage);
}
catch (Exception ex)
{
Log(ex.Message);
}
}
}

Expand Down

0 comments on commit f840072

Please sign in to comment.