Skip to content

Commit

Permalink
DYN-6749: update recent files metadata (DynamoDS#15220)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnenov authored May 14, 2024
1 parent 001814e commit e563028
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/DynamoCoreWpf/Views/HomePage/HomePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ internal async void LoadingDone()
var recentFiles = startPage.RecentFiles;
if (recentFiles == null || !recentFiles.Any()) { return; }

// Subscribe to the DynamoViewModel refresh file changed event in order to refresh the Recent File metadata
// There is no way to track if the metadata has changed specifically, so we refresh in any change to the recent files
startPage.DynamoViewModel.RecentFiles.CollectionChanged += RecentFiles_CollectionChanged;

LoadGraphs(recentFiles);

var userLocale = CultureInfo.CurrentCulture.Name;
Expand All @@ -262,6 +266,11 @@ internal async void LoadingDone()
}
}

private void RecentFiles_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
LoadGraphs(startPage.RecentFiles);
}

#region FrontEnd Initialization Calls
/// <summary>
/// Sends graph data to react app
Expand Down Expand Up @@ -482,7 +491,11 @@ internal void ApplicationLoaded()
public void Dispose()
{
DataContextChanged -= OnDataContextChanged;
if(startPage != null) startPage.DynamoViewModel.PropertyChanged -= DynamoViewModel_PropertyChanged;
if (startPage != null)
{
startPage.DynamoViewModel.PropertyChanged -= DynamoViewModel_PropertyChanged;
startPage.DynamoViewModel.RecentFiles.CollectionChanged -= RecentFiles_CollectionChanged;
}

this.dynWebView.CoreWebView2.NewWindowRequested -= CoreWebView2_NewWindowRequested;

Expand Down

0 comments on commit e563028

Please sign in to comment.