using System;
|
using System.Collections.Generic;
|
using Shared.SimpleControl.Phone.Music;
|
|
namespace Shared.SimpleControl.Phone
|
{
|
public static class UserDeviceView
|
{
|
public static void DeviceMode ()
|
{
|
FrameLayout topView = new FrameLayout () {
|
Y = Application.GetRealHeight (36),
|
Height = Application.GetRealHeight (90),
|
Width = Application.GetRealWidth (640),
|
BackgroundColor = SkinStyle.Current.MainColor,
|
};
|
UserMiddle.DeviceBodyView.AddChidren (topView);
|
|
//Button LogoButton = new Button () {
|
// Y = Application.GetRealHeight (10),
|
// Width = Application.GetRealWidth (154),
|
// Height = Application.GetRealHeight (90),
|
// UnSelectedImagePath = MainPage.WiFiStatus,
|
//};
|
//topView.AddChidren (LogoButton);
|
//LogoButton.MouseUpEventHandler += (dd, ff) => {
|
// EquipmentPublicClass.CheckLinkRemote (UserConfig.Instance.internetStatus, LogoButton);
|
//};
|
topView.AddChidren (UserMiddle.btnLinkStatus);
|
|
Button NameButton = new Button () {
|
Width = Application.GetRealWidth (400),
|
Height = Application.GetMinReal (90),
|
TextID = R.MyInternationalizationString.Category,
|
TextColor = SkinStyle.Current.TextColor1,
|
Gravity = Gravity.CenterHorizontal,
|
TextAlignment = TextAlignment.Center,
|
TextSize = 20,
|
//FontName = "TitilliumText25L"
|
};
|
topView.AddChidren (NameButton);
|
|
//要显示的设备类型先在这里加进文本选择
|
List<string> deviceTypes = new List<string> (){
|
Language.StringByID (R.MyInternationalizationString.AC),
|
Language.StringByID (R.MyInternationalizationString.Lights),
|
Language.StringByID (R.MyInternationalizationString.Curtain),
|
Language.StringByID (R.MyInternationalizationString.Scenes),
|
Language.StringByID (R.MyInternationalizationString.FoolHeat),
|
//Language.StringByID (R.MyInternationalizationString.Monitor),
|
Language.StringByID (R.MyInternationalizationString.Security),
|
Language.StringByID (R.MyInternationalizationString.TV),
|
Language.StringByID (R.MyInternationalizationString.Music),
|
Language.StringByID (R.MyInternationalizationString.ElectricalControl),
|
Language.StringByID (R.MyInternationalizationString.Fan),
|
//Language.StringByID(R.MyInternationalizationString.Projector),
|
Language.StringByID (R.MyInternationalizationString.DoorLock),
|
Language.StringByID (R.MyInternationalizationString.UniversalDevice),
|
Language.StringByID (R.MyInternationalizationString.Environmental),
|
Language.StringByID (R.MyInternationalizationString.FreshAir),
|
|
};
|
foreach (int hideTypes in UserConfig.Instance.HideDeviceTypes) {
|
string hideTypeString = Language.StringByID (hideTypes);
|
#if HDL
|
if (hideTypes == R.MyInternationalizationString.Monitor) {
|
continue;
|
}
|
#endif
|
deviceTypes.Remove (hideTypeString);
|
}
|
UserMiddle.DeviceView.RemoveAll ();
|
Button btnRowLine = new Button () {
|
Height = Application.GetRealHeight (5),
|
BackgroundColor = SkinStyle.Current.UserMenuItemButton
|
};
|
UserMiddle.DeviceView.AddChidren (btnRowLine);
|
if (!string.IsNullOrEmpty (MainPage.LoginUser.AllVisionRegisterDevUserNameGuid)) {
|
deviceTypes.Add (Language.StringByID (R.MyInternationalizationString.VideoIntercom));
|
}
|
FrameLayout rowLayout = null;
|
for (int i = 0; i < deviceTypes.Count; i++) {
|
if (i % 2 == 0) {
|
rowLayout = new FrameLayout () {
|
Height = Application.GetRealWidth (232),
|
Width = Application.GetRealWidth (640),
|
BackgroundColor = SkinStyle.Current.UserMenuItemButton
|
};
|
UserMiddle.DeviceView.AddChidren (rowLayout);
|
}
|
FrameLayout equipmentLayout = new FrameLayout () {
|
Width = Application.GetRealWidth (318),
|
Height = Application.GetRealWidth (227),
|
};
|
equipmentLayout.AddTag ("DeviceType", deviceTypes [i]);
|
rowLayout.AddChidren (equipmentLayout);
|
if (i % 2 == 1) {
|
equipmentLayout.Width = Application.GetRealWidth (318);
|
equipmentLayout.X = Application.GetRealWidth (323);
|
}
|
|
Button btnEquipmentIcon = new Button () {
|
Width = Application.GetMinRealAverage (128),
|
Height = Application.GetMinRealAverage (136),
|
Gravity = Gravity.CenterHorizontal,
|
Y = Application.GetRealHeight (20),
|
};
|
equipmentLayout.AddChidren (btnEquipmentIcon);
|
|
Button btnEquipmentName = new Button () {
|
Width = Application.GetRealWidth (232),
|
Height = Application.GetRealHeight (45),
|
Gravity = Gravity.CenterHorizontal,
|
Y = btnEquipmentIcon.Bottom,
|
Text = deviceTypes [i],
|
Enable = false,
|
TextColor = SkinStyle.Current.TextColor1
|
};
|
equipmentLayout.AddChidren (btnEquipmentName);
|
|
Button btnOpenNumber = new Button () {
|
Width = Application.GetRealWidth (50),
|
Height = Application.GetRealHeight (35),
|
X = Application.GetRealWidth (248),
|
Y = Application.GetRealHeight (30),
|
UnSelectedImagePath = "Item/LightingCount.png",
|
SelectedImagePath = "Item/LightingCountSelected.png",
|
Enable = false,
|
Text = "0",
|
TextAlignment = TextAlignment.Center,
|
TextColor = SkinStyle.Current.TextColor1
|
};
|
btnOpenNumber.AddTag ("DeviceType", deviceTypes [i]);
|
equipmentLayout.AddChidren (btnOpenNumber);
|
setEquipmentsBackGroud (deviceTypes [i], btnEquipmentIcon, equipmentLayout, btnOpenNumber, equipmentLayout);
|
}
|
System.Threading.Tasks.Task.Run (() => {
|
UserDeviceToLight.readAllStatus ();
|
UserDeviceToSocket.readAllStatus ();
|
UserDeviceToAC.readAllStatus ();
|
UserDeviceToFH.readAllStatus ();
|
UserFresAirList.readAllStatus ();
|
});
|
}
|
|
public static void UpdataDeviceCountNumber (int count, string tagFalg)
|
{
|
try {
|
Application.RunOnMainThread (() => {
|
for (int i = 0; i < UserMiddle.DeviceView.ChildrenCount; i++) {
|
if (UserMiddle.DeviceView.GetChildren (i).GetType () == typeof (FrameLayout)) {
|
FrameLayout rowView = (FrameLayout)UserMiddle.DeviceView.GetChildren (i);
|
for (int j = 0; j < rowView.ChildrenCount; j++) {
|
if (rowView.GetChildren (j).GetType () == typeof (FrameLayout)) {
|
FrameLayout frameView = (FrameLayout)rowView.GetChildren (j);
|
if (frameView.GetTagByKey ("DeviceType").ToString () == tagFalg) {
|
for (int k = 0; k < frameView.ChildrenCount; k++) {
|
if (frameView.GetChildren (k).GetType () == typeof (Button)) {
|
Button btn = (Button)frameView.GetChildren (k);
|
if (btn.GetTagByKey ("DeviceType") != null && btn.GetTagByKey ("DeviceType").ToString () == tagFalg) {
|
if (count > 0) {
|
btn.Text = count.ToString ();
|
btn.IsSelected = true;
|
} else if ( count == 0) {
|
//Application.RunOnMainThread (() => {
|
try {
|
int eCount = 0;
|
foreach (var room in Room.Lists) {
|
if (string.IsNullOrEmpty (room.Name)) {
|
continue;
|
}
|
if (tagFalg == Language.StringByID (R.MyInternationalizationString.Lights)) {
|
var devices = room.DeviceList.FindAll ((obj) => {
|
return obj.Type == DeviceType.LightDimming || obj.Type == DeviceType.LightSwitch || obj.Type == DeviceType.LightRGB || obj.Type == DeviceType.LightEnergySwitch ||
|
obj.Type == DeviceType.LightMixSwitch || obj.Type == DeviceType.LightMixDimming ;
|
});
|
eCount += devices.Count;
|
} else if (tagFalg == Language.StringByID (R.MyInternationalizationString.ElectricalControl)) {
|
var devices = room.DeviceList.FindAll ((obj) => {
|
return obj.Type == DeviceType.LightSwitchSocket || obj.Type == DeviceType.LightEnergySocket;
|
});
|
eCount += devices.Count;
|
} else if (tagFalg == Language.StringByID (R.MyInternationalizationString.AC)) {
|
var devices = room.DeviceList.FindAll ((obj) => {
|
return obj.Type == DeviceType.HVAC || obj.Type == DeviceType.ACInfrared || obj.Type == DeviceType.ACPanel;
|
});
|
eCount += devices.Count;
|
} else if (tagFalg == Language.StringByID (R.MyInternationalizationString.Fan)) {
|
var devices = room.DeviceList.FindAll ((obj) => {
|
return obj.Type == DeviceType.FanModule;
|
});
|
eCount += devices.Count;
|
} else if (tagFalg == Language.StringByID (R.MyInternationalizationString.FreshAir)) {
|
var devices = room.DeviceList.FindAll ((obj) => {
|
return obj.Type == DeviceType.FreshAir;
|
});
|
eCount += devices.Count;
|
}
|
}
|
btn.Text = eCount.ToString ();
|
btn.IsSelected = false;
|
} catch {
|
}
|
//});
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
});
|
} catch {
|
}
|
}
|
|
//static void DelUserEquipmentView (int deviceCount, int deviceType)
|
//{
|
// if (deviceCount == 0) {
|
// Alert alert = new Alert ("",
|
// Language.StringByID (R.MyInternationalizationString.DeleteDeviceCategories),
|
// Language.StringByID (R.MyInternationalizationString.Cancel),
|
// Language.StringByID (R.MyInternationalizationString.Confrim));
|
// alert.Show ();
|
// alert.ResultEventHandler += (sender2, e2) => {
|
// if (e2) {
|
// UserConfig.Instance.HideDeviceTypes.Add (deviceType);
|
// UserConfig.Instance.SaveUserConfig ();
|
// DeviceMode ();
|
// }
|
// };
|
// }
|
//}
|
|
/// <summary>
|
/// 设备到房间模式显示用户主界面的
|
/// </summary>
|
static void setEquipmentsBackGroud (string equipmentType, Button btnEquipment, FrameLayout fl, Button btnOpenNumber, FrameLayout equipmentLayout)
|
{
|
if (equipmentType == Shared.Language.StringByID (R.MyInternationalizationString.Lights)) {
|
btnEquipment.UnSelectedImagePath = "Item/Light.png";
|
btnEquipment.SelectedImagePath = "Item/LightSelected.png";
|
int eCount = 0;
|
int brighingCount = 0;
|
|
System.Threading.Tasks.Task.Run (() => {
|
foreach (var room in Room.Lists) {
|
if (string.IsNullOrEmpty (room.Name)) {
|
continue;
|
}
|
var devices = room.DeviceList.FindAll ((obj) => {
|
return obj.Type == DeviceType.LightDimming || obj.Type == DeviceType.LightSwitch || obj.Type == DeviceType.LightRGB || obj.Type == DeviceType.LightEnergySwitch||
|
obj.Type == DeviceType.LightMixSwitch || obj.Type == DeviceType.LightMixDimming || obj.Type == DeviceType.LightDALI;
|
});
|
eCount += devices.Count;
|
|
foreach (var updataCommon in room.DeviceList) {
|
if (updataCommon.Type == DeviceType.LightDimming || updataCommon.Type == DeviceType.LightMixDimming || updataCommon.Type == DeviceType.LightDALI) {
|
if ((updataCommon as LightDimming).CurrentBrightness > 0)
|
brighingCount++;
|
} else if (updataCommon.Type == DeviceType.LightSwitch || updataCommon.Type == DeviceType.LightMixSwitch|| updataCommon.Type == DeviceType.LightEnergySwitch) {
|
if ((updataCommon as LightSwitch).CurrentBrightness == 100) {
|
brighingCount++;
|
}
|
}else if (updataCommon.Type == DeviceType.LightRGB) {
|
if ((updataCommon as LightLogic).CurrentBrightness > 0) {
|
brighingCount++;
|
}
|
}
|
}
|
}
|
Application.RunOnMainThread (() => {
|
if (brighingCount > 0) {
|
eCount = brighingCount;
|
btnOpenNumber.IsSelected = true;
|
}
|
btnOpenNumber.Text = eCount.ToString ();
|
});
|
});
|
|
btnEquipment.MouseUpEventHandler += (sender, e) => {
|
var lightView = new UserDeviceToLight ();
|
UserMiddle.DevicePageView.AddChidren (lightView);
|
lightView.showAllRoomLights ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
UserMiddle.DevicePageView.ScrollEnabled = false;
|
};
|
fl.MouseUpEventHandler += (sender, e) => {
|
var lightView = new UserDeviceToLight ();
|
UserMiddle.DevicePageView.AddChidren (lightView);
|
lightView.showAllRoomLights ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
//UserMiddle.DevicePageView.ScrollEnabled = false;
|
};
|
//btnEquipment.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.Lights);
|
//};
|
//fl.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.Lights);
|
//};
|
equipmentLayout.BackgroundImagePath = "Item/LightBackground.png";
|
}
|
else if (equipmentType == Shared.Language.StringByID (R.MyInternationalizationString.AC)) {
|
btnEquipment.UnSelectedImagePath = "AC/AC.png";
|
btnEquipment.SelectedImagePath = "AC/ACSelected.png";
|
int eCount = 0;
|
int acOponeCount = 0;
|
|
System.Threading.Tasks.Task.Run (() => {
|
foreach (var room in Room.Lists) {
|
if (string.IsNullOrEmpty (room.Name)) {
|
continue;
|
}
|
var devices = room.DeviceList.FindAll ((obj) => {
|
return obj.Type == DeviceType.HVAC || obj.Type == DeviceType.ACInfrared || obj.Type == DeviceType.ACPanel;
|
});
|
eCount += devices.Count;
|
foreach (var acTemp in room.DeviceList) {
|
if (acTemp.Type == DeviceType.HVAC || acTemp.Type == DeviceType.ACInfrared)
|
if ((acTemp as AC).Power == 1) {
|
acOponeCount++;
|
}
|
}
|
}
|
Application.RunOnMainThread (() => {
|
if (acOponeCount > 0) {
|
eCount = acOponeCount;
|
btnOpenNumber.IsSelected = true;
|
}
|
btnOpenNumber.Text = eCount.ToString ();
|
});
|
});
|
|
btnEquipment.MouseUpEventHandler += (sender, e) => {
|
var acView = new UserDeviceToAC ();
|
UserMiddle.DevicePageView.AddChidren (acView);
|
acView.showAllRoomAC ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
fl.MouseUpEventHandler += (sender, e) => {
|
var acView = new UserDeviceToAC ();
|
UserMiddle.DevicePageView.AddChidren (acView);
|
acView.showAllRoomAC ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
//btnEquipment.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.AC);
|
//};
|
//fl.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.AC);
|
//};
|
equipmentLayout.BackgroundImagePath = "AC/ACBackground.png";
|
}
|
else if (equipmentType == Shared.Language.StringByID (R.MyInternationalizationString.TV)) {
|
btnEquipment.UnSelectedImagePath = "Item/TV.png";
|
btnEquipment.SelectedImagePath = "Item/TVSelected.png";
|
int eCount = 0;
|
new System.Threading.Thread (() => {
|
foreach (var room in Room.Lists) {
|
if (string.IsNullOrEmpty (room.Name)) {
|
continue;
|
}
|
var devices = room.DeviceList.FindAll ((obj) => {
|
return obj.Type == DeviceType.InfraredMode && ((InfraredMode)obj).InfraredType == InfraredType.TV;
|
});
|
eCount += devices.Count;
|
}
|
Application.RunOnMainThread (() => {
|
btnOpenNumber.Text = eCount.ToString ();
|
});
|
}) { IsBackground = true}.Start();
|
btnEquipment.MouseUpEventHandler += (sender, e) => {
|
UserDeviceToTV tvView = new UserDeviceToTV ();
|
UserMiddle.DevicePageView.AddChidren (tvView);
|
tvView.ShowAllRoomTV ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
fl.MouseUpEventHandler += (sender, e) => {
|
UserDeviceToTV tvView = new UserDeviceToTV ();
|
UserMiddle.DevicePageView.AddChidren (tvView);
|
tvView.ShowAllRoomTV ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
//btnEquipment.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.TV);
|
//};
|
//fl.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.TV);
|
//};
|
equipmentLayout.BackgroundImagePath = "Item/TVBackground.png";
|
}
|
else if (equipmentType == Shared.Language.StringByID (R.MyInternationalizationString.UniversalDevice)) {
|
btnEquipment.UnSelectedImagePath = "UniversalDevice/UniversalDevice.png";
|
btnEquipment.SelectedImagePath = "UniversalDevice/UniversalDevice.png";
|
int eCount = 0;
|
System.Threading.Tasks.Task.Run (() => {
|
foreach (var room in Room.Lists) {
|
if (string.IsNullOrEmpty (room.Name)) {
|
continue;
|
}
|
var devices = room.DeviceList.FindAll ((obj) => {
|
return obj.Type == DeviceType.UniversalDevice;
|
});
|
eCount += devices.Count;
|
}
|
Application.RunOnMainThread (() => {
|
btnOpenNumber.Text = eCount.ToString ();
|
});
|
});
|
btnEquipment.MouseUpEventHandler += (sender, e) => {
|
UserDeviceToUniversalDevice tvView = new UserDeviceToUniversalDevice ();
|
UserMiddle.DevicePageView.AddChidren (tvView);
|
tvView.ShowUniversalDevice ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
fl.MouseUpEventHandler += (sender, e) => {
|
UserDeviceToUniversalDevice tvView = new UserDeviceToUniversalDevice ();
|
UserMiddle.DevicePageView.AddChidren (tvView);
|
tvView.ShowUniversalDevice ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
//btnEquipment.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.UniversalDevice);
|
//};
|
//fl.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.UniversalDevice);
|
//};
|
equipmentLayout.BackgroundImagePath = "UniversalDevice/UniversalDeviceBackground.png";
|
}
|
else if (equipmentType == Shared.Language.StringByID (R.MyInternationalizationString.Curtain)) {
|
btnEquipment.UnSelectedImagePath = "Curtain/Curtain.png";
|
//btnEquipment.SelectedImagePath = "Item/CurtainSelected.png";
|
int eCount = 0;
|
System.Threading.Tasks.Task.Run (() => {
|
foreach (var room in Room.Lists) {
|
if (string.IsNullOrEmpty (room.Name)) {
|
continue;
|
}
|
var devices = room.DeviceList.FindAll ((obj) => {
|
return obj.Type == DeviceType.CurtainModel || obj.Type == DeviceType.CurtainRoller || obj.Type == DeviceType.CurtainTrietex;
|
});
|
eCount += devices.Count;
|
}
|
Application.RunOnMainThread (() => {
|
btnOpenNumber.Text = eCount.ToString ();
|
});
|
});
|
btnEquipment.MouseUpEventHandler += (sender, e) => {
|
var curtainView = new UserDeviceToCurtains ();
|
UserMiddle.DevicePageView.AddChidren (curtainView);
|
curtainView.showAllRoomCurtain ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
fl.MouseUpEventHandler += (sender, e) => {
|
var curtainView = new UserDeviceToCurtains ();
|
UserMiddle.DevicePageView.AddChidren (curtainView);
|
curtainView.showAllRoomCurtain ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
//btnEquipment.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.Curtain);
|
//};
|
//fl.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.Curtain);
|
//};
|
equipmentLayout.BackgroundImagePath = "Curtain/CurtainBackground.png";
|
}
|
else if (equipmentType == Shared.Language.StringByID (R.MyInternationalizationString.Scenes)) {
|
btnEquipment.UnSelectedImagePath = "Scene/Scene.png";
|
int eCount = 0;
|
System.Threading.Tasks.Task.Run (() => {
|
foreach (var room in Room.Lists) {
|
if (string.IsNullOrEmpty (room.Name)) {
|
continue;
|
}
|
if (room != null) {
|
foreach (var sceneFilePath in room.SceneFilePathList) {
|
var scene = Scene.GetSceneByFilePath (sceneFilePath);
|
if (scene != null)
|
eCount += scene.LoopCount;
|
}
|
}
|
}
|
var globalSceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (Scene.GlobalSceneFilePath)));
|
if (globalSceneList != null) {
|
foreach (var sceneFilePath in globalSceneList) {
|
var scene = Scene.GetSceneByFilePath (sceneFilePath);
|
if (scene == null)
|
continue;
|
eCount += scene.LoopCount;
|
}
|
}
|
|
Application.RunOnMainThread (() => {
|
btnOpenNumber.Text = eCount.ToString ();
|
});
|
});
|
btnEquipment.MouseUpEventHandler += (sender, e) => {
|
var userDeviceToSceneView = new UserDeviceToScene ();
|
UserMiddle.DevicePageView.AddChidren (userDeviceToSceneView);
|
userDeviceToSceneView.ShowAllScene ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
fl.MouseUpEventHandler += (sender, e) => {
|
var userDeviceToSceneView = new UserDeviceToScene ();
|
UserMiddle.DevicePageView.AddChidren (userDeviceToSceneView);
|
userDeviceToSceneView.ShowAllScene ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
equipmentLayout.BackgroundImagePath = "Item/SceneBackground.png";
|
|
}
|
else if (equipmentType == Shared.Language.StringByID (R.MyInternationalizationString.Music)) {
|
btnEquipment.UnSelectedImagePath = "Item/Music.png";
|
btnEquipment.SelectedImagePath = "Item/MusicSelected.png";
|
int eCount = 0;
|
int brighingCount = 0;
|
System.Threading.Tasks.Task.Run (() => {
|
foreach (var room in Room.Lists) {
|
if (string.IsNullOrEmpty (room.Name)) {
|
continue;
|
}
|
var devices = room.DeviceList.FindAll ((obj) => {
|
return obj.Type == DeviceType.MusicModel;
|
});
|
eCount += devices.Count;
|
brighingCount += devices.FindAll ((obj) => ((MusicModel)obj).PlayStatus == MusicModel.Status.Play).Count;
|
}
|
var a31List = A31MusicModel.A31MusicModelList.FindAll ((obj) => obj.IsCanShow);
|
eCount += a31List.Count;
|
brighingCount += a31List.FindAll ((obj) => obj.A31PlayStatus.status == "play").Count;
|
Application.RunOnMainThread (() => {
|
if (brighingCount > 0) {
|
eCount = brighingCount;
|
btnOpenNumber.IsSelected = true;
|
}
|
btnOpenNumber.Text = eCount.ToString ();
|
});
|
});
|
btnEquipment.MouseUpEventHandler += (sender, e) => {
|
MyMusic myMusic = new MyMusic ();
|
UserMiddle.DevicePageView.AddChidren (myMusic);
|
myMusic.Show (false);
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
fl.MouseUpEventHandler += (sender, e) => {
|
MyMusic myMusic = new MyMusic ();
|
UserMiddle.DevicePageView.AddChidren (myMusic);
|
myMusic.Show (false);
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
//btnEquipment.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.Music);
|
//};
|
//fl.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.Music);
|
//};
|
equipmentLayout.BackgroundImagePath = "Item/MusicBackground.png";
|
}
|
else if (equipmentType == Shared.Language.StringByID (R.MyInternationalizationString.Security)) {
|
btnEquipment.UnSelectedImagePath = "Item/Security.png";
|
btnEquipment.SelectedImagePath = "Item/SecuritySelected.png";
|
equipmentLayout.BackgroundImagePath = "Item/SecurityBackground.png";
|
int eCount = 0;
|
System.Threading.Tasks.Task.Run (() => {
|
eCount = IO.FileUtils.ReadFiles ().FindAll ((obj) => obj.Split ('_').Length == 5 && obj.Split ('_') [0] == "Equipment" && obj.Split ('_') [1] == DeviceType.SecurityModule.ToString ()).Count;
|
|
Application.RunOnMainThread (() => {
|
btnOpenNumber.Text = eCount.ToString ();
|
});
|
});
|
btnEquipment.MouseUpEventHandler += (sender, e) => {
|
UserDeviceToSecurity securityView = new UserDeviceToSecurity ();
|
UserMiddle.DevicePageView.AddChidren (securityView);
|
securityView.ShowSecurityView ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
|
//btnEquipment.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.Security);
|
//};
|
//fl.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.Security);
|
//};
|
}
|
else if (equipmentType == Shared.Language.StringByID (R.MyInternationalizationString.Monitor)) {
|
//btnEquipment.UnSelectedImagePath = "Item/Monitor.png";
|
//btnEquipment.SelectedImagePath = "Item/MonitorSelected.png";
|
//equipmentLayout.BackgroundImagePath = "Item/SecurityBackground.png";
|
|
//btnEquipment.MouseUpEventHandler += (sender, e) => {
|
// MonitorType monitorView = new MonitorType ();
|
// UserMiddle.DevicePageView.AddChidren (monitorView);
|
// monitorView.ShowVideoMonitoring ();
|
// UserMiddle.DevicePageView.PageIndex = 1;
|
//};
|
//fl.MouseUpEventHandler += (sender, e) => {
|
// MonitorType monitorView = new MonitorType ();
|
// UserMiddle.DevicePageView.AddChidren (monitorView);
|
// monitorView.ShowVideoMonitoring ();
|
// UserMiddle.DevicePageView.PageIndex = 1;
|
//};
|
//if (MonitorInfo.FilePathList != null)
|
// btnOpenNumber.Text = MonitorInfo.FilePathList.Count.ToString ();
|
//else
|
//btnOpenNumber.Text = "0";
|
|
//btnEquipment.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.Monitor);
|
//};
|
//fl.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.Monitor);
|
//};
|
}
|
else if (equipmentType == Shared.Language.StringByID (R.MyInternationalizationString.Projector)) {
|
btnEquipment.UnSelectedImagePath = "Item/Projector.png";
|
btnEquipment.SelectedImagePath = "Item/ProjectorSelected.png";
|
}
|
else if (equipmentType == Shared.Language.StringByID (R.MyInternationalizationString.FoolHeat)) {
|
btnEquipment.UnSelectedImagePath = "Item/FloorHeating.png";
|
btnEquipment.SelectedImagePath = "Item/FloorHeatingSelected.png";
|
int eCount = 0;
|
int fhOponeCount = 0;
|
System.Threading.Tasks.Task.Run (() => {
|
foreach (var room in Room.Lists) {
|
if (string.IsNullOrEmpty (room.Name)) {
|
continue;
|
}
|
var devices = room.DeviceList.FindAll ((obj) => {
|
return obj.Type == DeviceType.FoolHeat || obj.Type == DeviceType.FoolHeatPanel;
|
});
|
eCount += devices.Count;
|
foreach (var acTemp in room.DeviceList) {
|
if (acTemp.Type == DeviceType.FoolHeat || acTemp.Type == DeviceType.FoolHeatPanel)
|
if ((acTemp as FoolHeat).Status == 1) {
|
fhOponeCount++;
|
}
|
}
|
}
|
Application.RunOnMainThread (() => {
|
if (fhOponeCount > 0) {
|
eCount = fhOponeCount;
|
btnOpenNumber.IsSelected = true;
|
}
|
btnOpenNumber.Text = eCount.ToString ();
|
});
|
});
|
btnEquipment.MouseUpEventHandler += (sender, e) => {
|
UserDeviceToFH userDeviceToFHView = new UserDeviceToFH ();
|
UserMiddle.DevicePageView.AddChidren (userDeviceToFHView);
|
userDeviceToFHView.showAllRoomFH ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
fl.MouseUpEventHandler += (sender, e) => {
|
UserDeviceToFH userDeviceToFHView = new UserDeviceToFH ();
|
UserMiddle.DevicePageView.AddChidren (userDeviceToFHView);
|
userDeviceToFHView.showAllRoomFH ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
//btnEquipment.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.FoolHeat);
|
//};
|
//fl.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.FoolHeat);
|
//};
|
|
equipmentLayout.BackgroundImagePath = "Item/FloorHeatingBackground.png";
|
}
|
else if (equipmentType == Shared.Language.StringByID (R.MyInternationalizationString.ElectricalControl)) {
|
btnEquipment.UnSelectedImagePath = "Light/Socket.png";
|
btnEquipment.SelectedImagePath = "Light/SocketOn.png";
|
equipmentLayout.BackgroundImagePath = "Light/SocketBackground.png";
|
int eCount = 0;
|
int brighingCount = 0;
|
System.Threading.Tasks.Task.Run (() => {
|
foreach (var room in Room.Lists) {
|
if (string.IsNullOrEmpty (room.Name)) {
|
continue;
|
}
|
var devices = room.DeviceList.FindAll ((obj) => {
|
return obj.Type == DeviceType.LightEnergySocket || obj.Type == DeviceType.LightSwitchSocket;
|
});
|
eCount += devices.Count;
|
brighingCount += devices.FindAll ((obj) => { return ((LightSwitch)obj).CurrentBrightness == 100; }).Count;
|
}
|
Application.RunOnMainThread (() => {
|
if (brighingCount > 0) {
|
eCount = brighingCount;
|
btnOpenNumber.IsSelected = true;
|
}
|
btnOpenNumber.Text = eCount.ToString ();
|
});
|
});
|
btnEquipment.MouseUpEventHandler += (sender, e) => {
|
UserDeviceToSocket userDeviceToSocketView = new UserDeviceToSocket ();
|
UserMiddle.DevicePageView.AddChidren (userDeviceToSocketView);
|
userDeviceToSocketView.ShowAllRoomLights ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
fl.MouseUpEventHandler += (sender, e) => {
|
UserDeviceToSocket userDeviceToSocketView = new UserDeviceToSocket ();
|
UserMiddle.DevicePageView.AddChidren (userDeviceToSocketView);
|
userDeviceToSocketView.ShowAllRoomLights ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
//btnEquipment.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.ElectricalControl);
|
//};
|
//fl.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.ElectricalControl);
|
//};
|
}
|
else if (equipmentType == Shared.Language.StringByID (R.MyInternationalizationString.Fan)) {
|
btnEquipment.UnSelectedImagePath = "Fan/Fan.png";
|
btnEquipment.SelectedImagePath = "Fan/Fan.png";
|
equipmentLayout.BackgroundImagePath = "Fan/FanBackground.png";
|
int eCount = 0;
|
int brighingCount = 0;
|
System.Threading.Tasks.Task.Run (() => {
|
foreach (var room in Room.Lists) {
|
if (string.IsNullOrEmpty (room.Name)) {
|
continue;
|
}
|
var devices = room.DeviceList.FindAll ((obj) => {
|
return obj.Type == DeviceType.FanModule;
|
});
|
brighingCount += devices.FindAll ((obj) => { return ((FanModule)obj).Switch != 0; }).Count;
|
eCount += devices.Count;
|
}
|
Application.RunOnMainThread (() => {
|
if (brighingCount > 0) {
|
eCount = brighingCount;
|
btnOpenNumber.IsSelected = true;
|
}
|
btnOpenNumber.Text = eCount.ToString ();
|
});
|
});
|
btnEquipment.MouseUpEventHandler += (sender, e) => {
|
UserDeviceToFan fanView = new UserDeviceToFan ();
|
UserMiddle.DevicePageView.AddChidren (fanView);
|
fanView.ShowAllRoomCurtain ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
fl.MouseUpEventHandler += (sender, e) => {
|
UserDeviceToFan fanView = new UserDeviceToFan ();
|
UserMiddle.DevicePageView.AddChidren (fanView);
|
fanView.ShowAllRoomCurtain ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
//btnEquipment.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.Fan);
|
//};
|
//fl.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.Fan);
|
//};
|
}
|
else if (equipmentType == Shared.Language.StringByID (R.MyInternationalizationString.DoorLock)) {
|
btnEquipment.UnSelectedImagePath = "DoorLockPic/doorLockHomePage.png";
|
btnEquipment.SelectedImagePath = "DoorLockPic/doorLockHomePage.png";
|
equipmentLayout.BackgroundImagePath = "DoorLockPic/door_lock_background.png";
|
List<string> doorLockList = IO.FileUtils.ReadFiles ().FindAll ((obj) => {
|
string [] str = obj.Split ('_');
|
return obj.StartsWith ("Equipment_") && str.Length == 5 && (str [1] == DeviceType.DoorLock.ToString ());
|
});
|
|
btnOpenNumber.Text = doorLockList.Count.ToString ();
|
btnEquipment.MouseUpEventHandler += (sender, e) => {
|
UserDeviceToDoorLock doorLockView = new UserDeviceToDoorLock ();
|
UserMiddle.DevicePageView.AddChidren (doorLockView);
|
doorLockView.ShowAllRoomDoorLock (doorLockList);
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
fl.MouseUpEventHandler += (sender, e) => {
|
UserDeviceToDoorLock doorLockView = new UserDeviceToDoorLock ();
|
UserMiddle.DevicePageView.AddChidren (doorLockView);
|
doorLockView.ShowAllRoomDoorLock (doorLockList);
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
//btnEquipment.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (doorLockList.Count, R.MyInternationalizationString.DoorLock);
|
//};
|
//fl.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (doorLockList.Count, R.MyInternationalizationString.DoorLock);
|
//};
|
}
|
else if (equipmentType == Shared.Language.StringByID (R.MyInternationalizationString.Environmental)) {
|
btnEquipment.SelectedImagePath = "Sensor/Sensor.png";
|
btnEquipment.UnSelectedImagePath = "Sensor/Sensor.png";
|
equipmentLayout.BackgroundImagePath = "Sensor/SensorBackground.png";
|
int eCount = 0;
|
foreach (var room in Room.Lists) {
|
if (string.IsNullOrEmpty (room.Name)) {
|
continue;
|
}
|
var devices = room.DeviceList.FindAll ((common) => {
|
return (common.isMixBox = true && (common.Type == DeviceType.SensorTemperature || common.Type == DeviceType.SensorHumidity
|
|| common.Type == DeviceType.SensorTVOC || common.Type == DeviceType.SensorPM25 || common.Type == DeviceType.SensorCO2
|
// || common.Type == DeviceType.SensorLPG || common.Type == DeviceType.SensorCH4 || common.Type == DeviceType.SensorCOH2
|
//|| common.Type == DeviceType.SensorWater || common.Type == DeviceType.SensorSmoke || common.Type == DeviceType.SensorMobileDetection
|
//|| common.Type == DeviceType.SensorWindSpeed || common.Type == DeviceType.SensorWindPressure || common.Type == DeviceType.SensorLiquidFlow
|
//|| common.Type == DeviceType.SensorLiquidPressure || common.Type == DeviceType.SensorLiquidDepth || common.Type == DeviceType.SensorRainfall
|
//|| common.Type == DeviceType.SensorWeight || common.Type == DeviceType.SensorHeightLength || common.Type == DeviceType.SensorVelocity
|
//|| common.Type == DeviceType.SensorVibration || common.Type == DeviceType.SensorVoltage || common.Type == DeviceType.SensorCurrent || common.Type == DeviceType.SensorPower
|
//|| common.Type == DeviceType.SensorMenciAndwindowMagnetic || common.Type == DeviceType.SensorIllumination
|
));
|
});
|
eCount += devices.Count;
|
}
|
|
btnOpenNumber.Text = eCount.ToString ();
|
btnEquipment.MouseUpEventHandler += (sender, e) => {
|
UserDeviceToSensor doorLockView = new UserDeviceToSensor ();
|
UserMiddle.DevicePageView.AddChidren (doorLockView);
|
doorLockView.ShowAllSensor ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
fl.MouseUpEventHandler += (sender, e) => {
|
UserDeviceToSensor doorLockView = new UserDeviceToSensor ();
|
UserMiddle.DevicePageView.AddChidren (doorLockView);
|
doorLockView.ShowAllSensor ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
//btnEquipment.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.Environmental);
|
//};
|
//fl.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.Environmental);
|
//};
|
}
|
else if (equipmentType == Language.StringByID (R.MyInternationalizationString.FreshAir)) {
|
btnEquipment.SelectedImagePath = "FreshAir/FreshAir.png";
|
btnEquipment.UnSelectedImagePath = "FreshAir/FreshAir.png";
|
equipmentLayout.BackgroundImagePath = "FreshAir/FreshAirBackground.png";
|
int eCount = 0;
|
int brighingCount = 0;
|
System.Threading.Tasks.Task.Run (() => {
|
foreach (var room in Room.Lists) {
|
if (string.IsNullOrEmpty(room.Name)) {
|
continue;
|
}
|
var devices = room.DeviceList.FindAll ((obj) => {
|
return obj.Type == DeviceType.FreshAir;
|
});
|
eCount += devices.Count;
|
brighingCount += devices.FindAll ((obj) => { return ((FreshAir)obj).SwitchStatus == 1; }).Count;
|
}
|
Application.RunOnMainThread (() => {
|
if (brighingCount > 0) {
|
eCount = brighingCount;
|
btnOpenNumber.IsSelected = true;
|
}
|
btnOpenNumber.Text = eCount.ToString ();
|
});
|
});
|
|
btnEquipment.MouseUpEventHandler += (sender, e) => {
|
UserFresAirList freshAirListView = new UserFresAirList ();
|
UserMiddle.DevicePageView.AddChidren (freshAirListView);
|
freshAirListView.ShowAllRoomFreshAir ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
fl.MouseUpEventHandler += (sender, e) => {
|
UserFresAirList freshAirListView = new UserFresAirList ();
|
UserMiddle.DevicePageView.AddChidren (freshAirListView);
|
freshAirListView.ShowAllRoomFreshAir ();
|
UserMiddle.DevicePageView.PageIndex = 1;
|
};
|
//btnEquipment.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.FreshAir);
|
//};
|
//fl.MouseLongEventHandler += (sender, e) => {
|
// DelUserEquipmentView (eCount, R.MyInternationalizationString.FreshAir);
|
//};
|
}
|
}
|
}
|
}
|