예제 #1
0
 public void Invoke(Action action)
 {
     if (ThreadID == Thread.CurrentThread.ManagedThreadId)
         action();
     else
         PendingMainThreadActions.Add(action);
 }
예제 #2
0
 void HandleClientPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     switch (e.PropertyName)
     {
     case "Position":
         UpdateCamera();
         var sorter = new ChunkRenderer.ChunkSorter(new Coordinates3D(
                                                        (int)Client.Position.X, 0, (int)Client.Position.Z));
         PendingMainThreadActions.Add(() => ChunkMeshes.Sort(sorter));
         break;
     }
 }