| | |
| | | public EnergyMainPage() |
| | | { |
| | | bodyView = this; |
| | | energyList = FunctionList.List.GetEnergyList(); |
| | | var breaker = FunctionList.List.Functions.FindAll((obj) => obj.spk == SPK.AirSwitch); |
| | | var energyBreker = breaker.FindAll((obj) => obj.GetAttribute("power") != null); |
| | | energyList.AddRange(energyBreker); |
| | | energyList = FunctionList.List.GetEnergyList().FindAll((obj)=>obj.spk == SPK.AirSwitch || obj.spk == SPK.ElectricEnergy); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | echartsView.AddChidren(myEchartsView_Pie); |
| | | |
| | | Dictionary<string, string> list = new Dictionary<string, string>(); |
| | | |
| | | int count = 0; |
| | | foreach(var ene in energyList) |
| | | { |
| | | if (count > 10) |
| | | { |
| | | break; |
| | | } |
| | | double tt = 0; |
| | | double.TryParse(ene.GetAttrState(FunctionAttributeKey.TotalElectricity), out tt); |
| | | tt *= 100;//乘以100,小于1无法加载echart |
| | | tt = Math.Round(tt, 2); |
| | | list.Add(ene.name, tt.ToString()); |
| | | string key = ene.name; |
| | | if (list.ContainsKey(key)) |
| | | { |
| | | list.Add(ene.name + DateTime.Now.Ticks, tt.ToString()); |
| | | } |
| | | else |
| | | { |
| | | list.Add(ene.name, tt.ToString()); |
| | | } |
| | | count++; |
| | | } |
| | | myEchartsView_Pie.ShowWithOption(new EchartsOption_Pie().InitDateJson(list)); |
| | | |
| | |
| | | int index = 0; |
| | | foreach (var energy in energyList) |
| | | { |
| | | if (index > 10) |
| | | { |
| | | break; |
| | | } |
| | | EnergyRow(energy, energyListView, index); |
| | | index++; |
| | | new System.Threading.Thread(() => |
| | |
| | | double totalValue = 0; |
| | | double realtimeValue = 0; |
| | | Dictionary<string, string> list = new Dictionary<string, string>();//饼图数据 |
| | | int count = 0; |
| | | foreach (var ene in bodyView.energyList) |
| | | { |
| | | if (count > 10) |
| | | { |
| | | break; |
| | | } |
| | | count++; |
| | | double power = 0.00; |
| | | double.TryParse(ene.GetAttrState(FunctionAttributeKey.TotalElectricity), out power); |
| | | power = Math.Round(power, 2); |