示例#1
0
 protected ViewModelBase()
 {
     if (!Loaded.Contains(this))
     {
         Loaded.Add(this);
     }
 }
        public void Unload(int i)
        {
            if (!Loaded.Contains(i))
            {
                return;
            }

            Loaded.Remove(i);
        }
        public void Load(int i)
        {
            if (Loaded.Contains(i))
            {
                return;
            }

            Loaded.Add(i);
        }
示例#4
0
        public void Load(int i)
        {
            if (Loaded.Contains(i))
            {
                return;
            }

            Loaded.Add(i);
            LoadQueue.Enqueue(i);
        }
示例#5
0
 private static void OnLoadedCommandPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
 {
     if (d is FrameworkElement element && e.NewValue is ICommand command)
     {
         if (!Loaded.Contains(element))
         {
             Loaded.Add(element);
             element.Loaded += (s, a) => command.Execute(null);
         }
     }
 }
        private void CheckFunc(PointOctreeNode <Integer> .OctreeObject octreeObject)
        {
            var objectPosition  = DataSet[octreeObject.Obj].Position;
            var distanceCurrent = Vector3.Distance(cachePosition, objectPosition);

            if (distanceCurrent > NearRadius && distanceCurrent < FarRadius && !Loaded.Contains(octreeObject.Obj))
            {
                Loaded.Add(octreeObject.Obj);
                lock (LoadQueue)
                {
                    LoadQueue.Enqueue(octreeObject.Obj);
                }
            }
            else if ((distanceCurrent < NearRadius || distanceCurrent > FarRadius) &&
                     Loaded.Contains(octreeObject.Obj))
            {
                Loaded.Remove(octreeObject.Obj);
                lock (UnloadQueue)
                {
                    UnloadQueue.Enqueue(octreeObject.Obj);
                }
            }
        }