Skip to content

Commit

Permalink
Merge pull request #247 from runceel/main
Browse files Browse the repository at this point in the history
v7.8.1
  • Loading branch information
runceel authored Mar 11, 2021
2 parents 8852ef1 + dde1ba4 commit c69fcd4
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Samples/Reactive.Todo.Main/Reactive.Todo.Main.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MahApps.Metro" Version="2.0.0-alpha0775" />
<PackageReference Include="Prism.Wpf" Version="7.2.0.1422" />
<PackageReference Include="Prism.Wpf" Version="8.0.0.1909" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Source\ReactiveProperty.Platform.WPF\ReactiveProperty.Platform.WPF.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion Samples/Reactive.Todo/Reactive.Todo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MahApps.Metro" Version="2.0.0-alpha0775" />
<PackageReference Include="Prism.Unity" Version="7.2.0.1422" />
<PackageReference Include="Prism.Unity" Version="8.0.0.1909" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Source\ReactiveProperty.Platform.WPF\ReactiveProperty.Platform.WPF.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.19" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.31" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,8 @@ public FilteredReadOnlyObservableCollection(TCollection source, Func<TElement, b
break;

case NotifyCollectionChangedAction.Reset:
IndexList.Clear();
InnerCollection.Clear();
Initialize();
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
if (source.Any())
{
throw new NotSupportedException("Reset is clear only");
}
break;

default:
Expand Down
2 changes: 1 addition & 1 deletion Source/SharedProperties.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<RootNamespace>Reactive.Bindings</RootNamespace>
<Version>7.8.0</Version>
<Version>7.8.1</Version>
<Authors>neuecc xin9le okazuki</Authors>
<PackageProjectUrl>https://github.com/runceel/ReactiveProperty</PackageProjectUrl>
<PackageTags>rx mvvm async rx-main reactive</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,20 @@ public void PerformanceTest()
filtered.Count.Is(500000);
}

#region private class
[TestMethod]
public void ResetTest()
{
var c = new RangedObservableCollection<Person>();
var filtered = c.ToFilteredReadOnlyObservableCollection(x => x.IsRemoved);
var people = Enumerable.Range(1, 1000000).Select(x => new Person
{
Name = $"tanaka {x}",
IsRemoved = x % 2 == 0,
});

c.AddRange(people);
filtered.Count.Is(500000);
}

private class Person : INotifyPropertyChanged
{
Expand Down Expand Up @@ -400,6 +413,25 @@ public bool IsRemoved
}
}

#endregion private class
public class RangedObservableCollection<T> : ObservableCollection<T>
{
private bool _suppressNotification = false;

protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
{
if (!_suppressNotification) base.OnCollectionChanged(e);
}

public void AddRange(IEnumerable<T> list)
{
if (list == null) throw new ArgumentNullException("list");

_suppressNotification = true;
foreach (T item in list) Add(item);
_suppressNotification = false;

OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
}
}
}
}
6 changes: 3 additions & 3 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c69fcd4

Please sign in to comment.