bool HandleMarkedSwitchesChange(MarkedSwitchesChanged m) { MarkedSwitchesDownload download = new MarkedSwitchesDownload(); if (!download.Download()) { return(false); } topology.UpdateMarkedSwitches(download); Notify(new ObservableMessage(EObservableMessageType.MarkedSwitchesChanged)); return(true); }
public void UpdateMarkedSwitches(MarkedSwitchesDownload download) { if (download == null || download.Data == null) { return; } Dictionary <long, bool> markedSwitches = new Dictionary <long, bool>(download.Data.Count); for (int i = 0; i < download.Data.Count; ++i) { KeyValuePair <long, bool> pair = download.Data[i]; markedSwitches.Add(pair.Key, pair.Value); } rwLock.EnterWriteLock(); { this.markedSwitches = markedSwitches; } rwLock.ExitWriteLock(); }