/// <summary> /// Генерация общей статистики активных визуальных элементов. /// </summary> public void CalculateVisualControlStat() { ItemsRealDataNameActivated.Clear(); ItemsRealActivated.Clear(); ItemsRealActivatedCount = 0; /* * foreach (ItemReal item in ItemsReal) * { * count = item.GetVisualControlActivatedCount(); * if (count > 0) * { * ItemsRealActivatedCount++; * ItemsRealActivated.Add(item); * ItemsRealDataNameActivated.Add(item.DataName); * } * VisualActivatedCount += count; * } */ foreach (KeyValuePair <string, int> item in VisualControlDict) { ItemsRealDataNameActivated.Add(item.Key); ItemReal itemReal; if (ItemsRealDict.ContainsKey(item.Key)) { itemReal = ItemsRealDict[item.Key]; } else { itemReal = new ItemReal(); } ItemsRealActivated.Add(itemReal); } ItemsRealActivatedCount = VisualControlDict.Count; }
/// <summary> /// Обработчик события на завершение вызова функции инициализации элементов. /// </summary> void DataClient_GetItemsFullCompleted(object sender, GetItemsFullCompletedEventArgs e) { if (e.Error == null) { foreach (ItemSql itemReal in e.Result) { ItemReal item = new ItemReal() { DataName = itemReal.DataName, Trend = itemReal.Trend, Description = itemReal.Description, Unit = itemReal.Unit, FormatValue = itemReal.FormatValue, MinValue = itemReal.MinValue, MaxValue = itemReal.MaxValue, DataType = (ItemReal.DataTypeSimple)itemReal.DataType, DataValue = itemReal.DataValue, Quality = itemReal.Quality, SqlTime = itemReal.SqlTime, DeviceTime = itemReal.DeviceTime, TimeOut = itemReal.TimeOut, Comment = itemReal.Comment }; ItemsReal.Add(item); ItemsRealDict.Add(itemReal.DataName, item); } if (e.Result.Count > 0) { ItemsInited = true; InvokeUIControlInitItems(); } } else { InitFaultCount++; ItemsInited = false; if (Mode == ModeType.Real || Mode == ModeType.Debug) { RecreateDataClient(); } } InitItemsBusy = false; LoadTime = DateTime.Now - T0; }