using Shared.SimpleControl.Phone;
|
using System;
|
using System.Collections.Generic;
|
|
namespace Shared.SimpleControl.Pad
|
{
|
public class SystemEquipmentBase
|
{
|
void SaveAndReadDevices (Common device)
|
{
|
MainPage.Loading.Start ();
|
System.Threading.Tasks.Task.Run (() => {
|
if (SystemMiddle.hideListCommon != null && SystemMiddle.hideListCommon.Count != 0) {
|
foreach (Common c in SystemMiddle.hideListCommon) {
|
if (c.SubnetID == device.SubnetID && c.DeviceID == device.DeviceID) {
|
LoadDevice (c);
|
Application.RunOnMainThread (() => {
|
try {
|
string ReadStr1 = "_" + c.SubnetID.ToString () + "_" + c.DeviceID.ToString () + "_";
|
List<string> localEquipmentList1 = new List<string> ();
|
List<string> files = IO.FileUtils.ReadFiles ().FindAll ((obj) => obj.Split ('_') [0] == "Equipment");
|
foreach (string equipment in files) {
|
if (equipment.Contains (ReadStr1) && equipment.Split ('_').Length == 5
|
&& equipment.Contains (c.GetType ().Name.Replace ("Device", "")) //第三个判断为面板的特殊判断,一些特别的面板下面有带有设备(如:继电器),会导致一些特殊的问题出现
|
) {
|
if (equipment.Split ('_') [0] == "Equipment")
|
localEquipmentList1.Add (equipment);
|
}
|
}
|
if (localEquipmentList1.Count > 0)
|
InitDevicesList (localEquipmentList1, device);
|
} catch {
|
}
|
});
|
Console.WriteLine ("loadChildren");
|
}
|
}
|
}
|
LoadDevice (device);
|
|
Application.RunOnMainThread (() => {
|
try {
|
string ReadStr = "_" + device.SubnetID.ToString () + "_" + device.DeviceID.ToString () + "_";
|
List<string> localEquipmentList = new List<string> ();
|
List<string> localFileList = IO.FileUtils.ReadFiles ();
|
foreach (string equipment in localFileList) {
|
if (equipment.Contains (ReadStr) && equipment.Split ('_').Length == 5) {
|
if (device.Type.ToString () == typeof (LightLogic).Name || equipment.Contains (device.Type.ToString ())) {
|
if (equipment.Split ('_') [0] == "Equipment")
|
localEquipmentList.Add (equipment);
|
}
|
}
|
}
|
if (localEquipmentList.Count == 0 && device.Type != DeviceType.InfraredMode) {
|
new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
|
return;
|
}
|
InitDevicesList (localEquipmentList, device);
|
} catch {
|
} finally {
|
MainPage.Loading.Hide ();
|
}
|
});
|
});
|
}
|
|
public void EquipmentBaseViewShow (Common device)
|
{
|
SystemMiddle.SecondScrolView.RemoveAll ();
|
SystemMiddle.ThirdScrolView.RemoveAll ();
|
// top
|
AddTopLayout (device);
|
|
SaveAndReadDevices (device);
|
}
|
|
/// <summary>
|
/// 加载顶部设备标题栏
|
/// </summary>
|
void AddTopLayout (Common common)
|
{
|
Button btn = new Button () {
|
X = Application.GetRealWidth (20),
|
Height = Application.GetRealHeight (66),
|
Width = Application.GetRealWidth (66),
|
Gravity = Gravity.CenterVertical,
|
};
|
if (common.Type == DeviceType.LightSwitch || common.Type == DeviceType.LightDimming ||
|
common.Type == DeviceType.LightMixSwitch || common.Type == DeviceType.LightMixDimming ||
|
common.Type == DeviceType.LightEnergySwitch || common.Type == DeviceType.LightDALI || common.Type == DeviceType.LightLogic) {
|
btn.UnSelectedImagePath = "Item/Light.png";
|
} else if (common.Type == DeviceType.HVAC || common.Type == DeviceType.ACInfrared || common.Type == DeviceType.ACPanel) {
|
btn.UnSelectedImagePath = "AC/AC.png";
|
} else if (common.Type == DeviceType.CurtainModel || common.Type == DeviceType.CurtainTrietex || common.Type == DeviceType.CurtainRoller) {
|
btn.UnSelectedImagePath = "Curtain/Curtain.png";
|
} else if (common.Type == DeviceType.ButtonPanel) {
|
btn.UnSelectedImagePath = "Item/Panel.png";
|
} else if (common.Type == DeviceType.FoolHeat || common.Type == DeviceType.FoolHeatPanel) {
|
btn.UnSelectedImagePath = "Item/FloorHeating.png";
|
} else if (common.Type == DeviceType.DryContact) {
|
btn.UnSelectedImagePath = "Item/DryContact.png";
|
} else if (common.Type == DeviceType.InfraredMode) {
|
btn.UnSelectedImagePath = "Item/InfraredModel.png";
|
} else if (common.Type == DeviceType.ACInfrared) {
|
btn.UnSelectedImagePath = "AC/AC.png";
|
} else if (common.Type == DeviceType.MusicModel) {
|
btn.UnSelectedImagePath = "Item/Music.png";
|
} else if (common.Type == DeviceType.FanModule) {
|
btn.UnSelectedImagePath = "Fan/Fan.png";
|
} else if (common.Type == DeviceType.LogicModule) {
|
btn.UnSelectedImagePath = "Item/LogicModule.png";
|
}
|
SystemMiddle.SecondScrolView.TitleView.AddChidren (btn);
|
|
EditText textButton = new EditText () {
|
X = btn.Right + Application.GetRealHeight (10),
|
Height = Application.GetRealHeight (50),
|
Width = Application.GetRealWidth (360),
|
Text = common.Name,
|
Gravity = Gravity.CenterVertical,
|
TextAlignment = TextAlignment.CenterLeft,
|
SelectedBackgroundColor = 0xFF000000,
|
TextSize = 15,
|
Enable = false,
|
};
|
|
SystemMiddle.SecondScrolView.TitleView.AddChidren (textButton);
|
Button editor = new Button () {
|
Height = Application.GetRealHeight (90),
|
Width = Application.GetRealWidth (70),
|
UnSelectedImagePath = "Item/Editor.png",
|
SelectedImagePath = "Item/EditorSelected.png",
|
Gravity = Gravity.CenterVertical,
|
X = textButton.Right + Application.GetRealWidth (10),
|
};
|
SystemMiddle.SecondScrolView.TitleView.AddChidren (editor);
|
editor.MouseUpEventHandler += (sender, e) => {
|
if (editor.IsSelected == true) {
|
textButton.IsSelected = editor.IsSelected = textButton.Enable = false;
|
common.Name = textButton.Text.Trim ();
|
CommonPage.UpdateRemark (common.SubnetID, common.DeviceID, textButton.Text.Trim ());
|
IO.FileUtils.SaveEquipmentMessage (common);
|
} else {
|
textButton.Enable = textButton.IsSelected = editor.IsSelected = true;
|
}
|
};
|
Button btnRefresh = new Button () {
|
X = editor.Right + Application.GetRealWidth (10),
|
Height = Application.GetMinRealAverage (66),
|
Width = Application.GetMinRealAverage (66),
|
UnSelectedImagePath = "Item/Refresh.png",
|
SelectedImagePath = "Item/RefreshOn.png",
|
Gravity = Gravity.CenterVertical,
|
};
|
SystemMiddle.SecondScrolView.TitleView.AddChidren (btnRefresh);
|
|
btnRefresh.MouseUpEventHandler += (sender, e) => {
|
System.Threading.Tasks.Task.Run (() => {
|
Application.RunOnMainThread (() => {
|
MainPage.Loading.Start ();
|
});
|
string delFlag = "_" + common.SubnetID.ToString () + "_" + common.DeviceID.ToString () + "_";
|
|
var delFiles = IO.FileUtils.ReadFiles ().FindAll ((w) => {
|
return w.Contains (delFlag);
|
});
|
for (int i = 0; i < delFiles.Count; i++) {
|
if (delFiles [i].Split ('_').Length == 5) {
|
if (delFiles [i].Split ('_') [0] == "Equipment")
|
IO.FileUtils.DeleteFile (delFiles [i]);
|
}
|
}
|
Random ran = new Random ();
|
CommonPage.RandomHigh = (byte)ran.Next (0, 255);
|
CommonPage.RandomLow = (byte)ran.Next (0, 255);
|
CommonPage.LocalPhoneFindDevice = true;
|
CommonPage.DeviceList.Clear ();
|
Control.ControlBytesSendHasReturn (Command.ReadDeviceModul, common.SubnetID, common.DeviceID, new byte [] { (byte)CommonPage.RandomHigh, (byte)CommonPage.RandomLow });
|
CommonPage.LocalPhoneFindDevice = false;
|
|
Application.RunOnMainThread (() => {
|
SystemMiddle.ThirdScrolView.RemoveAll ();
|
EquipmentBaseViewShow (common);
|
});
|
});
|
};
|
}
|
/// <summary>
|
/// 读取设备信息
|
/// </summary>
|
void LoadDevice (Common device)
|
{
|
string ReadStr = "_" + device.SubnetID.ToString () + "_" + device.DeviceID.ToString () + "_";
|
List<string> localEquipmentList = new List<string> ();
|
foreach (string equipment in IO.FileUtils.ReadFiles ().FindAll ((obj) => obj.Split ('_') [0] == "Equipment")) {
|
if (equipment.Contains (ReadStr) && equipment.Split ('_').Length == 5) {
|
if (device.Type.ToString () == typeof (LightLogic).Name || (equipment.Contains (device.Type.ToString ())))
|
localEquipmentList.Add (equipment);
|
}
|
}
|
if (localEquipmentList.Count != 0) {//&& device.Type != DeviceType.ButtonPanel && ts.TotalMinutes < 30) {
|
return;
|
}
|
byte bigClass = device.BigClass;
|
byte minClass = device.MinClass;
|
int count = device.LoopCount;
|
|
CommonPage.DeviceLoopList.Clear ();
|
|
for (int i = 1, j = 0; i <= count; i++) {
|
var loopBytes = Control.ControlBytesSendHasReturn (Command.ReadDeviceLoopInfo, device.SubnetID, device.DeviceID,
|
new byte [] { bigClass, minClass, (byte)i });
|
if (loopBytes == null) {
|
while (SystemWirelessGateway.Waiting) {
|
System.Threading.Thread.Sleep (100);
|
}
|
j++;
|
//连续两次读取不到数据则跳出该循环
|
if (j == 2 && i == 2)
|
break;
|
}
|
}
|
}
|
|
/// <summary>
|
/// 显示设备列表
|
/// </summary>
|
void LoadInterface (EventHandler<MouseEventArgs> eHandler, string textName,string tag)
|
{
|
RowLayout frameLayout1 = new RowLayout () {
|
Width = LayoutParams.MatchParent,
|
Height = Application.GetRealHeight (131),
|
};
|
frameLayout1.MouseUpEventHandler += eHandler;
|
SystemMiddle.SecondScrolView.AddChidren (frameLayout1);
|
|
|
Button nameButton = new Button () {
|
Text = textName,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth (80),
|
SelectedTextColor = SkinStyle.Current.SelectedColor,
|
TextColor = SkinStyle.Current.TextColor1,
|
Tag = tag
|
};
|
nameButton.MouseUpEventHandler += eHandler;
|
frameLayout1.AddChidren (nameButton);
|
|
Button pointButton = new Button () {
|
Width = Application.GetRealHeight (13),
|
Height = Application.GetRealHeight (13),
|
X = Application.GetRealWidth (40),
|
UnSelectedImagePath = "Item/Point.png",
|
SelectedImagePath = "Item/PointSelected.png",
|
Gravity = Gravity.CenterVertical,
|
Tag = tag
|
};
|
frameLayout1.AddChidren (pointButton);
|
|
Button btnNul = new Button () {
|
Y = Application.GetRealHeight (131) - 2,
|
Height = 1,
|
BackgroundColor = SkinStyle.Current.MainColor,
|
};
|
frameLayout1.AddChidren (btnNul);
|
Button btnNull = new Button () {
|
Y = Application.GetRealHeight (131) - 1,
|
Height = 1,
|
BackgroundColor = 0xFF2f2f2f,
|
};
|
frameLayout1.AddChidren (btnNull);
|
}
|
|
/// <summary>
|
/// 加载设备数据
|
/// </summary>
|
void InitDevicesList (List<string> listDevice,Common device )
|
{
|
RowLayout fl = new RowLayout () {
|
Width = LayoutParams.MatchParent,
|
Height = Application.GetRealHeight (131),
|
BackgroundColor = SkinStyle.Current.MainColor
|
};
|
SystemMiddle.SecondScrolView.AddChidren (fl);
|
|
Button btnDeviceName =new Button(){
|
Width = Application.GetRealWidth (303),
|
Height = Application.GetRealHeight (55),
|
X = Application.GetRealWidth (50),
|
Gravity = Gravity.CenterVertical,
|
TextAlignment = TextAlignment.CenterLeft,
|
};
|
fl.AddChidren (btnDeviceName);
|
|
try
|
{
|
//设备界面要显示的设备,必须在这里添加显示
|
for (int i = 0; i < listDevice.Count; i++) {
|
if (listDevice [i].Split ('_').Length == 5) {
|
//listDevice [i].Remove (listDevice [i].Length - 3);
|
if (listDevice [i].Split ('_') [1].Contains (DeviceType.LightDimming.ToString ()) || listDevice [i].Split ('_') [1].Contains (DeviceType.LightMixDimming.ToString ())) {
|
btnDeviceName.TextID = R.MyInternationalizationString.DimmingLights;
|
LightDimming lightDimming = Newtonsoft.Json.JsonConvert.DeserializeObject<LightDimming> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
SystemMiddle.SecondScrolView.SelectedInVerticalScrolViewFrameLayoutButton (lightDimming.CommonLoopID);
|
new SystemLightDimming ().SystemLightDimmingShow (lightDimming, device);
|
});
|
LoadInterface (clickEventHandler, lightDimming.Name,lightDimming.CommonLoopID);
|
} else if (listDevice [i].Split ('_') [1].Contains (DeviceType.LightRGB.ToString ())) {
|
btnDeviceName.TextID = R.MyInternationalizationString.DimmingLights;
|
LightLogic lightRGB = Newtonsoft.Json.JsonConvert.DeserializeObject<LightLogic> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
SystemMiddle.SecondScrolView.SelectedInVerticalScrolViewFrameLayoutButton (lightRGB.CommonLoopID);
|
new SystemLightLogic ().SystemLightLogicShow (lightRGB, device);
|
});
|
LoadInterface (clickEventHandler, lightRGB.Name,lightRGB.CommonLoopID);
|
} else if (listDevice [i].Split ('_') [1].Contains (DeviceType.LightMixSwitch.ToString ()) || listDevice [i].Split ('_') [1].Contains (DeviceType.LightSwitch.ToString ()) || listDevice [i].Split ('_') [1].Contains (DeviceType.LightEnergySwitch.ToString ())) {
|
btnDeviceName.TextID = R.MyInternationalizationString.SwitchLights;
|
LightSwitch lightSwitch = Newtonsoft.Json.JsonConvert.DeserializeObject<LightSwitch> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
SystemMiddle.SecondScrolView.SelectedInVerticalScrolViewFrameLayoutButton (lightSwitch.CommonLoopID);
|
new SystemLightSwitch ().SystemLightSwitchShow (lightSwitch, device);
|
});
|
LoadInterface (clickEventHandler, lightSwitch.Name,lightSwitch.CommonLoopID);//, btnSwitchLight);
|
} else if (listDevice [i].Split ('_') [1].Contains (DeviceType.LightCCT.ToString ())
|
//|| listDevice [i].Split ('_') [1].Contains (DeviceType.LightRGB.ToString ())
|
|| listDevice [i].Split ('_') [1].Contains (DeviceType.LightRGBW.ToString ())
|
|| listDevice [i].Split ('_') [1].Contains (DeviceType.LightRGBandCCT.ToString ())) {
|
btnDeviceName.TextID = R.MyInternationalizationString.DimmingLights;//------------------dddddddddddddddddddd
|
LightLogic lightLogic = Newtonsoft.Json.JsonConvert.DeserializeObject<LightLogic> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
//new SystemLightDimming ().SystemLightDimmingShow (lightDimming, device);
|
});
|
//LoadInterface (clickEventHandler, lightLogic.Name);
|
} else if (listDevice [i].Split ('_') [1].Contains (DeviceType.ButtonPanel.ToString ())) {
|
btnDeviceName.TextID = R.MyInternationalizationString.ButtonKey;
|
ButtonPanel wpButtonKey = Newtonsoft.Json.JsonConvert.DeserializeObject<ButtonPanel> (
|
System.Text.Encoding.UTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
SystemMiddle.SecondScrolView.SelectedInVerticalScrolViewFrameLayoutButton (wpButtonKey.CommonLoopID);
|
new SystemPanel ().SystemWirelessPanelButtonKeyShow (wpButtonKey, device);
|
});
|
LoadInterface (clickEventHandler, wpButtonKey.Name,wpButtonKey.CommonLoopID);
|
} else if (listDevice [i].Split ('_') [1].Contains (DeviceType.CurtainModel.ToString ())) {
|
btnDeviceName.TextID = R.MyInternationalizationString.CurtainModel;
|
CurtainModel curtainModel = Newtonsoft.Json.JsonConvert.DeserializeObject<CurtainModel> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
SystemMiddle.SecondScrolView.SelectedInVerticalScrolViewFrameLayoutButton (curtainModel.CommonLoopID);
|
new SystemCurtainModel ().SystemCurtainModelShow (curtainModel, device);
|
});
|
|
LoadInterface (clickEventHandler, curtainModel.Name,curtainModel.CommonLoopID);
|
} else if (listDevice [i].Split ('_') [1].Contains (DeviceType.CurtainTrietex.ToString ())) {
|
btnDeviceName.TextID = R.MyInternationalizationString.CurtainTrietex;
|
CurtainTrietex curtainTrietex = Newtonsoft.Json.JsonConvert.DeserializeObject<CurtainTrietex> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
SystemMiddle.SecondScrolView.SelectedInVerticalScrolViewFrameLayoutButton (curtainTrietex.CommonLoopID);
|
new SystemCurtainTrietex ().SystemCurtainTrietexShow (curtainTrietex, device);
|
});
|
|
LoadInterface (clickEventHandler, curtainTrietex.Name,curtainTrietex.CommonLoopID);
|
} else if (listDevice [i].Split ('_') [1].Contains (DeviceType.CurtainRoller.ToString ())) {
|
btnDeviceName.TextID = R.MyInternationalizationString.CurtainRoller;
|
CurtainRoller curtainRoller = Newtonsoft.Json.JsonConvert.DeserializeObject<CurtainRoller> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
SystemMiddle.SecondScrolView.SelectedInVerticalScrolViewFrameLayoutButton (curtainRoller.CommonLoopID);
|
new SystemCurtainRoller ().SystemCurtainRollerShow (curtainRoller, device);
|
});
|
|
LoadInterface (clickEventHandler, curtainRoller.Name,curtainRoller.CommonLoopID);
|
} else if (listDevice [i].Split ('_') [1] == DeviceType.HVAC.ToString ()) {
|
btnDeviceName.TextID = R.MyInternationalizationString.ACHost;
|
btnDeviceName.Text += ":";
|
HVAC acHost = Newtonsoft.Json.JsonConvert.DeserializeObject<HVAC> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
SystemMiddle.SecondScrolView.SelectedInVerticalScrolViewFrameLayoutButton (acHost.CommonLoopID);
|
new SystemACHost ().ShowACHost (acHost, device);
|
});
|
LoadInterface (clickEventHandler, acHost.Name,acHost.CommonLoopID);
|
} else if (listDevice [i].Split ('_') [1] == DeviceType.ACPanel.ToString ()) {
|
btnDeviceName.TextID = R.MyInternationalizationString.ACPanel;
|
ACPanel acHost = Newtonsoft.Json.JsonConvert.DeserializeObject<ACPanel> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
SystemMiddle.SecondScrolView.SelectedInVerticalScrolViewFrameLayoutButton (acHost.CommonLoopID);
|
byte [] deviceBytes = IO.FileUtils.ReadFile ("Equipment_ButtonPanel_" + device.SubnetID + "_" + device.DeviceID);
|
string deviceString = CommonPage.MyEncodingUTF8.GetString (deviceBytes);
|
ButtonPanel bp = Newtonsoft.Json.JsonConvert.DeserializeObject<ButtonPanel> (deviceString);
|
new SystemACPanel ().ShowSystemACPanel (acHost, bp);
|
});
|
|
LoadInterface (clickEventHandler, acHost.Name,acHost.CommonLoopID);
|
btnDeviceName.Text += ":";
|
} else if (listDevice [i].Split ('_') [1] == DeviceType.FoolHeat.ToString ()) {
|
FoolHeat terrestrialHeat = Newtonsoft.Json.JsonConvert.DeserializeObject<FoolHeat> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
btnDeviceName.TextID = R.MyInternationalizationString.FoolHeat;
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
SystemMiddle.SecondScrolView.SelectedInVerticalScrolViewFrameLayoutButton (terrestrialHeat.CommonLoopID);
|
new SystemFoolHeat ().SystemTerrestrialHeatShow (terrestrialHeat, device);
|
});
|
LoadInterface (clickEventHandler, terrestrialHeat.Name,terrestrialHeat.CommonLoopID);
|
} else if (listDevice [i].Split ('_') [1] == (DeviceType.FoolHeatPanel.ToString ())) {
|
btnDeviceName.TextID = R.MyInternationalizationString.TerrestrialHeatPanel;
|
FoolHeatPanel terrestrialHeat = Newtonsoft.Json.JsonConvert.DeserializeObject<FoolHeatPanel> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
SystemMiddle.SecondScrolView.SelectedInVerticalScrolViewFrameLayoutButton (terrestrialHeat.CommonLoopID);
|
byte [] deviceBytes = IO.FileUtils.ReadFile ("Equipment_ButtonPanel_" + device.SubnetID + "_" + device.DeviceID);
|
string deviceString = CommonPage.MyEncodingUTF8.GetString (deviceBytes);
|
ButtonPanel bp = Newtonsoft.Json.JsonConvert.DeserializeObject<ButtonPanel> (deviceString);
|
|
new SystemFloorHeatingPanel ().ShowSystemFloorHeatingPanel (terrestrialHeat, bp);
|
});
|
LoadInterface (clickEventHandler, terrestrialHeat.Name,terrestrialHeat.CommonLoopID);
|
} else if (listDevice [i].Split ('_') [1].Contains (DeviceType.DryContact.ToString ())) {
|
btnDeviceName.TextID = R.MyInternationalizationString.DryContactPanel;
|
DryContact dcp = Newtonsoft.Json.JsonConvert.DeserializeObject<DryContact> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
SystemMiddle.SecondScrolView.SelectedInVerticalScrolViewFrameLayoutButton (dcp.CommonLoopID);
|
new SystemPanel ().SystemWirelessPanelButtonKeyShow (dcp, device);
|
});
|
|
LoadInterface (clickEventHandler, dcp.Name,dcp.CommonLoopID);
|
} else if (listDevice [i].Split ('_') [1].Contains (DeviceType.InfraredMode.ToString ())) {
|
btnDeviceName.TextID = R.MyInternationalizationString.InfraredEquipments;
|
InfraredMode infrared = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
SystemMiddle.SecondScrolView.SelectedInVerticalScrolViewFrameLayoutButton (infrared.CommonLoopID);
|
new SystemInfrared ().ShowSystemInfrared (infrared, device);
|
});
|
LoadInterface (clickEventHandler, infrared.Name, infrared.CommonLoopID);
|
} else if (listDevice [i].Split ('_') [1].Contains (DeviceType.ACInfrared.ToString ())) {
|
btnDeviceName.TextID = R.MyInternationalizationString.ACIfrared;
|
InfraredMode acInfrared = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
SystemMiddle.SecondScrolView.SelectedInVerticalScrolViewFrameLayoutButton (acInfrared.CommonLoopID);
|
byte [] deviceBytes = IO.FileUtils.ReadFile ("Equipment_InfraredMode_" + device.SubnetID + "_" + device.DeviceID);
|
string deviceString = CommonPage.MyEncodingUTF8.GetString (deviceBytes);
|
InfraredMode im = Newtonsoft.Json.JsonConvert.DeserializeObject<InfraredMode> (deviceString);
|
new SystemInfrared ().ShowSystemInfrared (acInfrared, im, true);
|
});
|
LoadInterface (clickEventHandler, acInfrared.Name,acInfrared.CommonLoopID);
|
} else if (listDevice [i].Split ('_') [1].Contains (DeviceType.MusicModel.ToString ())) {
|
btnDeviceName.TextID = R.MyInternationalizationString.MusicModel;
|
MusicModel acInfrared = Newtonsoft.Json.JsonConvert.DeserializeObject<MusicModel> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
SystemMiddle.SecondScrolView.SelectedInVerticalScrolViewFrameLayoutButton (acInfrared.CommonLoopID);
|
byte [] deviceBytes = IO.FileUtils.ReadFile ("Equipment_" + DeviceType.MusicModel.ToString () + device.SubnetID + "_" + device.DeviceID);
|
string deviceString = CommonPage.MyEncodingUTF8.GetString (deviceBytes);
|
});
|
LoadInterface (clickEventHandler, acInfrared.Name,acInfrared.CommonLoopID);
|
} else if (listDevice [i].Split ('_') [1].Contains (DeviceType.FanModule.ToString ())) {
|
btnDeviceName.TextID = R.MyInternationalizationString.Fan;
|
FanModule fanModule = Newtonsoft.Json.JsonConvert.DeserializeObject<FanModule> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
SystemMiddle.SecondScrolView.SelectedInVerticalScrolViewFrameLayoutButton (fanModule.CommonLoopID);
|
byte [] deviceBytes = IO.FileUtils.ReadFile ("Equipment_" + DeviceType.FanModule.ToString () + device.SubnetID + "_" + device.DeviceID);
|
string deviceString = CommonPage.MyEncodingUTF8.GetString (deviceBytes);
|
new SystemFan ().SystemFanShow (fanModule, device);
|
});
|
|
LoadInterface (clickEventHandler, fanModule.Name, fanModule.CommonLoopID);
|
} else if (listDevice [i].Split ('_') [1].Contains (DeviceType.MusicPanel.ToString ())) {
|
btnDeviceName.TextID = R.MyInternationalizationString.MusicPanel;
|
MusicPanel musicPanel = Newtonsoft.Json.JsonConvert.DeserializeObject<MusicPanel> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
EventHandler<MouseEventArgs> clickEventHandler = new EventHandler<MouseEventArgs> (delegate (object sender, MouseEventArgs e) {
|
SystemMiddle.SecondScrolView.SelectedInVerticalScrolViewFrameLayoutButton (musicPanel.CommonLoopID);
|
byte [] deviceBytes = IO.FileUtils.ReadFile ("Equipment_" + DeviceType.MusicPanel.ToString () + device.SubnetID + "_" + device.DeviceID);
|
string deviceString = CommonPage.MyEncodingUTF8.GetString (deviceBytes);
|
new SystemMusicPanel ().ShowSystemMusicPanel (musicPanel, device);
|
});
|
LoadInterface (clickEventHandler, musicPanel.Name,musicPanel.CommonLoopID);
|
} else if (listDevice [i].Split ('_') [1].Contains (DeviceType.LogicModule.ToString ())) {
|
btnDeviceName.TextID = R.MyInternationalizationString.LogicModule;
|
LogicModule logicModule = Newtonsoft.Json.JsonConvert.DeserializeObject<LogicModule> (
|
CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (listDevice [i])));
|
|
LoadInterface (null, logicModule.Name,null);
|
}
|
}
|
}
|
}
|
catch (Exception ex){
|
Console.WriteLine ("SystemEquipmentBase,AddDevicesList" + ex.ToString ());
|
}
|
}
|
}
|
}
|