Skip to content

Commit

Permalink
Merge pull request #809 from VladiStep/partialFixOfSyncBinding
Browse files Browse the repository at this point in the history
"ImportGML.csx" (and probably some other scripts) fix.
  • Loading branch information
Grossley authored Mar 28, 2022
2 parents 292cb86 + 7d8bec4 commit 03d56e2
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions UndertaleModTool/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1719,30 +1719,41 @@ public void SyncBinding(string resourceType, bool enable)
{
foreach (string resType in resTypes)
{
BindingOperations.EnableCollectionSynchronization(Data[resType] as IEnumerable, bindingLock);
IEnumerable resListCollection = Data[resType] as IEnumerable;
if (resListCollection is not null)
{
BindingOperations.EnableCollectionSynchronization(resListCollection, bindingLock);

syncBindings.Add(resType);
syncBindings.Add(resType);
}
}
}
else
{
foreach (string resType in resTypes)
{
BindingOperations.DisableCollectionSynchronization(Data[resType] as IEnumerable);
if (syncBindings.Contains(resType))
{
BindingOperations.DisableCollectionSynchronization(Data[resType] as IEnumerable);

syncBindings.Remove(resType);
syncBindings.Remove(resType);
}
}
}
}
else
{
if (enable)
{
BindingOperations.EnableCollectionSynchronization(Data[resourceType] as IEnumerable, bindingLock);
IEnumerable resListCollection = Data[resourceType] as IEnumerable;
if (resListCollection is not null)
{
BindingOperations.EnableCollectionSynchronization(resListCollection, bindingLock);

syncBindings.Add(resourceType);
syncBindings.Add(resourceType);
}
}
else
else if (syncBindings.Contains(resourceType))
{
BindingOperations.DisableCollectionSynchronization(Data[resourceType] as IEnumerable);

Expand Down

0 comments on commit 03d56e2

Please sign in to comment.