private void NotifyChange_CurrentGameObjects(object o, EventArgs e) { if (!IsConnected || GSM.getInstance().getActiveState() == null) _model._currentGameObjects.Clear(); else { EditorSubsystemManaged.getInstance().QueueAction(new Action(()=> { uint objs = GSM.getInstance().getActiveState().GetManagedObjectsSlotTable().GetNumberOfObjects(); //we're also going to check the first id in the list as a sort-of secondary measure in case the entire list has been dup'ed IntPtr firstIDiter = GSM.getInstance().getActiveState().GetManagedObjectsSlotTable().GetAllocatedObjects().create_iterator_begin(); uint firstID = GSM.getInstance().getActiveState().GetManagedObjectsSlotTable().GetAllocatedObjects().get_next_key(firstIDiter).GetID(); if ((objs != _previousGameObjects || (_model._currentGameObjects.Count != 0) && (objs != 0 && firstID != _model._currentGameObjects.ElementAt(0).GetID()))) { //rebuild List<GameObject> newItems = new List<GameObject>(); GameObjectIterator iter = new GameObjectIterator(GSM.getInstance().getActiveState()); while (true) { GameObject g = GameObject.From(iter.Next()); if (g == null) break; newItems.Add(g); } _previousGameObjects = objs; //change ui Application.Current.Dispatcher.BeginInvoke(new Action(() => { _model._currentGameObjects.Clear(false); _model._currentGameObjects.AddRange(newItems); OnPropertyChanged("NumberOfObjects"); })); } })); } }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(GameObjectIterator obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(GameObjectIterator obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }