private void NotifyEndCycleEvent(NotifyClientsEndCycleArgs args) { //*************************************************** Ex_clockDate = args.Transport2Client.Ex_clockDate; CurrentGameStatus = args.Transport2Client.ManagerStatus; lock (colGroundAtoms) { if (args.Transport2Client.AtomObjectType == 0 || args.Transport2Client.AtomObjectType == 2) //Ground { colGroundAtoms.Clear(); foreach (structTransportCommonProperty TR in args.Transport2Client.AtomObjectCollection) { if (TR.AtomClass == "TDSServer.GroundTask.clsGroundAtom") { if (colGroundAtoms != null) { if (colGroundAtoms.ContainsKey(TR.AtomName) == false) { colGroundAtoms.Add(TR.AtomName, TR); } } } } } else if (args.Transport2Client.AtomObjectType == 3) { //colAirAtoms.Clear(); //foreach (structTransportCommonProperty TR in args.Transport2Client.AtomObjectCollection) //{ // if (TR.AtomClass == "GameService.AirTask.clsAirAtom") // { // if (colAirAtoms != null) // { // if (colAirAtoms.ContainsKey(TR.AtomName) == false) // colAirAtoms.Add(TR.AtomName, TR); // } // } //} } else if (args.Transport2Client.AtomObjectType == 4) { //colInfraStructureAtoms.Clear(); //foreach (structTransportCommonProperty TR in args.Transport2Client.AtomObjectCollection) //{ // { // if (colInfraStructureAtoms.ContainsKey(TR.AtomName) == false) // colInfraStructureAtoms.Add(TR.AtomName, TR); // } //} } if (MyMainMap != null) { MyMainMap.InvalidateVisualUserDrawLayer(); } } }
private void SignalEndCycleEvent(NotifyClientsEndCycleArgs args) { lock (_queueEndCycleArgs) { if (_queueEndCycleArgs.Count > 60) { _queueEndCycleArgs.RemoveRange(0, 50); } _queueEndCycleArgs.Add(args); Monitor.Pulse(_queueEndCycleArgs); } }
private void Run() { NotifyClientsEndCycleArgs current = null; while (true) { lock (_queueEndCycleArgs) { if (_queueEndCycleArgs.Count > 0) { current = _queueEndCycleArgs[0]; } else { Monitor.Wait(_queueEndCycleArgs); if (_queueEndCycleArgs.Count > 0) { current = _queueEndCycleArgs[0]; } } if (_queueEndCycleArgs.Count > 0) { _queueEndCycleArgs.RemoveAt(0); } } if (current != null) { try { System.Windows.Application.Current.Dispatcher.Invoke(() => NotifyEndCycleEvent(current), DispatcherPriority.Background); } catch (Exception ex) { } current = null; } } }