private void SendMessage(EnvironmentMessage message) { if (_active) { bool tempRunning = _running; _running = true; lock (this) { if (message != null) { if ((message.Message == TypeMessege.DeletePoint) || (message.Message == TypeMessege.DeleteAllPoint) || (message.Message == TypeMessege.GetPoint)) { if (_space != null) { ChangedPoints?.Invoke(_space); } } EnvironmentMessage?.Invoke(message); } } _running = tempRunning; } }
private void SendMessageChangePoint(object space) { if (_active) { bool tempRunning = _running; _running = true; SortedList <int, FigureAgent> eventMessage = new SortedList <int, FigureAgent>(); if (space is SortedList <int, FigureAgent> ) { eventMessage = (SortedList <int, FigureAgent>)space; } ChangedPoints?.Invoke(eventMessage); _running = tempRunning; } }