bool HandleLoadFlowChange(LoadFlowChanged m) { LoadFlowDownload download = new LoadFlowDownload(); if (!download.Download()) { return(false); } topology.UpdateLoadFlow(download); Notify(new ObservableMessage(EObservableMessageType.LoadFlowChanged)); return(true); }
public void UpdateLoadFlow(LoadFlowDownload download) { if (download?.Data == null) { return; } Dictionary <long, LoadFlowResult> loadFlow = new Dictionary <long, LoadFlowResult>(); for (int i = 0; i < download.Data.Count; ++i) { KeyValuePair <long, LoadFlowResult> pair = download.Data[i]; loadFlow.Add(pair.Key, pair.Value); } rwLock.EnterWriteLock(); { this.loadFlow = loadFlow; } rwLock.ExitWriteLock(); }