| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新 |
| | | /// 设置 |
| | | /// </summary> |
| | | public void Update(HydroVisualInfo visual) |
| | | public void Set(HydroVisualInfo visual) |
| | | { |
| | | if (visual == null) |
| | | { |
| | | return; |
| | | } |
| | | var item = this.Items?.Find(x => x.Id == visual.Code); |
| | | if (item == null) |
| | | var oldItem = this.Items?.Find(x => x.Id == visual.Code); |
| | | if (oldItem != null) |
| | | { |
| | | return; |
| | | if (this.Items != null) |
| | | { |
| | | this.Items.Remove(oldItem); |
| | | } |
| | | this.Items?.Remove(oldItem); |
| | | } |
| | | this.Items.Remove(item); |
| | | var allCalcuResultVisualDict = _calcuResult?.GetVisualDict(); |
| | | item = CreateItem(visual, allCalcuResultVisualDict); |
| | | this.Items.Add(item); |
| | | _views?.ForEach(async x => await x.UpdateFlowEffect(item)); |
| | | var newItem = CreateItem(visual, allCalcuResultVisualDict); |
| | | if (newItem != null) |
| | | { |
| | | if (this.Items != null) |
| | | { |
| | | this.Items.Add(newItem); |
| | | } |
| | | } |
| | | if (this.Visible) |
| | | { |
| | | if (newItem != null) |
| | | { |
| | | _views?.ForEach(async x => await x.UpdateFlowEffect(newItem)); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |