public void Load(bool async = false) { GraphItems.Clear(); //GraphItems.Add(InspectorViewModel); // var graphItems = new List<GraphItemViewModel>(); //// var time = DateTime.Now; // foreach (var item in CurrentNodes) // { // // Get the ViewModel for the data // //InvertApplication.Log("B-A" + DateTime.Now.Subtract(time).TotalSeconds.ToString()); // var mapping = InvertApplication.Container.RelationshipMappings[item.GetType(), typeof(ViewModel)]; // if (mapping == null) continue; // var vm = Activator.CreateInstance(mapping, item, this) as GraphItemViewModel; // //var vm = // // InvertApplication.Container.ResolveRelation<ViewModel>(item.GetType(), item, this) as // // GraphItemViewModel; // //InvertApplication.Log("B-B" + DateTime.Now.Subtract(time).TotalSeconds.ToString()); // if (vm == null) // { // if (InvertGraphEditor.Platform.MessageBox("Node Error", string.Format("Couldn't find view-model for {0} would you like to remove this item?", item.GetType()), "Yes", "No")) // { // CurrentRepository.Remove(item); // } // continue; // } // vm.DiagramViewModel = this; // GraphItems.Add(vm); // // Clear the connections on the view-model // vm.Connectors.Clear(); // vm.GetConnectors(vm.Connectors); // connectors.AddRange(vm.Connectors); // } CurrentNodes = GraphData.CurrentFilter.FilterNodes.Distinct().ToArray(); NavigationViewModel.Refresh(); //if (async) //{ //InvertApplication.SignalEvent<ITaskHandler>(_ => _.BeginBackgroundTask(AddGraphItems(CurrentNodes))); // FIXME: fore asynchronous loading to avoid scroll position reset IEnumerator addGraphItems = AddGraphItems(CurrentNodes); while (addGraphItems.MoveNext()) { } //} //else //{ //var e = AddGraphItems(); //while (e.MoveNext()) //{ //} //} }