using System;
using System.Collections.Generic;
using HDL_ON.DAL.Server;
using HDL_ON.DriverLayer;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
namespace HDL_ON.UI
{
public class InverterJinmaoPage : FrameLayout
{
static InverterJinmaoPage bodyView;
Function function;
///
/// 今日发电量数据按钮
///
Button pvGenerate_TodayValuesButton;
///
/// 今日发电量单位按钮
///
Button pvGenerate_todayUintButton;
///
/// 累计发电量数据按钮
///
Button pvGenerate_TotalValuesButton;
///
/// 今日用电量数据按钮
///
Button pvLoad_TodayValuesButton;
///
/// 今日用电量单位按钮
///
Button loadEle_TodayUintButton;
///
/// 累计用电量数据按钮
///
Button pvLoad_TotalValuesButton;
///
/// 光伏运行状态信息区域
///
FrameLayout pvRunStatusInfoView;
///
/// 光伏运行状态图标按钮
///
Button pvRunStatus_IconButton;
///
/// 光伏运行状态文本按钮
///
Button pvRunStatus_TextButton;
///
/// 光伏发电功能数据按钮
///
Button pvPower_ValuesButton;
///
/// 光伏今日发电量数据按钮
///
Button pvGeneration_TodayValuesButton;
///
/// 光伏本月发电量数据按钮
///
Button pvGeneration_MonthValuesButton;
///
/// 光伏实时用电功率数据按钮
///
Button loadElec_ValuesButton;
///
/// 光伏状态今日用电量数据按钮
///
Button powerUsage_TodayValuesButton;
///
/// 光伏状态本月用电量数据按钮
///
Button loadElec_MonthValuesButton;
///
/// 储能运行状态信息区域
///
FrameLayout esStatus_InfoView;
///
/// 储能运行状态图标按钮
///
Button esRunStatus_Info_IconButton;
///
/// 储能运行状态文本按钮
///
Button esRunStatus_Info_TextButton;
///
/// 储能电池状态图标按钮
///
Button esRunStatus_BatteryIconButton;
///
/// 储能电池状态百分比按钮
///
Button esRunStatus_BatteryValuesButton;
///
/// 储能实时充电功率
///
Button esRunStatus_ChargeValuesButton;
///
/// 储能实时放电功率
///
Button esRunStatus_DischargeValuesButton;
///
///
Button socialContribution_Info1_ValuesButton;
///
///
Button socialContribution_Info1_UintButton;
///
///
Button socialContribution_Info2_ValuesButton;
///
///
Button socialContribution_Info2_UintButton;
///
///
Button socialContribution_Info3_UintButton;
///
///
Button socialContribution_Info3_ValuesButton;
public InverterJinmaoPage()
{
bodyView = this;
try
{
function = FunctionList.List.GetInverterJinmaoList()[0];
}
catch (Exception ex)
{
MainPage.Log($"{ex.Message}");
this.RemoveFromParent();
}
BackgroundColor = CSS_Color.BackgroundColor;
}
public void LoadPage()
{
new TopViewDiv(bodyView, Language.StringByID(StringId.NewEnergy)) { maginY = 10 }.LoadTopView();
var contentView = new VerticalScrolViewLayout()
{
Y = Application.GetRealHeight(74),
Height = Application.GetRealHeight(Application.DesignHeight - 74),
};
bodyView.AddChidren(contentView);
contentView.AddChidren(new Button()
{
Height = Application.GetRealWidth(16),
});
#region 发电量 用电量
var electricityQuantityView = new FrameLayout()
{
Width = Application.GetRealWidth(343),
Height = Application.GetRealWidth(99),
Gravity = Gravity.CenterHorizontal,
};
contentView.AddChidren(electricityQuantityView);
#region 发电量 Electricity generation
var electricityGenerationView = new FrameLayout()
{
Width = Application.GetRealWidth(181),
Height = Application.GetRealWidth(99),
BackgroundImagePath = "FunctionIcon/Acst/Inverter/ElectricityGenerationBg.png"
};
electricityQuantityView.AddChidren(electricityGenerationView);
var pv_IconButton = new Button()
{
X = Application.GetRealWidth(14),
Y = Application.GetRealWidth(16),
Width = Application.GetRealWidth(12),
Height = Application.GetRealWidth(12),
UnSelectedImagePath = "FunctionIcon/Acst/Inverter/ElectricityGenerationIcon.png"
};
electricityQuantityView.AddChidren(pv_IconButton);
var pv_TextButton = new Button()
{
X = Application.GetRealWidth(32),
Y = Application.GetRealWidth(12),
Width = Application.GetRealWidth(140),
Height = Application.GetRealWidth(20),
Text = "今日发电量",
TextSize = CSS_FontSize.TextFontSize,
TextAlignment = TextAlignment.CenterLeft,
TextColor = CSS_Color.MainBackgroundColor,
};
electricityGenerationView.AddChidren(pv_TextButton);
pvGenerate_TodayValuesButton = new Button()
{
X = Application.GetRealWidth(12),
Y = Application.GetRealWidth(34),
Height = Application.GetRealWidth(24),
Text = function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity_today.ToString()),
TextColor = CSS_Color.MainBackgroundColor,
TextSize = 18,
IsBold = true,
};
electricityGenerationView.AddChidren(pvGenerate_TodayValuesButton);
#if __IOS__
pvGenerate_TodayValuesButton.TextAlignment = TextAlignment.TopLeft;
pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth() + Application.GetRealWidth(8);
#else
pvGenerate_TodayValuesButton.TextAlignment = TextAlignment.BottomLeft;
pvGenerate_TodayValuesButton.Y = Application.GetRealWidth(37);
pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth() + Application.GetRealWidth(4);
#endif
pvGenerate_todayUintButton = new Button()
{
Y = Application.GetRealWidth(43),
Height = Application.GetRealWidth(17),
Text = "kwh",
TextColor = CSS_Color.MainBackgroundColor,
TextSize = 12,
TextAlignment = TextAlignment.CenterLeft,
};
pvGenerate_todayUintButton.X = pvGenerate_TodayValuesButton.Right - Application.GetRealWidth(2);
electricityGenerationView.AddChidren(pvGenerate_todayUintButton);
pvGenerate_TotalValuesButton = new Button()
{
X = Application.GetRealWidth(12),
Y = Application.GetRealWidth(69),
Height = Application.GetRealWidth(18),
Text = "累计发电量:" + function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString()),
TextColor = CSS_Color.MainBackgroundColor,
TextSize = 12,
TextAlignment = TextAlignment.CenterLeft,
//IsBold = true,
};
electricityGenerationView.AddChidren(pvGenerate_TotalValuesButton);
#endregion
#region 用电量 Electricity consumption
var loadEleView = new FrameLayout()
{
X = Application.GetRealWidth(178 - 16),
Width = Application.GetRealWidth(181),
Height = Application.GetRealWidth(99),
BackgroundImagePath = "FunctionIcon/Acst/Inverter/ElectricityConsumptionBg.png"
};
electricityQuantityView.AddChidren(loadEleView);
var loadEle_IconButton = new Button()
{
X = Application.GetRealWidth(155),
Y = Application.GetRealWidth(16),
Width = Application.GetRealWidth(12),
Height = Application.GetRealWidth(12),
UnSelectedImagePath = "FunctionIcon/Acst/Inverter/ElectricityConsumptionIcon.png"
};
loadEleView.AddChidren(loadEle_IconButton);
var loadEle_TodayTextButton = new Button()
{
//X = Application.GetRealWidth(181 - 32),
Y = Application.GetRealWidth(12),
Width = Application.GetRealWidth(181 - 32),
Height = Application.GetRealWidth(20),
Text = "今日用电量",
TextSize = CSS_FontSize.TextFontSize,
TextAlignment = TextAlignment.CenterRight,
TextColor = CSS_Color.MainBackgroundColor,
};
loadEleView.AddChidren(loadEle_TodayTextButton);
loadEle_TodayUintButton = new Button()
{
Y = Application.GetRealWidth(43),
Height = Application.GetRealWidth(17),
Text = "kwh",
TextColor = CSS_Color.MainBackgroundColor,
TextSize = 12,
TextAlignment = TextAlignment.CenterRight,
};
loadEleView.AddChidren(loadEle_TodayUintButton);
#if __IOS__
loadEle_TodayUintButton.Width = loadEle_TodayUintButton.GetTextWidth() + Application.GetRealWidth(8);
#else
loadEle_TodayUintButton.Width = loadEle_TodayUintButton.GetTextWidth();
#endif
loadEle_TodayUintButton.X = Application.GetRealWidth(181 - 12) - loadEle_TodayUintButton.Width;
pvLoad_TodayValuesButton = new Button()
{
X = Application.GetRealWidth(81 - 12) - loadEle_TodayUintButton.Width,
Y = Application.GetRealWidth(34),
Height = Application.GetRealWidth(53),
Width = Application.GetRealWidth(100),
Text = function.GetAttrState(InverterJinmao_AttrEnum.load_electricity_today.ToString()),
TextColor = CSS_Color.MainBackgroundColor,
TextSize = 18,
TextAlignment = TextAlignment.TopRight,
IsBold = true,
};
#if __IOS__
pvLoad_TodayValuesButton.Y = Application.GetRealWidth(34);
pvLoad_TodayValuesButton.X = Application.GetRealWidth(81 - 12) - loadEle_TodayUintButton.Width;
#else
pvLoad_TodayValuesButton.Y = Application.GetRealWidth(37);
pvLoad_TodayValuesButton.X = Application.GetRealWidth(81 - 16) - loadEle_TodayUintButton.Width;
#endif
loadEleView.AddChidren(pvLoad_TodayValuesButton);
pvLoad_TotalValuesButton = new Button()
{
Y = Application.GetRealWidth(69),
Height = Application.GetRealWidth(18),
Width = Application.GetRealWidth(181 - 12),
Text = "累计用电量:" + function.GetAttrState(InverterJinmao_AttrEnum.load_electricity.ToString()),
TextColor = CSS_Color.MainBackgroundColor,
TextSize = 12,
TextAlignment = TextAlignment.CenterRight,
//IsBold = true,
};
loadEleView.AddChidren(pvLoad_TotalValuesButton);
#endregion
var goHistroyButton = new Button();
electricityQuantityView.AddChidren(goHistroyButton);
goHistroyButton.MouseUpEventHandler = (sender, e) =>
{
var page = new InverterJinmaoHistroyPage(function);
MainPage.BasePageView.AddChidren(page);
page.LoadPage();
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
};
#endregion
contentView.AddChidren(new Button()
{
Height = Application.GetRealWidth(8),
});
#region 光伏运行状态
var pvRunStatus_TitleButton = new Button()
{
X = Application.GetRealWidth(16),
Height = Application.GetRealWidth(47),
TextAlignment = TextAlignment.CenterLeft,
Text = "光伏运行状态",
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = 16,
IsBold = true,
};
contentView.AddChidren(pvRunStatus_TitleButton);
var pvEleGenerationInfoView = new FrameLayout()
{
Gravity = Gravity.CenterHorizontal,
Width = Application.GetRealWidth(343),
Height = Application.GetRealWidth(253),
BackgroundColor = CSS_Color.MainBackgroundColor,
Radius = (uint)Application.GetRealHeight(12),
BorderColor = 0x00FFFFFF,
BorderWidth = 0,
};
contentView.AddChidren(pvEleGenerationInfoView);
#region 光伏运行状态
pvRunStatusInfoView = new FrameLayout()
{
X = 0 - Application.GetRealWidth(14),
Y = Application.GetRealWidth(12),
Width = Application.GetRealWidth(68 + 14),
Height = Application.GetRealWidth(28),
BackgroundColor = 0x154484F4,
Radius = (uint)Application.GetRealHeight(14),
BorderColor = 0x00FFFFFF,
BorderWidth = 0,
};
pvEleGenerationInfoView.AddChidren(pvRunStatusInfoView);
pvRunStatus_IconButton = new Button()
{
X = Application.GetRealWidth(8 + 14),
Gravity = Gravity.CenterVertical,
Width = Application.GetRealWidth(12),
Height = Application.GetRealWidth(12),
UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconRun.png",
};
pvRunStatusInfoView.AddChidren(pvRunStatus_IconButton);
pvRunStatus_TextButton = new Button()
{
X = Application.GetRealWidth(8 + 14 + 4 + 12),
TextAlignment = TextAlignment.CenterLeft,
TextSize = 14,
TextColor = 0xFF4484F4,
Text = "运行",
};
pvRunStatusInfoView.AddChidren(pvRunStatus_TextButton);
var powerGenerationView = new FrameLayout()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealWidth(20),
Width = Application.GetRealWidth(151),
Height = Application.GetRealWidth(151),
};
pvEleGenerationInfoView.AddChidren(powerGenerationView);
var powerGenerationBg = new Button()
{
UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvBgRun.png"
};
powerGenerationView.AddChidren(powerGenerationBg);
new System.Threading.Thread(() =>
{
try
{
int index = 1;
float pvPower = 0.00f;
while (index < 361)
{
float.TryParse(function.GetAttrState(InverterJinmao_AttrEnum.pv_power.ToString()), out pvPower);
if (pvPower > 0.00f)
{
Application.RunOnMainThread(() =>
{
powerGenerationBg.SetRotation(1f * index++);
});
System.Threading.Thread.Sleep(50);
if (index == 361)
{
index = 1;
}
}
}
}
catch (Exception ex)
{
MainPage.Log("Error", $"金茂UI控件旋转异常:{ex.Message}");
}
})
{ IsBackground = true }.Start();
#endregion
#region 光伏发电量
#region 光伏发电功率
pvPower_ValuesButton = new Button()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealWidth(46),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(32),
Text = function.GetAttrState(InverterJinmao_AttrEnum.pv_power.ToString()),
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = 24,
IsBold = true,
};
powerGenerationView.AddChidren(pvPower_ValuesButton);
var powerGeneration_TextButton = new Button()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealWidth(78),
//Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(25),
Text = "实时发电功率 (kw)",
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.TextualColor,
TextSize = 12,
};
powerGenerationView.AddChidren(powerGeneration_TextButton);
#endregion
#region 光伏今日发电量
pvGeneration_TodayValuesButton = new Button()
{
X = Application.GetRealWidth(16),
Y = Application.GetRealWidth(191),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(24),
Text = function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity_today.ToString()),
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = 18,
IsBold = true,
};
pvEleGenerationInfoView.AddChidren(pvGeneration_TodayValuesButton);
var powerGeneration_TodayTextButton = new Button()
{
X = Application.GetRealWidth(16),
Y = Application.GetRealWidth(220),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(17),
Text = "今日发电量 (kwh)",
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.TextualColor,
TextSize = 12,
};
pvEleGenerationInfoView.AddChidren(powerGeneration_TodayTextButton);
#endregion
#region 光伏本月发电量
pvGeneration_MonthValuesButton = new Button()
{
X = Application.GetRealWidth(16 + 105),
Y = Application.GetRealWidth(191),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(24),
Text = function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity_month.ToString()),
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = 18,
IsBold = true,
};
pvEleGenerationInfoView.AddChidren(pvGeneration_MonthValuesButton);
var powerGeneration_MonthTextButton = new Button()
{
X = Application.GetRealWidth(16 + 105),
Y = Application.GetRealWidth(220),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(17),
Text = "本月发电量 (kwh)",
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.TextualColor,
TextSize = 12,
};
pvEleGenerationInfoView.AddChidren(powerGeneration_MonthTextButton);
#endregion
#region 光伏本年发电量
var pvGeneration_YearValuesButton = new Button()
{
X = Application.GetRealWidth(16 + 212),
Y = Application.GetRealWidth(191),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(24),
Text = "---",
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = 18,
IsBold = true,
};
pvEleGenerationInfoView.AddChidren(pvGeneration_YearValuesButton);
var powerGeneration_YearTextButton = new Button()
{
X = Application.GetRealWidth(16 + 212),
Y = Application.GetRealWidth(220),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(17),
Text = "本年发电量 (kwh)",
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.TextualColor,
TextSize = 12,
};
pvEleGenerationInfoView.AddChidren(powerGeneration_YearTextButton);
new System.Threading.Thread(() =>
{
try
{
var revertObj = new HttpServerRequest().GetSensorHistory("custom_year",
function.deviceId, InverterJinmao_AttrEnum.pv_electricity.ToString(), DateTime.Now.Year.ToString());
if (revertObj != null)
{
if (revertObj.Code == StateCode.SUCCESS)
{
var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject>(revertObj.Data.ToString());
double totalValues = 0.0;
double values = 0.0;
foreach (var data in revertData)
{
double.TryParse(data.fieldValue, out values);
totalValues += values;
}
Application.RunOnMainThread(() =>
{
pvGeneration_YearValuesButton.Text = totalValues.ToString();
while (true)
{
if (pvGeneration_YearValuesButton.Width < pvGeneration_YearValuesButton.GetTextWidth())
{
pvGeneration_YearValuesButton.TextSize--;
}
else
{
break;
}
}
});
}
}
}
catch (Exception ex)
{
MainPage.Log("Error", "读取金茂本年发电量数据异常:" + ex.Message);
}
})
{ IsBackground = true }.Start();
#endregion
#endregion
contentView.AddChidren(new Button()
{
Height = Application.GetRealWidth(12),
});
#region 用电量状态 electricity usage status
var electricityUsageStatusView = new FrameLayout()
{
Gravity = Gravity.CenterHorizontal,
Width = Application.GetRealWidth(343),
Height = Application.GetRealWidth(253),
BackgroundColor = CSS_Color.MainBackgroundColor,
Radius = (uint)Application.GetRealHeight(12),
BorderColor = 0x00FFFFFF,
BorderWidth = 0,
};
contentView.AddChidren(electricityUsageStatusView);
var powerUsageView = new FrameLayout()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealWidth(20),
Width = Application.GetRealWidth(151),
Height = Application.GetRealWidth(151),
};
electricityUsageStatusView.AddChidren(powerUsageView);
var powerUsageBg = new Button()
{
UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvBgDischarge.png"
};
powerUsageView.AddChidren(powerUsageBg);
new System.Threading.Thread(() =>
{
try
{
int index = 1;
float loadPower = 0.00f;
while (index < 361)
{
float.TryParse(function.GetAttrState(InverterJinmao_AttrEnum.load_active_power.ToString()), out loadPower);
if (loadPower > 0.00f)
{
Application.RunOnMainThread(() =>
{
powerUsageBg.SetRotation(1f * index++);
});
System.Threading.Thread.Sleep(50);
if (index == 361)
{
index = 1;
}
}
}
}
catch (Exception ex)
{
MainPage.Log("Error", $"金茂UI控件旋转异常2:{ex.Message}");
}
})
{ IsBackground = true }.Start();
loadElec_ValuesButton = new Button()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealWidth(46),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(32),
Text = function.GetAttrState(InverterJinmao_AttrEnum.load_active_power.ToString()),
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = 24,
IsBold = true,
};
powerUsageView.AddChidren(loadElec_ValuesButton);
var powerUsage_TextButton = new Button()
{
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealWidth(78),
//Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(25),
Text = "实时用电功率 (kw)",
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.TextualColor,
TextSize = 12,
};
powerUsageView.AddChidren(powerUsage_TextButton);
powerUsage_TodayValuesButton = new Button()
{
X = Application.GetRealWidth(16),
Y = Application.GetRealWidth(191),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(24),
Text = function.GetAttrState(InverterJinmao_AttrEnum.load_electricity_today.ToString()),
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = 18,
IsBold = true,
};
electricityUsageStatusView.AddChidren(powerUsage_TodayValuesButton);
var loadElec_TodayTextButton = new Button()
{
X = Application.GetRealWidth(16),
Y = Application.GetRealWidth(220),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(17),
Text = "今日用电量 (kwh)",
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.TextualColor,
TextSize = 12,
};
electricityUsageStatusView.AddChidren(loadElec_TodayTextButton);
loadElec_MonthValuesButton = new Button()
{
X = Application.GetRealWidth(16 + 105),
Y = Application.GetRealWidth(191),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(24),
Text = function.GetAttrState(InverterJinmao_AttrEnum.load_electricity_month.ToString()),
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = 18,
IsBold = true,
};
electricityUsageStatusView.AddChidren(loadElec_MonthValuesButton);
var powerUsage_MonthTextButton = new Button()
{
X = Application.GetRealWidth(16 + 105),
Y = Application.GetRealWidth(220),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(17),
Text = "本月用电量 (kwh)",
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.TextualColor,
TextSize = 12,
};
electricityUsageStatusView.AddChidren(powerUsage_MonthTextButton);
var powerUsage_YearValuesButton = new Button()
{
X = Application.GetRealWidth(16 + 212),
Y = Application.GetRealWidth(191),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(24),
Text = function.GetAttrState(InverterJinmao_AttrEnum.load_electricity.ToString()),
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = 18,
IsBold = true,
};
electricityUsageStatusView.AddChidren(powerUsage_YearValuesButton);
var powerUsage_YearTextButton = new Button()
{
X = Application.GetRealWidth(16 + 212),
Y = Application.GetRealWidth(220),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(17),
Text = "本年用电量 (kwh)",
TextAlignment = TextAlignment.Center,
TextColor = CSS_Color.TextualColor,
TextSize = 12,
};
electricityUsageStatusView.AddChidren(powerUsage_YearTextButton);
new System.Threading.Thread(() =>
{
try
{
var revertObj = new HttpServerRequest().GetSensorHistory("custom_year",
function.deviceId, InverterJinmao_AttrEnum.load_electricity.ToString(), DateTime.Now.Year.ToString());
if (revertObj != null)
{
if (revertObj.Code == StateCode.SUCCESS)
{
var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject>(revertObj.Data.ToString());
double totalValues = 0.0;
double values = 0.0;
foreach (var data in revertData)
{
double.TryParse(data.fieldValue, out values);
totalValues += values;
}
Application.RunOnMainThread(() =>
{
powerUsage_YearValuesButton.Text = totalValues.ToString();
while (true)
{
if (powerUsage_YearValuesButton.Width < powerUsage_YearValuesButton.GetTextWidth())
{
powerUsage_YearValuesButton.TextSize--;
}
else
{
break;
}
}
});
}
}
}
catch (Exception ex)
{
MainPage.Log("Error", "读取金茂本年发电量数据异常:" + ex.Message);
}
})
{ IsBackground = true }.Start();
#endregion
#endregion
if (function.attributes.Find((obj) => obj.key == InverterJinmao_AttrEnum.ess_status.ToString()) != null)
{
contentView.AddChidren(new Button()
{
Height = Application.GetRealWidth(8)
});
#region 储能运行状态 Energy storage
var esRunStatus_TitleButton = new Button()
{
X = Application.GetRealWidth(16),
Height = Application.GetRealWidth(47),
TextAlignment = TextAlignment.CenterLeft,
Text = "储能运行状态",
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = 16,
IsBold = true,
};
contentView.AddChidren(esRunStatus_TitleButton);
#region
var esStatusView = new FrameLayout()
{
Gravity = Gravity.CenterHorizontal,
Width = Application.GetRealWidth(343),
Height = Application.GetRealWidth(194),
BackgroundColor = CSS_Color.MainBackgroundColor,
Radius = (uint)Application.GetRealHeight(12),
BorderColor = 0x00FFFFFF,
BorderWidth = 0,
};
contentView.AddChidren(esStatusView);
esStatus_InfoView = new FrameLayout()
{
X = 0 - Application.GetRealWidth(14),
Y = Application.GetRealWidth(12),
Width = Application.GetRealWidth(68 + 14),
Height = Application.GetRealWidth(28),
BackgroundColor = 0x1500C22D,
Radius = (uint)Application.GetRealHeight(14),
BorderColor = 0x00FFFFFF,
BorderWidth = 0,
};
esStatusView.AddChidren(esStatus_InfoView);
esRunStatus_Info_IconButton = new Button()
{
X = Application.GetRealWidth(8 + 14),
Gravity = Gravity.CenterVertical,
Width = Application.GetRealWidth(12),
Height = Application.GetRealWidth(12),
UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconCharg.png",
};
esStatus_InfoView.AddChidren(esRunStatus_Info_IconButton);
esRunStatus_Info_TextButton = new Button()
{
X = Application.GetRealWidth(8 + 14 + 4 + 12),
TextAlignment = TextAlignment.CenterLeft,
TextSize = 14,
TextColor = 0xFF00C22D,
Text = "充电",
};
esStatus_InfoView.AddChidren(esRunStatus_Info_TextButton);
esRunStatus_BatteryValuesButton = new Button()
{
Y = Application.GetRealWidth(18),
Height = Application.GetRealWidth(17),
TextAlignment = TextAlignment.CenterRight,
Text = function.GetAttrState(InverterJinmao_AttrEnum.battery_soc.ToString()) + "%",
TextSize = 12,
TextColor = 0xFF00C22D,
};
esRunStatus_BatteryValuesButton.Width = esRunStatus_BatteryValuesButton.GetTextWidth() + Application.GetRealWidth(8);
esRunStatus_BatteryValuesButton.X = Application.GetRealWidth(343 - 12) - esRunStatus_BatteryValuesButton.Width;
esStatusView.AddChidren(esRunStatus_BatteryValuesButton);
esRunStatus_BatteryIconButton = new Button()
{
X = Application.GetRealWidth(343 - 12 - 20) - esRunStatus_BatteryValuesButton.Width,
Y = Application.GetRealWidth(16),
Width = Application.GetRealWidth(20),
Height = Application.GetRealWidth(20),
UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg.png",
SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg100.png",
IsSelected = esRunStatus_BatteryValuesButton.Text == "100%"
};
esStatusView.AddChidren(esRunStatus_BatteryIconButton);
var esRunStatus_ValuesInfoView = new FrameLayout()
{
Width = Application.GetRealWidth(282),
Height = Application.GetRealWidth(153),
Gravity = Gravity.CenterHorizontal,
Y = Application.GetRealWidth(40),
BackgroundImagePath = "FunctionIcon/Acst/Inverter/EnergyStorageStatusBg.png",
};
esStatusView.AddChidren(esRunStatus_ValuesInfoView);
#region 实时充电功率
var esRunStatus_ChargeValuesView = new FrameLayout()
{
X = Application.GetRealWidth(15),
Width = Application.GetRealWidth(128),
Height = Application.GetRealWidth(128),
};
esRunStatus_ValuesInfoView.AddChidren(esRunStatus_ChargeValuesView);
esRunStatus_ChargeValuesButton = new Button()
{
Y = Application.GetRealWidth(36),
Height = Application.GetRealWidth(32),
TextAlignment = TextAlignment.Center,
Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_charge_power.ToString()),
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = 24,
IsBold = true,
};
esRunStatus_ChargeValuesView.AddChidren(esRunStatus_ChargeValuesButton);
var esRunStatus_ChargeTextButton = new Button()
{
X = Application.GetRealWidth(1),
Y = Application.GetRealWidth(76),
Height = Application.GetRealWidth(17),
TextAlignment = TextAlignment.Center,
Text = "实时充电功率(kw)",
TextColor = CSS_Color.TextualColor,
TextSize = 12,
};
esRunStatus_ChargeValuesView.AddChidren(esRunStatus_ChargeTextButton);
#endregion
#region 实时用电功率
var esRunStatus_DischargeValuesView = new FrameLayout()
{
X = Application.GetRealWidth(132 + 13),
Width = Application.GetRealWidth(128),
Height = Application.GetRealWidth(128),
};
esRunStatus_ValuesInfoView.AddChidren(esRunStatus_DischargeValuesView);
esRunStatus_DischargeValuesButton = new Button()
{
Y = Application.GetRealWidth(36),
Height = Application.GetRealWidth(32),
TextAlignment = TextAlignment.Center,
Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_discharg_power.ToString()),
TextColor = CSS_Color.FirstLevelTitleColor,
TextSize = 24,
IsBold = true,
};
esRunStatus_DischargeValuesView.AddChidren(esRunStatus_DischargeValuesButton);
var esRunStatus_DischargeTextButton = new Button()
{
X = Application.GetRealWidth(1),
Y = Application.GetRealWidth(76),
Height = Application.GetRealWidth(17),
TextAlignment = TextAlignment.Center,
Text = "实时放电功率(kwh)",
TextColor = CSS_Color.TextualColor,
TextSize = 12,
};
esRunStatus_DischargeValuesView.AddChidren(esRunStatus_DischargeTextButton);
#endregion
#endregion
#endregion
}
contentView.AddChidren(new Button()
{
Height = Application.GetRealWidth(8)
});
#region 社会贡献 Social contribution
contentView.AddChidren(new Button()
{
Height = Application.GetRealWidth(46),
Width = Application.GetRealWidth(100),
X = Application.GetRealWidth(16),
Text = "社会贡献",
TextAlignment = TextAlignment.CenterLeft,
TextSize = 16,
TextColor = CSS_Color.FirstLevelTitleColor,
IsBold = true
});
var socialContributionView = new HorizontalScrolViewLayout()
{
Gravity = Gravity.CenterHorizontal,
Width = Application.GetRealWidth(343),
Height = Application.GetRealHeight(142),
ScrollEnabled = false,
};
contentView.AddChidren(socialContributionView);
#region 节约标准煤
var socialContribution_InfoView_1 = new FrameLayout()
{
Width = Application.GetRealWidth(109),
Height = Application.GetRealWidth(130),
BackgroundImagePath = "FunctionIcon/Acst/Inverter/SocialContributionInfoBg_Coal.png"
};
socialContributionView.AddChidren(socialContribution_InfoView_1);
var socialContribution_Info1_IconButton = new Button()
{
X = Application.GetRealWidth(12),
Y = Application.GetRealWidth(16),
Width = Application.GetRealWidth(36),
Height = Application.GetRealWidth(36),
UnSelectedImagePath = "FunctionIcon/Acst/Inverter/SocialContributionInfoIcon_Coal.png"
};
socialContribution_InfoView_1.AddChidren(socialContribution_Info1_IconButton);
socialContribution_Info1_ValuesButton = new Button()
{
X = Application.GetRealWidth(12),
Y = Application.GetRealWidth(68),
Width = Application.GetRealWidth(36),
Height = Application.GetRealWidth(25),
Text = function.GetAttrState(InverterJinmao_AttrEnum.coal.ToString()),
TextSize = 18,
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.BottomLeft,
IsBold = true,
};
socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth() + Application.GetRealWidth(8);
socialContribution_InfoView_1.AddChidren(socialContribution_Info1_ValuesButton);
socialContribution_Info1_UintButton = new Button()
{
X = socialContribution_Info1_ValuesButton.Right - Application.GetRealWidth(4),
Y = Application.GetRealWidth(68),
Width = Application.GetRealWidth(50),
Height = Application.GetRealWidth(23),
Text = "吨",
TextSize = 12,
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.BottomLeft,
};
#if __IOS__
socialContribution_Info1_UintButton.Y = Application.GetRealWidth(66);
#endif
socialContribution_InfoView_1.AddChidren(socialContribution_Info1_UintButton);
var socialContribution_Info1_TipButton = new Button()
{
X = Application.GetRealWidth(12),
Y = Application.GetRealWidth(98),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(17),
Text = "节约标准煤",
TextSize = 12,
TextColor = 0xFF798394,
TextAlignment = TextAlignment.CenterLeft,
};
socialContribution_InfoView_1.AddChidren(socialContribution_Info1_TipButton);
#endregion
socialContributionView.AddChidren(new Button()
{
Width = Application.GetRealWidth(8),
});
#region CO2减排量
var socialContribution_InfoView_2 = new FrameLayout()
{
Width = Application.GetRealWidth(109),
Height = Application.GetRealWidth(130),
BackgroundImagePath = "FunctionIcon/Acst/WaterHeater/SocialContributionInfoBg_2.png"
};
socialContributionView.AddChidren(socialContribution_InfoView_2);
var socialContribution_Info2_IconButton = new Button()
{
X = Application.GetRealWidth(12),
Y = Application.GetRealWidth(16),
Width = Application.GetRealWidth(36),
Height = Application.GetRealWidth(36),
UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/SocialContributionInfoIcon_2.png"
};
socialContribution_InfoView_2.AddChidren(socialContribution_Info2_IconButton);
socialContribution_Info2_ValuesButton = new Button()
{
X = Application.GetRealWidth(12),
Y = Application.GetRealWidth(68),
Width = Application.GetRealWidth(36),
Height = Application.GetRealWidth(25),
Text = function.GetAttrState(InverterJinmao_AttrEnum.co2.ToString()),
TextSize = 18,
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.BottomLeft,
IsBold = true,
};
socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth() + Application.GetRealWidth(8);
socialContribution_InfoView_2.AddChidren(socialContribution_Info2_ValuesButton);
socialContribution_Info2_UintButton = new Button()
{
X = socialContribution_Info2_ValuesButton.Right - Application.GetRealWidth(4),
Y = Application.GetRealWidth(68),
Width = Application.GetRealWidth(50),
Height = Application.GetRealWidth(23),
Text = "吨",
TextSize = 12,
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.BottomLeft,
};
#if __IOS__
socialContribution_Info2_UintButton.Y = Application.GetRealWidth(66);
#endif
socialContribution_InfoView_2.AddChidren(socialContribution_Info2_UintButton);
var socialContribution_Info2_TipButton = new Button()
{
X = Application.GetRealWidth(12),
Y = Application.GetRealWidth(98),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(17),
Text = "CO2减排量",
TextSize = 12,
TextColor = 0xFF798394,
TextAlignment = TextAlignment.CenterLeft,
};
socialContribution_InfoView_2.AddChidren(socialContribution_Info2_TipButton);
#endregion
socialContributionView.AddChidren(new Button()
{
Width = Application.GetRealWidth(8),
});
#region 等效植树量
var socialContribution_InfoView_3 = new FrameLayout()
{
Width = Application.GetRealWidth(109),
Height = Application.GetRealWidth(130),
BackgroundImagePath = "FunctionIcon/Acst/WaterHeater/SocialContributionInfoBg_3.png"
};
socialContributionView.AddChidren(socialContribution_InfoView_3);
var socialContribution_Info3_IconButton = new Button()
{
X = Application.GetRealWidth(12),
Y = Application.GetRealWidth(16),
Width = Application.GetRealWidth(36),
Height = Application.GetRealWidth(36),
UnSelectedImagePath = "FunctionIcon/Acst/WaterHeater/SocialContributionInfoIcon_3.png"
};
socialContribution_InfoView_3.AddChidren(socialContribution_Info3_IconButton);
socialContribution_Info3_ValuesButton = new Button()
{
X = Application.GetRealWidth(12),
Y = Application.GetRealWidth(68),
Width = Application.GetRealWidth(36),
Height = Application.GetRealWidth(25),
Text = function.GetAttrState(InverterJinmao_AttrEnum.trees.ToString()),
TextSize = 18,
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.BottomLeft,
IsBold = true,
};
socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth() + Application.GetRealWidth(8);
socialContribution_InfoView_3.AddChidren(socialContribution_Info3_ValuesButton);
socialContribution_Info3_UintButton = new Button()
{
X = socialContribution_Info3_ValuesButton.Right - Application.GetRealWidth(4),
Y = Application.GetRealWidth(68),
Width = Application.GetRealWidth(50),
Height = Application.GetRealWidth(23),
Text = "棵",
TextSize = 12,
TextColor = CSS_Color.FirstLevelTitleColor,
TextAlignment = TextAlignment.BottomLeft,
};
#if __IOS__
socialContribution_Info3_UintButton.Y = Application.GetRealWidth(66);
#endif
socialContribution_InfoView_3.AddChidren(socialContribution_Info3_UintButton);
var socialContribution_Info3_TipButton = new Button()
{
X = Application.GetRealWidth(12),
Y = Application.GetRealWidth(98),
Width = Application.GetRealWidth(100),
Height = Application.GetRealWidth(17),
Text = "等效植树量",
TextSize = 12,
TextColor = 0xFF798394,
TextAlignment = TextAlignment.CenterLeft,
};
socialContribution_InfoView_3.AddChidren(socialContribution_Info3_TipButton);
#endregion
#endregion
Control.Ins.SendReadCommand(function);
}
///
/// 更新界面数据
///
///
public static void UpdateStatus(Function temp)
{
if (bodyView == null)
{
return;
}
Application.RunOnMainThread(() =>
{
try
{
/// 更新今日发电量
bodyView.upatePvGenerateTodayValues();
/// 更新累计发电量
bodyView.upatePvGenerateTotalValues();
/// 更新今日用电量
bodyView.upatePvLoadTodayValues();
/// 更新累计用电量
bodyView.upatePvLoadTotalValues();
/// 更新光伏运行状态
bodyView.upatePvRunStatus();
/// 更新光伏发电功率
bodyView.updatePvPower();
/// 更新光伏本月发电量
bodyView.upatePvGenerateMonthValues();
/// 更新光伏用电功率
bodyView.updateLoadElec();
///更新光伏状态本月用电量
bodyView.updateLoadElecMonthValues();
//更新储能运行状态
bodyView.updateEsRunStates();
//更新储能电池百分比
bodyView.updateEsBatterySoc();
//更新储能实时充电状态
bodyView.updateEsCharge();
//更新储能实时放电状态
bodyView.updateEsDischarge();
bodyView.updateSocialContribution1();
bodyView.updateSocialContribution2();
bodyView.updateSocialContribution3();
}
catch (Exception ex)
{
MainPage.Log("Error", $"金茂光伏更新异常:{ex.StackTrace}");
}
});
}
///
/// 更新今日发电量
///
private void upatePvGenerateTodayValues()
{
pvGenerate_TodayValuesButton.Text = pvGeneration_TodayValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity_today.ToString());
#if __IOS__
pvGenerate_TodayValuesButton.TextAlignment = TextAlignment.TopLeft;
pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth() + Application.GetRealWidth(8);
#else
pvGenerate_TodayValuesButton.TextAlignment = TextAlignment.BottomLeft;
pvGenerate_TodayValuesButton.Y = Application.GetRealWidth(37);
pvGenerate_TodayValuesButton.Width = pvGenerate_TodayValuesButton.GetTextWidth() + Application.GetRealWidth(4);
#endif
pvGenerate_todayUintButton.X = pvGenerate_TodayValuesButton.Right;
}
///
/// 更新光伏本月发电量
///
private void upatePvGenerateMonthValues()
{
pvGeneration_MonthValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity_month.ToString());
}
///
/// 更新累计发电量
///
private void upatePvGenerateTotalValues()
{
pvGenerate_TotalValuesButton.Text = "累计发电量:" + function.GetAttrState(InverterJinmao_AttrEnum.pv_electricity.ToString());
}
///
/// 更新今日用电量
///
private void upatePvLoadTodayValues()
{
pvLoad_TodayValuesButton.Text = powerUsage_TodayValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.load_electricity_today.ToString());
#if __IOS__
pvLoad_TodayValuesButton.Y = Application.GetRealWidth(34);
pvLoad_TodayValuesButton.X = Application.GetRealWidth(81 - 12) - loadEle_TodayUintButton.Width;
#else
pvLoad_TodayValuesButton.Y = Application.GetRealWidth(37);
pvLoad_TodayValuesButton.X = Application.GetRealWidth(81 - 16) - loadEle_TodayUintButton.Width;
#endif
}
///
/// 更新本月用电量
///
private void updateLoadElecMonthValues()
{
loadElec_MonthValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.load_electricity_month.ToString());
}
///
/// 更新累计用电量
///
private void upatePvLoadTotalValues()
{
pvLoad_TotalValuesButton.Text = "累计用电量:" + function.GetAttrState(InverterJinmao_AttrEnum.load_electricity.ToString());
}
///
/// 更新光伏运行状态
///
private void upatePvRunStatus()
{
switch (function.GetAttrState(InverterJinmao_AttrEnum.system_status.ToString()))
{
case "run":
pvRunStatusInfoView.BackgroundColor = 0x154484F4;
pvRunStatus_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconRun.png";
pvRunStatus_TextButton.Text = "运行";
pvRunStatus_TextButton.TextColor = 0xFF4484F4;
break;
case "fault":
pvRunStatusInfoView.BackgroundColor = 0x15FF4747;
pvRunStatus_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconFault.png";
pvRunStatus_TextButton.Text = "故障";
pvRunStatus_TextButton.TextColor = 0xFFFF4747;
break;
case "standby":
pvRunStatusInfoView.BackgroundColor = 0x15798394;
pvRunStatus_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/PvIconStandby.png";
pvRunStatus_TextButton.Text = "待机";
pvRunStatus_TextButton.TextColor = 0xFF798394;
break;
}
}
///
/// 更新光伏发电功率
///
private void updatePvPower()
{
pvPower_ValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.pv_power.ToString());
}
///
/// 更新光伏用电功率
///
private void updateLoadElec()
{
loadElec_ValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.load_active_power.ToString());
}
///
/// 更新储能运行状态
///
private void updateEsRunStates()
{
if (function.attributes.Find((obj) => obj.key == InverterJinmao_AttrEnum.ess_status.ToString()) != null)
{
switch (function.GetAttrState(InverterJinmao_AttrEnum.ess_status.ToString()))
{
case "charge":
esStatus_InfoView.BackgroundColor = 0x1500C22D;
esRunStatus_Info_TextButton.TextColor = esRunStatus_BatteryValuesButton.TextColor = 0xFF00C22D;
esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconCharg.png";
esRunStatus_Info_TextButton.Text = "充电";
esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg.png";
esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconCharg100.png";
break;
case "discharge":
esStatus_InfoView.BackgroundColor = 0x15FC9C04;
esRunStatus_Info_TextButton.TextColor = esRunStatus_BatteryValuesButton.TextColor = 0xFFFC9C04;
esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconDischarge.png";
esRunStatus_Info_TextButton.Text = "放电";
esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconDischarg.png";
esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconDischarg100.png";
break;
case "shutdown":
esStatus_InfoView.BackgroundColor = 0x15798394;
esRunStatus_Info_TextButton.TextColor = esRunStatus_BatteryValuesButton.TextColor = 0xFF798394;
esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconShutdown.png";
esRunStatus_Info_TextButton.Text = "停机";
esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconShutdown.png";
esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconShutdown100.png";
break;
case "fault":
esStatus_InfoView.BackgroundColor = 0x15FF4747;
esRunStatus_Info_TextButton.TextColor = esRunStatus_BatteryValuesButton.TextColor = 0xFFFF4747;
esRunStatus_Info_IconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/EsIconFault.png";
esRunStatus_Info_TextButton.Text = "故障";
esRunStatus_BatteryIconButton.UnSelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconFault.png";
esRunStatus_BatteryIconButton.SelectedImagePath = "FunctionIcon/Acst/Inverter/BatteryIconFault100.png";
break;
}
}
}
///
/// 更新储能电池百分比状态
///
private void updateEsBatterySoc()
{
if (function.attributes.Find((obj) => obj.key == InverterJinmao_AttrEnum.ess_status.ToString()) != null)
{
esRunStatus_BatteryValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.battery_soc.ToString()) + "%";
if (esRunStatus_BatteryIconButton.Text == "100%")
{
esRunStatus_BatteryIconButton.IsSelected = true;
}
}
}
///
/// 更新储能实时充电状态
///
private void updateEsCharge()
{
if (function.attributes.Find((obj) => obj.key == InverterJinmao_AttrEnum.ess_status.ToString()) != null)
{
esRunStatus_ChargeValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_charge_power.ToString());
}
}
///
/// 更新储能实时放电状态
///
private void updateEsDischarge()
{
if (function.attributes.Find((obj) => obj.key == InverterJinmao_AttrEnum.ess_status.ToString()) != null)
{
esRunStatus_DischargeValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.ess_discharg_power.ToString());
}
}
///
/// 更新社会贡献1数据UI
///
private void updateSocialContribution1()
{
socialContribution_Info1_ValuesButton.Text = function.GetAttrState(InverterJinmao_AttrEnum.coal.ToString());
socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth();
if (socialContribution_Info1_ValuesButton.Width > Application.GetRealWidth(61))
{
socialContribution_Info1_ValuesButton.TextSize = 14;
socialContribution_Info1_ValuesButton.Width = socialContribution_Info1_ValuesButton.GetTextWidth();
socialContribution_Info1_UintButton.Height = Application.GetRealWidth(25);
}
#if __IOS__
socialContribution_Info1_ValuesButton.Width += Application.GetRealWidth(6);
socialContribution_Info1_UintButton.X = socialContribution_Info1_ValuesButton.Right - Application.GetRealWidth(4);
#else
socialContribution_Info1_UintButton.X = socialContribution_Info1_ValuesButton.Right +Application.GetRealWidth(2);
#endif
}
///
/// 更新社会贡2献数据UI
///
private void updateSocialContribution2()
{
socialContribution_Info2_ValuesButton.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.co2.ToString());
socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth();
if (socialContribution_Info2_ValuesButton.Width > Application.GetRealWidth(61))
{
socialContribution_Info2_ValuesButton.TextSize = 14;
socialContribution_Info2_ValuesButton.Width = socialContribution_Info2_ValuesButton.GetTextWidth();
}
#if __IOS__
socialContribution_Info2_ValuesButton.Width += Application.GetRealWidth(6);
socialContribution_Info2_UintButton.X = socialContribution_Info2_ValuesButton.Right - Application.GetRealWidth(4);
#else
socialContribution_Info2_UintButton.X = socialContribution_Info2_ValuesButton.Right +Application.GetRealWidth(2);
#endif
}
///
/// 更新社会贡3献数据UI
///
private void updateSocialContribution3()
{
socialContribution_Info3_ValuesButton.Text = function.GetAttrState(WaterHeaterJinmao_AttrEnum.trees.ToString());
socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth();
if (socialContribution_Info3_ValuesButton.Width > Application.GetRealWidth(61))
{
socialContribution_Info3_ValuesButton.TextSize = 14;
socialContribution_Info3_ValuesButton.Width = socialContribution_Info3_ValuesButton.GetTextWidth();
socialContribution_Info3_UintButton.Height = Application.GetRealWidth(25);
}
#if __IOS__
socialContribution_Info3_ValuesButton.Width += Application.GetRealWidth(6);
socialContribution_Info3_UintButton.X = socialContribution_Info3_ValuesButton.Right - Application.GetRealWidth(4);
#else
socialContribution_Info3_UintButton.X = socialContribution_Info3_ValuesButton.Right +Application.GetRealWidth(2);
#endif
}
}
}