public void Handle(MonitorSearched localList) { Console.WriteLine("추가된 로컬 ID : " + localList.AssignedLocalID); MainApplication.Current.Dispatcher.Invoke((Action) delegate { _viewModel.AddLocalData(localList); }); }
public void AddLocalData(MonitorSearched item) { var random = new Random(DateTime.Now.Millisecond); Brush brush = new SolidColorBrush( Color.FromRgb ((byte)random.Next(1, 100), (byte)random.Next(1, 100), (byte)random.Next(1, 100))); ListViewItem listItem = new ListViewItem( item.AssignedLocalID, item.AssigendLocalName, brush, _actorWpfSystem, true); _listItems.Add(listItem); if (_localDataMap.Count == 0) { _localDataMap[item.AssignedLocalID] = new PointDictionary() { Point = new Point(_initXPosition, 350), ForegroundColor = brush, }; DateTime now = DateTime.Now.ToLocalTime(); TimeSpan span = (now - new DateTime(1970, 1, 1, 0, 0, 0, 0).ToLocalTime()); _prevTimerCount = (int)span.TotalSeconds; } else { foreach (var value in _localDataMap) { if (value.Key != item.AssignedLocalID) { _localDataMap[item.AssignedLocalID] = new PointDictionary() { Point = new Point(value.Value.Point.X, 350), ForegroundColor = brush, }; break; } } } _actorWpfSystem.ServerActor.Tell(new ClientChangeViewType( _actorWpfSystem.AssignedClientID, ChangedViewType.E_CPU_VIEW), null); LocalCount = _listItems.Count.ToString(); }