Fixed minor bug in recently opened files list where changes were not reflected in UI.

This commit is contained in:
Tobias Erbshäußer
2020-06-18 17:14:26 +02:00
parent 6c3fa4bb2e
commit ee8d88146f
+5 -1
View File
@@ -1,6 +1,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@@ -40,7 +41,7 @@ namespace UCalc.Data
} }
} }
public class RecentlyOpenedList : ICollection<RecentlyOpenedItem> public class RecentlyOpenedList : ICollection<RecentlyOpenedItem>, INotifyCollectionChanged
{ {
private const int MaxCount = 10; private const int MaxCount = 10;
private readonly string _path; private readonly string _path;
@@ -79,6 +80,8 @@ namespace UCalc.Data
{ {
// Do nothing // Do nothing
} }
CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
} }
public IEnumerator<RecentlyOpenedItem> GetEnumerator() public IEnumerator<RecentlyOpenedItem> GetEnumerator()
@@ -136,5 +139,6 @@ namespace UCalc.Data
public int Count => _list.Count; public int Count => _list.Count;
public bool IsReadOnly => false; public bool IsReadOnly => false;
public event NotifyCollectionChangedEventHandler CollectionChanged;
} }
} }