I currently have a itemsCollection and a historyCollection. Both are separate isolated .dat files.
The saving and displaying works fine for both of these isolated storages, however the problem is when I try to delete something out of the itemCollection I also want to remove all the items out of the historyItemCollection where the historyItemCollection contains that specific itemIndex.
Update:
The itemCollection could contain something like this:
- a
- b
- c
The historyItemCollection could look like this:
- a
- b
- c
- b
So if I remove b (itemIndex 1) then I want both to be removed in the historyItemCollection.
I can remove the items out of the itemCollection fine, but the historyItemCollection throws errors.
int i = 0;
for (i = 0; i <= App.ViewModel.historyItemCollection.Count-1; i++)
{
if (App.ViewModel.historyItemCollection[i].VehicleId == (Application.Current as App).vehicleIndex)
{
App.ViewModel.historyItemCollection[i].Remove(i);
}
}
App.ViewModel.vehicleItemsCollection[(Application.Current as App).vehicleIndex].Remove((Application.Current as App).vehicleIndex);
The error message I'm getting: Parameter name: index
It fails on this line:
App.ViewModel.historyItemCollection[i].Remove(i);