using System;
|
using System.Collections.Generic;
|
using Newtonsoft.Json.Linq;
|
using Shared;
|
using Shared.Common;
|
using Shared.Phone;
|
using Shared.R;
|
using ZigBee.Device;
|
namespace Shared.Phone.Device.Logic
|
{
|
public class TemplateDeviceAction:FrameLayout
|
{
|
public TemplateDeviceAction()
|
{
|
Tag = "Logic";
|
}
|
Button roombjButton = new Button();
|
Button roomTextButton = new Button();
|
Button devicetypeButton = new Button();
|
VerticalScrolViewLayout middle;
|
FrameLayout clickframeLayout = new FrameLayout();
|
Button clickbutton = new Button();
|
Button clicktextcolcrbutton = new Button();
|
|
public void Show()
|
{
|
|
UserView.HomePage.Instance.ScrollEnabled = false;
|
this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
|
#region 最上面的布局代码
|
var topRowLayout = new RowLayout
|
{
|
BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
|
Height = Application.GetRealHeight(184),
|
LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
|
};
|
this.AddChidren(topRowLayout);
|
|
var titleName = new Button
|
{
|
TextSize = 16,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
TextAlignment = TextAlignment.CenterLeft,
|
X = Application.GetRealWidth(160),
|
Width = Application.GetRealWidth(600),
|
Height = Application.GetRealHeight(69),
|
Y = Application.GetRealHeight(92),
|
TextID = MyInternationalizationString.devicestate,
|
};
|
topRowLayout.AddChidren(titleName);
|
|
var clickBtn = new Button
|
{
|
Width = Application.GetRealWidth(81 + 51),
|
Height = Application.GetRealHeight(58 + 40),
|
Y = Application.GetRealHeight(98 - 40),
|
};
|
topRowLayout.AddChidren(clickBtn);
|
clickBtn.MouseDownEventHandler += (sender, e) =>
|
{
|
RemoveFromParent();
|
UserView.HomePage.Instance.ScrollEnabled = true;
|
};
|
|
var back = new Button
|
{
|
Width = Application.GetRealWidth(30),
|
Height = Application.GetRealHeight(51),
|
X = Application.GetRealWidth(81),
|
Y = Application.GetRealHeight(98),
|
//Gravity = Gravity.CenterVertical;
|
UnSelectedImagePath = "ZigeeLogic/back.png",
|
};
|
topRowLayout.AddChidren(back);
|
back.MouseDownEventHandler += (sender, e) =>
|
{
|
RemoveFromParent();
|
UserView.HomePage.Instance.ScrollEnabled = true;
|
};
|
|
var foolrname = new Button
|
{
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
TextAlignment = TextAlignment.CenterRight,
|
X = Application.GetRealWidth(1080 - 400 - 120),
|
Width = Application.GetRealWidth(400),
|
Height = Application.GetRealHeight(69),
|
Y = Application.GetRealHeight(92),
|
//TextID = MyInternationalizationString.customroom,
|
Text = Config.Instance.Home.GetCurrentFloorName,
|
};
|
topRowLayout.AddChidren(foolrname);
|
var dropdown = new Button
|
{
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
TextAlignment = TextAlignment.CenterRight,
|
X = foolrname.Right,
|
Width = Application.GetRealWidth(72),
|
Height = Application.GetRealHeight(72),
|
Y = Application.GetRealHeight(92),
|
UnSelectedImagePath = "ZigeeLogic/drop-down.png",
|
};
|
topRowLayout.AddChidren(dropdown);
|
#endregion
|
|
|
///没有房间直接返回去;
|
if (Common.Room.Lists.Count == 0)
|
{
|
return;
|
}
|
///房间滑动控件
|
var roomhorizontalScrol = new HorizontalScrolViewLayout()
|
{
|
Width = Application.GetRealWidth(1080 - 58),
|
Height = Application.GetRealHeight(200),
|
Y = topRowLayout.Bottom,
|
X = Application.GetRealWidth(58),
|
};
|
this.AddChidren(roomhorizontalScrol);
|
|
|
var devicetypehorizontalScrol1 = new HorizontalScrolViewLayout()
|
{
|
Width = Application.GetRealWidth(1080 - 58 - 200),
|
Height = Application.GetRealHeight(280),
|
Y = roomhorizontalScrol.Bottom,
|
BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
|
X = Application.GetRealWidth(58 + 200),
|
};
|
this.AddChidren(devicetypehorizontalScrol1);
|
///设备类型滑动控件
|
var devicetypehorizontalScrol = new HorizontalScrolViewLayout()
|
{
|
Width = Application.GetRealWidth(1080 - 58),
|
Height = Application.GetRealHeight(280),
|
Y = roomhorizontalScrol.Bottom,
|
BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
|
X = Application.GetRealWidth(58),
|
Radius = (uint)Application.GetRealHeight(50),
|
|
};
|
this.AddChidren(devicetypehorizontalScrol);
|
|
middle = new VerticalScrolViewLayout();
|
middle.Y = devicetypehorizontalScrol.Bottom + Application.GetRealHeight(40);
|
middle.Height = Application.GetRealHeight(1920 - 40) - devicetypehorizontalScrol.Bottom;
|
middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
|
middle.X = Application.GetRealWidth(58);
|
middle.Radius = (uint)Application.GetRealHeight(50);
|
this.AddChidren(middle);
|
|
///目前支持的设备
|
List<DeviceType> deviceTypeList = new List<DeviceType> {
|
DeviceType.OnOffOutput,
|
//DeviceType.DimmableLight,
|
//DeviceType.WindowCoveringDevice,
|
//DeviceType.Thermostat,
|
//DeviceType.AirSwitch,
|
};
|
|
|
///楼层点击事件
|
EventHandler<MouseEventArgs> foorlclick = (sender, e) =>
|
{
|
|
var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
|
this.AddChidren(flMain);
|
flMain.MouseUpEventHandler += (sender2, e2) =>
|
{
|
flMain.RemoveFromParent();
|
};
|
var foolrbjicon = new FrameLayout
|
{
|
|
Width = Application.GetRealWidth(450),
|
Height = Application.GetRealHeight(780),
|
X = Application.GetRealWidth(1080 - 468 - 35),
|
Y = Application.GetRealHeight(184),
|
BackgroundImagePath = "Item/SelectFloor_Right.png",
|
};
|
flMain.AddChidren(foolrbjicon);
|
|
var btnfoolrtext = new Button
|
{
|
Width = Application.GetRealWidth(450),
|
Height = Application.GetRealHeight(150),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
X = Application.GetRealWidth(80),
|
TextID = MyInternationalizationString.selecfoolr,
|
};
|
foolrbjicon.AddChidren(btnfoolrtext);
|
|
var foolrbj = new VerticalScrolViewLayout
|
{
|
|
Width = Application.GetRealWidth(450),
|
Height = foolrbjicon.Height - btnfoolrtext.Height,
|
X = Application.GetRealWidth(80),
|
Y = btnfoolrtext.Bottom,
|
};
|
foolrbjicon.AddChidren(foolrbj);
|
|
foreach (var foolr in Config.Instance.Home.FloorDics)
|
{
|
var foolrRowLayout = new RowLayout
|
{
|
Height = Application.GetRealHeight(150),
|
LineColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
|
};
|
foolrbj.AddChidren(foolrRowLayout);
|
|
var btnfoolricon = new Button
|
{
|
Width = Application.GetRealWidth(81),
|
Height = Application.GetRealHeight(81),
|
UnSelectedImagePath = "Floor/Floor.png",
|
Gravity = Gravity.CenterVertical,
|
};
|
foolrRowLayout.AddChidren(btnfoolricon);
|
|
|
var btnfoolrname = new Button
|
{
|
Width = Application.GetRealWidth(250),
|
Height = Application.GetRealHeight(150),
|
Text = foolr.Value,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
|
Tag = foolr.Key,
|
X = btnfoolricon.Right + Application.GetRealWidth(12),
|
};
|
foolrRowLayout.AddChidren(btnfoolrname);
|
if (foolrname.Text == foolr.Value)
|
{
|
btnfoolricon.UnSelectedImagePath = "Floor/FloorSelected.png";
|
btnfoolrname.TextColor = ZigbeeColor.Current.LogicTextBlackColor;
|
}
|
|
EventHandler<MouseEventArgs> foolrnameclick = (sender13, e13) =>
|
{
|
roomhorizontalScrol.RemoveAll();
|
devicetypehorizontalScrol.RemoveAll();
|
middle.RemoveAll();
|
foolrname.Text = btnfoolrname.Text;
|
flMain.RemoveFromParent();
|
var list = Send.GetRoomList(btnfoolrname.Tag.ToString());
|
AllRoomView(list, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol);
|
|
};
|
foolrRowLayout.MouseUpEventHandler += foolrnameclick;
|
btnfoolrname.MouseUpEventHandler += foolrnameclick;
|
|
|
}
|
|
};
|
foolrname.MouseUpEventHandler += foorlclick;
|
dropdown.MouseUpEventHandler += foorlclick;
|
|
///第一次进来
|
var roomlists = new List<Common.Room>();
|
roomlists.Clear();
|
if (Config.Instance.Home.FloorDics.Count < 2)
|
{
|
foolrname.Visible = false;
|
dropdown.Visible = false;
|
if (Config.Instance.Home.FloorDics.Count == 0)
|
{
|
roomlists.AddRange(Common.Room.Lists);
|
}
|
else
|
{
|
roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId);
|
}
|
}
|
else
|
{
|
roomlists = Send.GetRoomList(Config.Instance.Home.CurrentFloorId);
|
|
}
|
AllRoomView(roomlists, deviceTypeList, roomhorizontalScrol, devicetypehorizontalScrol);
|
}
|
/// <summary>
|
/// 加载所有房间的视图方法
|
/// </summary>
|
void AllRoomView(List<Common.Room> roomlist, List<DeviceType> deviceTypeList, HorizontalScrolViewLayout roomhorizontalScrol, HorizontalScrolViewLayout devicetypehorizontalScrol)
|
{
|
for (int i = 0; i < roomlist.Count; i++)
|
{
|
var room = roomlist[i];
|
var fra = new FrameLayout
|
{
|
Height = Application.GetRealHeight(200),
|
Width = Application.GetRealWidth(255),
|
};
|
roomhorizontalScrol.AddChidren(fra);
|
|
var roombjBtn = new Button
|
{
|
Height = Application.GetRealHeight(158),
|
Width = Application.GetRealWidth(255),
|
UnSelectedImagePath = "ZigeeLogic/iconBackgroundColor.png",
|
SelectedImagePath = "ZigeeLogic/iconSelectedBackgroundColor.png",
|
Y = Application.GetRealHeight(21),
|
};
|
fra.AddChidren(roombjBtn);
|
|
var roomnameBtn = new Button
|
{
|
|
Height = Application.GetRealHeight(152 - 26 - 20),
|
Width = Application.GetRealWidth(255 - 20 - 50),
|
Text = room.Name,
|
TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
|
SelectedTextColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
|
Y = Application.GetRealHeight(21 + 13 + 10),
|
X = Application.GetRealWidth(10 + 25),
|
|
};
|
fra.AddChidren(roomnameBtn);
|
if (i == 0)
|
{
|
roombjButton.IsSelected = false;
|
roombjButton = roombjBtn;
|
roombjBtn.IsSelected = true;
|
|
roomTextButton.IsSelected = false;
|
roomTextButton = roomnameBtn;
|
roomnameBtn.IsSelected = true;
|
var list = new List<DeviceUI>();
|
foreach (var device in room.DeviceUIList)
|
{
|
if (device.CommonDevice == null)
|
{
|
continue;
|
}
|
if (!deviceTypeList.Contains(device.CommonDevice.Type))
|
{
|
continue;
|
}
|
list.Add(device);
|
}
|
|
AllDeviceTypeView(list, devicetypehorizontalScrol);
|
|
}
|
|
|
EventHandler<MouseEventArgs> roomclick = (sender, e) =>
|
{
|
roombjButton.IsSelected = false;
|
roombjButton = roombjBtn;
|
roombjBtn.IsSelected = true;
|
|
roomTextButton.IsSelected = false;
|
roomTextButton = roomnameBtn;
|
roomnameBtn.IsSelected = true;
|
var list = new List<DeviceUI>();
|
foreach (var device in room.DeviceUIList)
|
{
|
if (device.CommonDevice == null)
|
{
|
continue;
|
}
|
if (!deviceTypeList.Contains(device.CommonDevice.Type))
|
{
|
continue;
|
}
|
list.Add(device);
|
}
|
AllDeviceTypeView(list, devicetypehorizontalScrol);
|
|
|
};
|
roomnameBtn.MouseUpEventHandler += roomclick;
|
roombjBtn.MouseUpEventHandler += roomclick;
|
|
}
|
}
|
|
/// <summary>
|
///加载该区域所有设备的视图方法
|
/// </summary>
|
void AllDeviceTypeView(List<DeviceUI> devicelist, HorizontalScrolViewLayout devicetypehorizontalScrol)
|
{
|
|
List<string> devicetypelist = new List<string>();
|
devicetypelist.Clear();
|
|
#region ------排列设备类型------
|
var lightjosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.DimmableLight || device.CommonDevice.Type == DeviceType.OnOffOutput);
|
if (lightjosn != null)
|
{
|
devicetypelist.Add(Language.StringByID(MyInternationalizationString.Lights));
|
}
|
var curtainjosn = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.WindowCoveringDevice);
|
if (curtainjosn != null)
|
{
|
devicetypelist.Add(Language.StringByID(MyInternationalizationString.Curtains));
|
}
|
var ac = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.Thermostat);
|
if (ac != null)
|
{
|
devicetypelist.Add(Language.StringByID(MyInternationalizationString.AC));
|
}
|
var airSwitch = devicelist.Find((device) => device.CommonDevice.Type == DeviceType.AirSwitch);
|
if (airSwitch != null)
|
{
|
devicetypelist.Add(Language.StringByID(MyInternationalizationString.Airswitch));
|
}
|
|
#endregion
|
|
devicetypehorizontalScrol.RemoveAll();
|
for (int i = 0; i < devicetypelist.Count; i++)
|
{
|
|
var devicetype = devicetypelist[i];
|
|
var spaceRowLayout = new FrameLayout();
|
devicetypehorizontalScrol.AddChidren(spaceRowLayout);
|
if (i == 0)
|
{
|
spaceRowLayout.Width = Application.GetRealWidth(37);
|
}
|
else
|
{
|
spaceRowLayout.Width = Application.GetRealWidth(80);
|
}
|
|
var deviceRowLayout = new FrameLayout
|
{
|
Width = Application.GetRealWidth(156 + 20),
|
Height = Application.GetRealHeight(280 - 30),
|
Y = Application.GetRealHeight(30),
|
};
|
devicetypehorizontalScrol.AddChidren(deviceRowLayout);
|
|
var backgroundColor = new Button
|
{
|
Width = Application.GetRealWidth(156),
|
Height = Application.GetRealHeight(180),
|
X = Application.GetRealWidth(10),
|
UnSelectedImagePath = "ZigeeLogic/deviceunselectedbackgroundcolor.png",
|
SelectedImagePath = "ZigeeLogic/deviceselectedbackgroundcolor.png",
|
};
|
deviceRowLayout.AddChidren(backgroundColor);
|
|
|
var devicetypeicon = new Button
|
{
|
Width = Application.GetRealWidth(84),
|
Height = Application.GetRealHeight(84),
|
X = Application.GetRealWidth(46),
|
Y = Application.GetRealHeight(30),
|
};
|
deviceRowLayout.AddChidren(devicetypeicon);
|
|
var devicetypename = new Button
|
{
|
Width = Application.GetRealWidth(176),
|
Height = Application.GetRealHeight(40),
|
Text = devicetype,
|
TextAlignment = TextAlignment.Center,
|
Y = backgroundColor.Bottom,
|
TextColor = ZigbeeColor.Current.LogicAddColor,
|
TextSize = 10,
|
};
|
deviceRowLayout.AddChidren(devicetypename);
|
if (devicetype == Language.StringByID(MyInternationalizationString.Lights))
|
{
|
devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedlight.png";
|
}
|
else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains))
|
{
|
devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedcurtain.png";
|
}
|
else if (devicetype == Language.StringByID(MyInternationalizationString.AC))
|
{
|
devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedac.png";
|
}
|
else if (devicetype == Language.StringByID(MyInternationalizationString.Airswitch))
|
{
|
devicetypeicon.UnSelectedImagePath = "ZigeeLogic/selectedairswitch.png";
|
}
|
EventHandler<MouseEventArgs> devicetypeclick = (sender13, e13) =>
|
{
|
|
devicetypeButton.IsSelected = false;
|
devicetypeButton = backgroundColor;
|
backgroundColor.IsSelected = true;
|
List<DeviceType> list = new List<DeviceType>();
|
list.Clear();
|
///分类显示(例如灯光:{灯光1,灯光2...})
|
if (devicetype == Language.StringByID(MyInternationalizationString.Lights))
|
{
|
list.Add(DeviceType.OnOffOutput);//0x0101十进制257
|
list.Add(DeviceType.DimmableLight);
|
}
|
else if (devicetype == Language.StringByID(MyInternationalizationString.Curtains))
|
{
|
list.Add(DeviceType.WindowCoveringDevice);
|
}
|
else if (devicetype == Language.StringByID(MyInternationalizationString.AC))
|
{
|
list.Add(DeviceType.Thermostat);
|
}
|
else if (devicetype == Language.StringByID(MyInternationalizationString.Airswitch))
|
{
|
list.Add(DeviceType.AirSwitch);
|
}
|
|
ActionDeviceView(list, devicelist);
|
|
};
|
deviceRowLayout.MouseUpEventHandler += devicetypeclick;
|
devicetypename.MouseUpEventHandler += devicetypeclick;
|
devicetypeicon.MouseUpEventHandler += devicetypeclick;
|
backgroundColor.MouseUpEventHandler += devicetypeclick;
|
|
}
|
///显示房间所有设备
|
ActionDeviceView(new List<DeviceType>(), devicelist);
|
}
|
/// <summary>
|
/// 加载该类型设备视图方法
|
/// </summary>
|
/// <param name="devicelist">设备列表</param>
|
void ActionDeviceView(List<DeviceType> deviceTypelist, List<DeviceUI> devicelist)
|
{
|
middle.RemoveAll();
|
foreach (var common in devicelist)
|
{
|
|
if (deviceTypelist.Count != 0 && !deviceTypelist.Contains(common.CommonDevice.Type))
|
{
|
continue;
|
}
|
|
var deviceFramelayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(160),
|
};
|
middle.AddChidren(deviceFramelayout);
|
|
var bjFramelayout = new FrameLayout
|
{
|
Width = Application.GetRealWidth(112),
|
Height = Application.GetRealHeight(112),
|
X = Application.GetRealWidth(58),
|
Y = Application.GetRealHeight(30 + 9),
|
Radius = (uint)Application.GetRealHeight(56),
|
BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
|
};
|
deviceFramelayout.AddChidren(bjFramelayout);
|
|
var deviceIconBtn = new Button
|
{
|
Width = Application.GetRealWidth(82),
|
Height = Application.GetRealHeight(82),
|
Gravity = Gravity.Center,
|
|
};
|
bjFramelayout.AddChidren(deviceIconBtn);
|
|
var deviceRow = new RowLayout
|
{
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(850),
|
Height = Application.GetRealHeight(130),
|
X = Application.GetRealWidth(176 + 10),
|
LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
|
|
};
|
deviceFramelayout.AddChidren(deviceRow);
|
|
var devicename = new Button
|
{
|
Text = common.CommonDevice.DeviceEpointName,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
|
SelectedTextColor = ZigbeeColor.Current.LogicAddColor,
|
};
|
deviceRow.AddChidren(devicename);
|
switch (common.CommonDevice.Type)
|
{
|
|
case DeviceType.OnOffOutput:
|
{
|
deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/light.png";
|
deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedlight.png";
|
}
|
break;
|
case DeviceType.DimmableLight:
|
{
|
|
deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/dimmableLight.png";
|
deviceIconBtn.SelectedImagePath = "ZigeeLogic/selecteddimmableLight.png";
|
}
|
break;
|
case DeviceType.WindowCoveringDevice:
|
{
|
deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/curtain.png";
|
deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedcurtain.png";
|
}
|
break;
|
case DeviceType.Thermostat:
|
{
|
deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/ac.png";
|
deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedac.png";
|
}
|
break;
|
case DeviceType.AirSwitch:
|
{
|
deviceIconBtn.UnSelectedImagePath = "ZigeeLogic/airswitch.png";
|
deviceIconBtn.SelectedImagePath = "ZigeeLogic/selectedairswitch.png";
|
}
|
break;
|
}
|
|
EventHandler<MouseEventArgs> devicclick = (sen, e) =>
|
{
|
clickbutton.IsSelected = false;
|
clickbutton = deviceIconBtn;
|
deviceIconBtn.IsSelected = true;
|
clickframeLayout.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
|
clickframeLayout = bjFramelayout;
|
bjFramelayout.BackgroundColor = ZigbeeColor.Current.LogicIconBackgroundColor;
|
clicktextcolcrbutton.IsSelected = false;
|
clicktextcolcrbutton = devicename;
|
devicename.IsSelected = true;
|
|
var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
|
this.AddChidren(flMain);
|
CurrentDeviceStateView(flMain, common.CommonDevice, false);
|
};
|
deviceFramelayout.MouseUpEventHandler += devicclick;
|
bjFramelayout.MouseUpEventHandler += devicclick;
|
deviceIconBtn.MouseUpEventHandler += devicclick;
|
deviceRow.MouseUpEventHandler += devicclick;
|
devicename.MouseUpEventHandler += devicclick;
|
|
}
|
}
|
/// <summary>
|
/// 选中该设备功能作为条件的视图方法
|
/// </summary>
|
/// <param name="common">Common.</param>
|
public static void CurrentDeviceStateView(FrameLayout flMain, CommonDevice common, bool edit)
|
{
|
//不让当前界面滑动
|
UserView.HomePage.Instance.ScrollEnabled = false;
|
Dictionary<string, object> actionsInfo = new Dictionary<string, object>();
|
List<Dictionary<string, string>> taskListInfo = new List<Dictionary<string, string>>();
|
//var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
|
//this.AddChidren(flMain);
|
flMain.MouseUpEventHandler += (sender, e) =>
|
{
|
flMain.RemoveFromParent();
|
};
|
var devicefra1 = new FrameLayout
|
{
|
Width = Application.GetRealWidth(1080),
|
Height = Application.GetRealHeight(100),
|
Y = Application.GetRealHeight(1920 - 100),
|
BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
|
};
|
flMain.AddChidren(devicefra1);
|
|
var devicefra = new FrameLayout
|
{
|
|
Width = Application.GetRealWidth(1080),
|
Height = Application.GetRealHeight(530 + 160),
|
Y = Application.GetRealHeight(1920 - 530 - 160),
|
BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor,
|
Radius = (uint)Application.GetRealHeight(60),
|
};
|
flMain.AddChidren(devicefra);
|
|
#region -------取消 完成
|
var timetype = new RowLayout
|
{
|
Height = Application.GetRealHeight(140),
|
LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
|
};
|
devicefra.AddChidren(timetype);
|
var Btncancel = new Button
|
{
|
TextID = MyInternationalizationString.cancel,
|
TextColor = ZigbeeColor.Current.LogicBtnCancelColor,
|
Height = Application.GetRealHeight(140),
|
Width = Application.GetRealWidth(200),
|
X = Application.GetRealWidth(80),
|
TextAlignment = TextAlignment.CenterLeft,
|
};
|
timetype.AddChidren(Btncancel);
|
Btncancel.MouseUpEventHandler += (sender16, e16) =>
|
{
|
flMain.RemoveFromParent();
|
UserView.HomePage.Instance.ScrollEnabled = true;
|
};
|
|
var Btntitle = new Button
|
{
|
TextID = MyInternationalizationString.security,
|
TextColor = ZigbeeColor.Current.LogicBtnTypeColor,
|
Height = Application.GetRealHeight(140),
|
Width = Application.GetRealWidth(420),
|
TextAlignment = TextAlignment.Center,
|
X = Btncancel.Right + Application.GetRealWidth(50),
|
TextSize = 16,
|
Text = common.DeviceEpointName,
|
};
|
timetype.AddChidren(Btntitle);
|
var Btncomplete = new Button
|
{
|
TextID = MyInternationalizationString.complete,
|
TextColor = ZigbeeColor.Current.LogicBtnCompleteColor,
|
Height = Application.GetRealHeight(140),
|
Width = Application.GetRealWidth(200),
|
TextAlignment = TextAlignment.CenterRight,
|
X = Btntitle.Right + Application.GetRealWidth(50),
|
|
};
|
timetype.AddChidren(Btncomplete);
|
#endregion
|
|
|
string SelectedDeviceStatusaction = "no";
|
actionsInfo.Add("LinkType", 0);
|
actionsInfo.Add("DeviceAddr", common.DeviceAddr);
|
actionsInfo.Add("Epoint", common.DeviceEpoint);
|
actionsInfo.Add("Time", 0);
|
actionsInfo.Add("TaskList", taskListInfo);
|
|
List<Dictionary<string, string>> TaskList = null;
|
if (edit)
|
{
|
foreach (var deviceinfo in Common.Logic.CurrentLogic.Actions)
|
{
|
if (deviceinfo["LinkType"].ToString() == "0")
|
{
|
|
if (deviceinfo["DeviceAddr"].ToString() == common.DeviceAddr && deviceinfo["Epoint"].ToString() == common.DeviceEpoint.ToString())
|
{
|
TaskList = deviceinfo["TaskList"] as List<Dictionary<string, string>>;
|
break;
|
}
|
}
|
}
|
}
|
switch (common.Type)
|
{
|
|
///灯光
|
case DeviceType.OnOffOutput:
|
{
|
|
#region ----初始化设备功能数据----
|
Dictionary<string, string> switchdictionary = new Dictionary<string, string>();
|
if (switchdictionary.ContainsKey("TaskType"))
|
{
|
switchdictionary.Remove("TaskType");
|
}
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
if (switchdictionary.ContainsKey("Data2"))
|
{
|
switchdictionary.Remove("Data2");
|
}
|
switchdictionary.Add("TaskType", "1");
|
switchdictionary.Add("Data1", "0");
|
switchdictionary.Add("Data2", "0");
|
taskListInfo.Add(switchdictionary);
|
|
#endregion
|
|
#region 灯光View
|
|
#region 开
|
|
var openframelayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(160),
|
Y = timetype.Bottom + Application.GetRealHeight(20),
|
};
|
devicefra.AddChidren(openframelayout);
|
|
var openrowlayout = new RowLayout
|
{
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(130),
|
X = Application.GetRealWidth(80),
|
LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
|
};
|
openframelayout.AddChidren(openrowlayout);
|
|
var btnopen = new Button
|
{
|
Width = Application.GetRealWidth(600),
|
TextID = MyInternationalizationString.open,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
|
};
|
openrowlayout.AddChidren(btnopen);
|
|
var openBtnSelected = new SelectedButton();
|
openrowlayout.AddChidren(openBtnSelected);
|
#endregion
|
#region 关
|
var closeframelayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(160),
|
Y = openframelayout.Bottom,
|
};
|
devicefra.AddChidren(closeframelayout);
|
var closerowlayout = new RowLayout
|
{
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(130),
|
X = Application.GetRealWidth(80),
|
LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
|
};
|
closeframelayout.AddChidren(closerowlayout);
|
|
var btnclose = new Button
|
{
|
//Text = "关",
|
TextID = MyInternationalizationString.close,
|
Width = Application.GetRealWidth(600),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
|
};
|
closerowlayout.AddChidren(btnclose);
|
|
var closeBtnSelected = new SelectedButton();
|
closerowlayout.AddChidren(closeBtnSelected);
|
#endregion
|
#region 取反
|
var takebackframelayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(160),
|
Y = closeframelayout.Bottom,
|
};
|
devicefra.AddChidren(takebackframelayout);
|
var takebackrowlayout = new RowLayout
|
{
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(130),
|
X = Application.GetRealWidth(80),
|
LineColor = ZigbeeColor.Current.LogicBackgroundColor,
|
};
|
takebackframelayout.AddChidren(takebackrowlayout);
|
|
var btntakeback = new Button
|
{
|
//Text = "关",
|
TextID = MyInternationalizationString.onoff,
|
Width = Application.GetRealWidth(600),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
|
};
|
takebackrowlayout.AddChidren(btntakeback);
|
|
var takebackBtnSelected = new SelectedButton();
|
takebackrowlayout.AddChidren(takebackBtnSelected);
|
|
#endregion
|
|
|
#endregion
|
|
///确认事件
|
EventHandler<MouseEventArgs> openclick = (sender, e) =>
|
{
|
SelectedDeviceStatusaction = "yes";
|
openBtnSelected.Visible = true;
|
closeBtnSelected.Visible = false;
|
takebackBtnSelected.Visible = false;
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
switchdictionary.Add("Data1", "1");//默认值
|
|
|
};
|
openrowlayout.MouseUpEventHandler += openclick;
|
btnopen.MouseUpEventHandler += openclick;
|
openBtnSelected.MouseUpEventHandler += openclick;
|
openframelayout.MouseUpEventHandler += openclick;
|
///取消事件
|
EventHandler<MouseEventArgs> closeclick = (sender, e) =>
|
{
|
SelectedDeviceStatusaction = "yes";
|
openBtnSelected.Visible = false;
|
closeBtnSelected.Visible = true;
|
takebackBtnSelected.Visible = false;
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
switchdictionary.Add("Data1", "0");//默认值
|
|
};
|
closerowlayout.MouseUpEventHandler += closeclick;
|
btnclose.MouseUpEventHandler += closeclick;
|
closeBtnSelected.MouseUpEventHandler += closeclick;
|
closeframelayout.MouseUpEventHandler += closeclick;
|
//取反
|
EventHandler<MouseEventArgs> takebackclick = (sender, e) =>
|
{
|
SelectedDeviceStatusaction = "yes";
|
openBtnSelected.Visible = false;
|
closeBtnSelected.Visible = false;
|
takebackBtnSelected.Visible = true;
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
switchdictionary.Add("Data1", "2");//默认值
|
|
};
|
takebackrowlayout.MouseUpEventHandler += takebackclick;
|
btntakeback.MouseUpEventHandler += takebackclick;
|
takebackBtnSelected.MouseUpEventHandler += takebackclick;
|
takebackframelayout.MouseUpEventHandler += takebackclick;
|
if (edit && TaskList != null)
|
{
|
foreach (var value in TaskList)
|
{
|
if (value["TaskType"] == "1")
|
{
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
if (value["Data1"] == "1")
|
{
|
switchdictionary.Add("Data1", "1");
|
openBtnSelected.Visible = true;
|
closeBtnSelected.Visible = false;
|
takebackBtnSelected.Visible = false;
|
}
|
else if (value["Data1"] == "0")
|
{
|
switchdictionary.Add("Data1", "0");
|
openBtnSelected.Visible = false;
|
closeBtnSelected.Visible = true;
|
takebackBtnSelected.Visible = false;
|
}
|
else if (value["Data1"] == "2")
|
{
|
switchdictionary.Add("Data1", "2");
|
openBtnSelected.Visible = false;
|
closeBtnSelected.Visible = false;
|
takebackBtnSelected.Visible = true;
|
}
|
break;
|
}
|
|
}
|
}
|
|
}
|
break;
|
///调光灯光
|
case DeviceType.DimmableLight:
|
{
|
|
#region ----初始化设备功能数据----
|
Dictionary<string, string> switchdictionary = new Dictionary<string, string>();
|
if (switchdictionary.ContainsKey("Data2"))
|
{
|
switchdictionary.Remove("Data2");
|
}
|
switchdictionary.Add("Data2", "0");
|
taskListInfo.Add(switchdictionary);
|
|
#endregion
|
|
#region 灯光View
|
|
devicefra.Y = Application.GetRealHeight(1920 - 160 * 3 - 210 - 160);
|
devicefra.Height = Application.GetRealHeight(160 * 3 + 210 + 160);
|
|
#region 开
|
|
var openframelayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(160 + 160),
|
Y = timetype.Bottom + Application.GetRealHeight(20),
|
};
|
devicefra.AddChidren(openframelayout);
|
|
var openrowlayout = new RowLayout
|
{
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(130),
|
X = Application.GetRealWidth(80),
|
LineColor = ZigbeeColor.Current.LogicBackgroundColor,
|
};
|
openframelayout.AddChidren(openrowlayout);
|
|
var btnopen = new Button
|
{
|
Width = Application.GetRealWidth(600),
|
TextID = MyInternationalizationString.open,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
|
};
|
openrowlayout.AddChidren(btnopen);
|
|
var openBtnSelected = new SelectedButton();
|
openrowlayout.AddChidren(openBtnSelected);
|
|
var horizontalSeekBarRow = new RowLayout
|
{
|
Y = openrowlayout.Bottom,
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(160),
|
X = Application.GetRealWidth(80),
|
LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
|
};
|
openframelayout.AddChidren(horizontalSeekBarRow);
|
var horizontalSeekBarVol = new HorizontalSeekBar
|
{
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(80),
|
Radius = (uint)Application.GetRealHeight(25),
|
Y = Application.GetRealHeight(25),
|
//Gravity = Gravity.CenterVertical,
|
ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected,
|
Max = 100,
|
SleepTime = 1000,
|
ThumbRadius = 9,
|
IsCanMove = false
|
};
|
horizontalSeekBarRow.AddChidren(horizontalSeekBarVol);
|
|
#endregion
|
|
#region 关
|
var closeframelayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(160),
|
Y = openframelayout.Bottom,
|
};
|
devicefra.AddChidren(closeframelayout);
|
var closerowlayout = new RowLayout
|
{
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(130),
|
X = Application.GetRealWidth(80),
|
LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
|
};
|
closeframelayout.AddChidren(closerowlayout);
|
|
var btnclose = new Button
|
{
|
//Text = "关",
|
TextID = MyInternationalizationString.close,
|
Width = Application.GetRealWidth(600),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
|
};
|
closerowlayout.AddChidren(btnclose);
|
|
var closeBtnSelected = new SelectedButton();
|
closerowlayout.AddChidren(closeBtnSelected);
|
#endregion
|
|
#region 取反
|
var takebackframelayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(160),
|
Y = closeframelayout.Bottom,
|
};
|
devicefra.AddChidren(takebackframelayout);
|
var takebackrowlayout = new RowLayout
|
{
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(130),
|
X = Application.GetRealWidth(80),
|
LineColor = ZigbeeColor.Current.LogicBackgroundColor,
|
};
|
takebackframelayout.AddChidren(takebackrowlayout);
|
|
var btntakeback = new Button
|
{
|
//Text = "关",
|
TextID = MyInternationalizationString.onoff,
|
Width = Application.GetRealWidth(600),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
|
};
|
takebackrowlayout.AddChidren(btntakeback);
|
|
var takebackBtnSelected = new SelectedButton();
|
takebackrowlayout.AddChidren(takebackBtnSelected);
|
|
#endregion
|
|
|
#endregion
|
|
int Progressvalue = 100;
|
horizontalSeekBarVol.ProgressChanged += (sender, e) =>
|
{
|
SelectedDeviceStatusaction = "yes";
|
Progressvalue = horizontalSeekBarVol.Progress;
|
if (switchdictionary.ContainsKey("TaskType"))
|
{
|
switchdictionary.Remove("TaskType");
|
}
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
switchdictionary.Add("TaskType", "3");
|
//最大亮度值是254需要转换;
|
var lightbrightnessvalue = (254 * horizontalSeekBarVol.Progress) / 100;
|
switchdictionary.Add("Data1", lightbrightnessvalue.ToString());
|
|
};
|
///确认事件
|
EventHandler<MouseEventArgs> openclick = (sender, e) =>
|
{
|
SelectedDeviceStatusaction = "yes";
|
horizontalSeekBarVol.IsCanMove = true;
|
horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected;
|
openBtnSelected.Visible = true;
|
closeBtnSelected.Visible = false;
|
takebackBtnSelected.Visible = false;
|
horizontalSeekBarVol.Progress = Progressvalue;
|
if (switchdictionary.ContainsKey("TaskType"))
|
{
|
switchdictionary.Remove("TaskType");
|
}
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
switchdictionary.Add("TaskType", "3");
|
//最大亮度值是254需要转换;
|
var lightbrightnessvalue = (254 * horizontalSeekBarVol.Progress) / 100;
|
switchdictionary.Add("Data1", lightbrightnessvalue.ToString());
|
|
};
|
openrowlayout.MouseUpEventHandler += openclick;
|
btnopen.MouseUpEventHandler += openclick;
|
openBtnSelected.MouseUpEventHandler += openclick;
|
openframelayout.MouseUpEventHandler += openclick;
|
///取消事件
|
EventHandler<MouseEventArgs> closeclick = (sender, e) =>
|
{
|
SelectedDeviceStatusaction = "yes";
|
horizontalSeekBarVol.IsCanMove = false;
|
horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor;
|
openBtnSelected.Visible = false;
|
closeBtnSelected.Visible = true;
|
takebackBtnSelected.Visible = false;
|
if (switchdictionary.ContainsKey("TaskType"))
|
{
|
switchdictionary.Remove("TaskType");
|
}
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
switchdictionary.Add("TaskType", "1");
|
switchdictionary.Add("Data1", "0");//默认值
|
|
};
|
closerowlayout.MouseUpEventHandler += closeclick;
|
btnclose.MouseUpEventHandler += closeclick;
|
closeBtnSelected.MouseUpEventHandler += closeclick;
|
closeframelayout.MouseUpEventHandler += closeclick;
|
//取反
|
EventHandler<MouseEventArgs> takebackclick = (sender, e) =>
|
{
|
SelectedDeviceStatusaction = "yes";
|
horizontalSeekBarVol.IsCanMove = false;
|
horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor;
|
openBtnSelected.Visible = false;
|
closeBtnSelected.Visible = false;
|
takebackBtnSelected.Visible = true;
|
if (switchdictionary.ContainsKey("TaskType"))
|
{
|
switchdictionary.Remove("TaskType");
|
}
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
switchdictionary.Add("TaskType", "1");
|
switchdictionary.Add("Data1", "2");//默认值
|
|
};
|
takebackrowlayout.MouseUpEventHandler += takebackclick;
|
btntakeback.MouseUpEventHandler += takebackclick;
|
takebackBtnSelected.MouseUpEventHandler += takebackclick;
|
takebackframelayout.MouseUpEventHandler += takebackclick;
|
|
if (edit && TaskList != null)
|
{
|
foreach (var value in TaskList)
|
{
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
if (switchdictionary.ContainsKey("TaskType"))
|
{
|
switchdictionary.Remove("TaskType");
|
}
|
if (value["TaskType"] == "1")
|
{
|
switchdictionary.Add("TaskType", "1");
|
if (value["Data1"] == "0")
|
{
|
switchdictionary.Add("Data1", "0");
|
openBtnSelected.Visible = false;
|
closeBtnSelected.Visible = true;
|
takebackBtnSelected.Visible = false;
|
horizontalSeekBarVol.IsCanMove = false;
|
horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor;
|
}
|
else if (value["Data1"] == "2")
|
{
|
switchdictionary.Add("Data1", "2");
|
openBtnSelected.Visible = false;
|
closeBtnSelected.Visible = false;
|
takebackBtnSelected.Visible = true;
|
horizontalSeekBarVol.IsCanMove = false;
|
horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor;
|
}
|
|
}
|
else if (value["TaskType"] == "3")
|
{
|
switchdictionary.Add("TaskType", "3");
|
switchdictionary.Add("Data1", value["Data1"]);
|
openBtnSelected.Visible = true;
|
closeBtnSelected.Visible = false;
|
takebackBtnSelected.Visible = false;
|
horizontalSeekBarVol.IsCanMove = true;
|
horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected;
|
horizontalSeekBarVol.Progress = int.Parse(value["Data1"]) * 100 / 254;
|
Progressvalue = horizontalSeekBarVol.Progress;
|
|
}
|
break;
|
|
}
|
}
|
|
}
|
break;
|
///窗帘
|
case DeviceType.WindowCoveringDevice:
|
{
|
#region ----初始化设备功能数据----
|
Dictionary<string, string> switchdictionary = new Dictionary<string, string>();
|
if (switchdictionary.ContainsKey("TaskType"))
|
{
|
switchdictionary.Remove("TaskType");
|
}
|
switchdictionary.Add("TaskType", "6");
|
|
taskListInfo.Add(switchdictionary);
|
|
#endregion
|
devicefra.Y = Application.GetRealHeight(1920 - 160 * 2 - 210 - 160);
|
devicefra.Height = Application.GetRealHeight(160 * 2 + 210 + 160);
|
#region 窗帘View
|
|
#region 开
|
|
var openframelayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(160 + 160),
|
Y = timetype.Bottom + Application.GetRealHeight(20),
|
};
|
devicefra.AddChidren(openframelayout);
|
|
var openrowlayout = new RowLayout
|
{
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(130),
|
X = Application.GetRealWidth(80),
|
LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
|
};
|
openframelayout.AddChidren(openrowlayout);
|
|
var btnopen = new Button
|
{
|
Width = Application.GetRealWidth(600),
|
TextID = MyInternationalizationString.open,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
|
};
|
openrowlayout.AddChidren(btnopen);
|
|
var openBtnSelected = new SelectedButton();
|
openrowlayout.AddChidren(openBtnSelected);
|
|
|
var horizontalSeekBarRow = new RowLayout
|
{
|
Y = openrowlayout.Bottom,
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(160),
|
X = Application.GetRealWidth(80),
|
LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
|
};
|
openframelayout.AddChidren(horizontalSeekBarRow);
|
var horizontalSeekBarVol = new HorizontalSeekBar
|
{
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(80),
|
Radius = (uint)Application.GetRealHeight(25),
|
Y = Application.GetRealHeight(25),
|
//Gravity = Gravity.CenterVertical,
|
ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected,
|
Max = 100,
|
SleepTime = 1000,
|
ThumbRadius = 9,
|
IsCanMove = false
|
};
|
horizontalSeekBarRow.AddChidren(horizontalSeekBarVol);
|
|
#endregion
|
|
#region 关
|
var closeframelayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(160),
|
Y = openframelayout.Bottom,
|
};
|
devicefra.AddChidren(closeframelayout);
|
var closerowlayout = new RowLayout
|
{
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(130),
|
X = Application.GetRealWidth(80),
|
LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
|
};
|
closeframelayout.AddChidren(closerowlayout);
|
|
var btnclose = new Button
|
{
|
//Text = "关",
|
TextID = MyInternationalizationString.close,
|
Width = Application.GetRealWidth(600),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
|
};
|
closerowlayout.AddChidren(btnclose);
|
|
var closeBtnSelected = new SelectedButton();
|
closerowlayout.AddChidren(closeBtnSelected);
|
#endregion
|
|
|
|
#endregion
|
int Progressvalue = 100;
|
horizontalSeekBarVol.ProgressChanged += (sender, e) =>
|
{
|
SelectedDeviceStatusaction = "yes";
|
Progressvalue = horizontalSeekBarVol.Progress;
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
if (switchdictionary.ContainsKey("Data2"))
|
{
|
switchdictionary.Remove("Data2");
|
}
|
switchdictionary.Add("Data1", "5");
|
switchdictionary.Add("Data2", horizontalSeekBarVol.Progress.ToString());
|
|
};
|
///确认事件
|
EventHandler<MouseEventArgs> openclick = (sender, e) =>
|
{
|
SelectedDeviceStatusaction = "yes";
|
horizontalSeekBarVol.IsCanMove = true;
|
horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected;
|
openBtnSelected.Visible = true;
|
closeBtnSelected.Visible = false;
|
horizontalSeekBarVol.Progress = Progressvalue;
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
if (switchdictionary.ContainsKey("Data2"))
|
{
|
switchdictionary.Remove("Data2");
|
}
|
switchdictionary.Add("Data1", "5");
|
switchdictionary.Add("Data2", horizontalSeekBarVol.Progress.ToString());
|
|
};
|
openrowlayout.MouseUpEventHandler += openclick;
|
btnopen.MouseUpEventHandler += openclick;
|
openBtnSelected.MouseUpEventHandler += openclick;
|
openframelayout.MouseUpEventHandler += openclick;
|
///取消事件
|
EventHandler<MouseEventArgs> closeclick = (sender, e) =>
|
{
|
SelectedDeviceStatusaction = "yes";
|
horizontalSeekBarVol.IsCanMove = false;
|
horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor;
|
openBtnSelected.Visible = false;
|
closeBtnSelected.Visible = true;
|
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
if (switchdictionary.ContainsKey("Data2"))
|
{
|
switchdictionary.Remove("Data2");
|
}
|
switchdictionary.Add("Data2", "0");
|
switchdictionary.Add("Data1", "1");//默认值
|
|
};
|
closerowlayout.MouseUpEventHandler += closeclick;
|
btnclose.MouseUpEventHandler += closeclick;
|
closeBtnSelected.MouseUpEventHandler += closeclick;
|
closeframelayout.MouseUpEventHandler += closeclick;
|
|
|
|
if (edit && TaskList != null)
|
{
|
foreach (var value in TaskList)
|
{
|
if (value["TaskType"] == "6")
|
{
|
if (value["Data1"] == "5")
|
{
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
if (switchdictionary.ContainsKey("Data2"))
|
{
|
switchdictionary.Remove("Data2");
|
}
|
switchdictionary.Add("Data1", "5");
|
switchdictionary.Add("Data2", value["Data2"]);
|
horizontalSeekBarVol.IsCanMove = true;
|
horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColorSelected;
|
openBtnSelected.Visible = true;
|
closeBtnSelected.Visible = false;
|
horizontalSeekBarVol.Progress = int.Parse(value["Data2"]);
|
Progressvalue = horizontalSeekBarVol.Progress;
|
}
|
else if (value["Data1"] == "1")
|
{
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
switchdictionary.Add("Data1", "1");
|
openBtnSelected.Visible = false;
|
closeBtnSelected.Visible = true;
|
horizontalSeekBarVol.IsCanMove = false;
|
horizontalSeekBarVol.ProgressColor = ZigbeeColor.Current.LogicProgressColor;
|
}
|
|
}
|
|
}
|
}
|
}
|
break;
|
///空气开关
|
case DeviceType.AirSwitch:
|
{
|
{
|
|
#region ----初始化设备功能数据----
|
Dictionary<string, string> switchdictionary = new Dictionary<string, string>();
|
if (switchdictionary.ContainsKey("TaskType"))
|
{
|
switchdictionary.Remove("TaskType");
|
}
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
if (switchdictionary.ContainsKey("Data2"))
|
{
|
switchdictionary.Remove("Data2");
|
}
|
switchdictionary.Add("TaskType", "1");
|
switchdictionary.Add("Data1", "0");
|
switchdictionary.Add("Data2", "0");
|
taskListInfo.Add(switchdictionary);
|
|
#endregion
|
|
#region 空气灯光View
|
|
#region 开
|
|
var openframelayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(160),
|
Y = timetype.Bottom + Application.GetRealHeight(20),
|
};
|
devicefra.AddChidren(openframelayout);
|
|
var openrowlayout = new RowLayout
|
{
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(130),
|
X = Application.GetRealWidth(80),
|
LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
|
};
|
openframelayout.AddChidren(openrowlayout);
|
|
var btnopen = new Button
|
{
|
Width = Application.GetRealWidth(600),
|
TextID = MyInternationalizationString.open,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
|
};
|
openrowlayout.AddChidren(btnopen);
|
|
var openBtnSelected = new SelectedButton();
|
openrowlayout.AddChidren(openBtnSelected);
|
#endregion
|
#region 关
|
var closeframelayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(160),
|
Y = openframelayout.Bottom,
|
};
|
devicefra.AddChidren(closeframelayout);
|
var closerowlayout = new RowLayout
|
{
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(130),
|
X = Application.GetRealWidth(80),
|
LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
|
};
|
closeframelayout.AddChidren(closerowlayout);
|
|
var btnclose = new Button
|
{
|
//Text = "关",
|
TextID = MyInternationalizationString.close,
|
Width = Application.GetRealWidth(600),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
|
};
|
closerowlayout.AddChidren(btnclose);
|
|
var closeBtnSelected = new SelectedButton();
|
closerowlayout.AddChidren(closeBtnSelected);
|
#endregion
|
#region 取反
|
var takebackframelayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(160),
|
Y = closeframelayout.Bottom,
|
};
|
devicefra.AddChidren(takebackframelayout);
|
var takebackrowlayout = new RowLayout
|
{
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(130),
|
X = Application.GetRealWidth(80),
|
LineColor = ZigbeeColor.Current.LogicBackgroundColor,
|
};
|
takebackframelayout.AddChidren(takebackrowlayout);
|
|
var btntakeback = new Button
|
{
|
//Text = "关",
|
TextID = MyInternationalizationString.onoff,
|
Width = Application.GetRealWidth(600),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
|
};
|
takebackrowlayout.AddChidren(btntakeback);
|
|
var takebackBtnSelected = new SelectedButton();
|
takebackrowlayout.AddChidren(takebackBtnSelected);
|
|
#endregion
|
|
|
#endregion
|
|
///确认事件
|
EventHandler<MouseEventArgs> openclick = (sender, e) =>
|
{
|
SelectedDeviceStatusaction = "yes";
|
openBtnSelected.Visible = true;
|
closeBtnSelected.Visible = false;
|
takebackBtnSelected.Visible = false;
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
switchdictionary.Add("Data1", "1");//默认值
|
|
|
};
|
openrowlayout.MouseUpEventHandler += openclick;
|
btnopen.MouseUpEventHandler += openclick;
|
openBtnSelected.MouseUpEventHandler += openclick;
|
openframelayout.MouseUpEventHandler += openclick;
|
///取消事件
|
EventHandler<MouseEventArgs> closeclick = (sender, e) =>
|
{
|
SelectedDeviceStatusaction = "yes";
|
openBtnSelected.Visible = false;
|
closeBtnSelected.Visible = true;
|
takebackBtnSelected.Visible = false;
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
switchdictionary.Add("Data1", "0");//默认值
|
|
};
|
closerowlayout.MouseUpEventHandler += closeclick;
|
btnclose.MouseUpEventHandler += closeclick;
|
closeBtnSelected.MouseUpEventHandler += closeclick;
|
closeframelayout.MouseUpEventHandler += closeclick;
|
//取反
|
EventHandler<MouseEventArgs> takebackclick = (sender, e) =>
|
{
|
SelectedDeviceStatusaction = "yes";
|
openBtnSelected.Visible = false;
|
closeBtnSelected.Visible = false;
|
takebackBtnSelected.Visible = true;
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
switchdictionary.Add("Data1", "2");//默认值
|
|
};
|
takebackrowlayout.MouseUpEventHandler += takebackclick;
|
btntakeback.MouseUpEventHandler += takebackclick;
|
takebackBtnSelected.MouseUpEventHandler += takebackclick;
|
takebackframelayout.MouseUpEventHandler += takebackclick;
|
if (edit && TaskList != null)
|
{
|
foreach (var value in TaskList)
|
{
|
if (value["TaskType"] == "1")
|
{
|
if (switchdictionary.ContainsKey("Data1"))
|
{
|
switchdictionary.Remove("Data1");
|
}
|
if (value["Data1"] == "1")
|
{
|
switchdictionary.Add("Data1", "1");
|
openBtnSelected.Visible = true;
|
closeBtnSelected.Visible = false;
|
takebackBtnSelected.Visible = false;
|
}
|
else if (value["Data1"] == "0")
|
{
|
switchdictionary.Add("Data1", "0");
|
openBtnSelected.Visible = false;
|
closeBtnSelected.Visible = true;
|
takebackBtnSelected.Visible = false;
|
}
|
else if (value["Data1"] == "2")
|
{
|
switchdictionary.Add("Data1", "2");
|
openBtnSelected.Visible = false;
|
closeBtnSelected.Visible = false;
|
takebackBtnSelected.Visible = true;
|
}
|
break;
|
}
|
|
}
|
}
|
|
}
|
}
|
break;
|
|
case DeviceType.Thermostat:
|
{
|
|
#region ----初始化设备功能数据----
|
Dictionary<string, string> switchdictionary = new Dictionary<string, string>();
|
Dictionary<string, string> temperaturedictionary = new Dictionary<string, string>();
|
Dictionary<string, string> modedictionary = new Dictionary<string, string>();
|
Dictionary<string, string> speeddictionary = new Dictionary<string, string>();
|
taskListInfo.Add(switchdictionary);
|
taskListInfo.Add(temperaturedictionary);
|
taskListInfo.Add(modedictionary);
|
taskListInfo.Add(speeddictionary);
|
dictionary(switchdictionary, "TaskType", "1");
|
dictionary(switchdictionary, "Data2", "0");
|
dictionary(temperaturedictionary, "TaskType", "5");
|
dictionary(modedictionary, "TaskType", "5");
|
dictionary(modedictionary, "Data1", "3");
|
dictionary(speeddictionary, "TaskType", "5");
|
dictionary(speeddictionary, "Data1", "6");
|
|
#endregion
|
|
#region 空调View
|
|
devicefra.Y = Application.GetRealHeight(1920 - 600 - 210 - 160 * 2);
|
devicefra.Height = Application.GetRealHeight(600 + 210 + 160 * 2);
|
|
#region 开
|
|
var openframelayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(160),
|
Y = timetype.Bottom + Application.GetRealHeight(20),
|
};
|
devicefra.AddChidren(openframelayout);
|
|
var openrowlayout = new RowLayout
|
{
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(130),
|
X = Application.GetRealWidth(80),
|
LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
|
};
|
openframelayout.AddChidren(openrowlayout);
|
|
var btnopen = new Button
|
{
|
Width = Application.GetRealWidth(600),
|
TextID = MyInternationalizationString.open,
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
|
};
|
openrowlayout.AddChidren(btnopen);
|
|
var openBtnSelected = new SelectedButton();
|
openrowlayout.AddChidren(openBtnSelected);
|
#endregion
|
|
#region 空调状态View
|
var PickerViewfra = new FrameLayout
|
{
|
Y = openframelayout.Bottom,
|
Height = Application.GetRealHeight(600),
|
};
|
devicefra.AddChidren(PickerViewfra);
|
|
|
var pausePickerViewfra = new FrameLayout
|
{
|
Y = openframelayout.Bottom,
|
Height = Application.GetRealHeight(600),
|
};
|
devicefra.AddChidren(pausePickerViewfra);
|
|
|
|
var mUIPickerView = new UIPickerView
|
{
|
Height = Application.GetRealHeight(600 - 5),
|
};
|
PickerViewfra.AddChidren(mUIPickerView);
|
var line = new Button
|
{
|
Y = Application.GetRealHeight(600 - 5),
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(5),
|
X = Application.GetRealWidth(80),
|
BackgroundColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
|
};
|
PickerViewfra.AddChidren(line);
|
|
var mList1 = new List<string>();
|
var mList2 = new List<string> {
|
Language.StringByID(MyInternationalizationString.logiccool),
|
Language.StringByID(MyInternationalizationString.logicheat),
|
Language.StringByID(MyInternationalizationString.logicauto),
|
Language.StringByID(MyInternationalizationString.logicdry),
|
Language.StringByID(MyInternationalizationString.logicfanonly),
|
};
|
var mList3 = new List<string>{
|
Language.StringByID(MyInternationalizationString.logiclow),
|
Language.StringByID(MyInternationalizationString.logicmedium),
|
Language.StringByID(MyInternationalizationString.logichigh),
|
};
|
for (int i = 16; i < 33; i++)
|
{
|
mList1.Add(i.ToString() + " " + "℃");
|
}
|
mUIPickerView.setNPicker(mList1, mList2, mList3);
|
///默认状态
|
|
|
#endregion
|
|
#region 关
|
var closeframelayout = new FrameLayout
|
{
|
Height = Application.GetRealHeight(160),
|
Y = PickerViewfra.Bottom,
|
};
|
devicefra.AddChidren(closeframelayout);
|
var closerowlayout = new RowLayout
|
{
|
Y = Application.GetRealHeight(30),
|
Width = Application.GetRealWidth(920),
|
Height = Application.GetRealHeight(130),
|
X = Application.GetRealWidth(80),
|
LineColor = ZigbeeColor.Current.LogicBackgroundColor,
|
};
|
closeframelayout.AddChidren(closerowlayout);
|
|
var btnclose = new Button
|
{
|
//Text = "关",
|
TextID = MyInternationalizationString.close,
|
Width = Application.GetRealWidth(600),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor,
|
};
|
closerowlayout.AddChidren(btnclose);
|
|
var closeBtnSelected = new SelectedButton();
|
closerowlayout.AddChidren(closeBtnSelected);
|
#endregion
|
|
|
|
mUIPickerView.OnSelectChangeEvent += (s1, s2, s3) =>
|
{
|
if (openBtnSelected.Visible)
|
{
|
SelectedDeviceStatusaction = "yes";
|
var temperature = mList1[s1].Split(' ')[0];
|
var modestring = mList2[s2].Split(' ')[0];
|
var speedstring = mList3[s3].Split(' ')[0];
|
ModeState(modestring, temperaturedictionary, modedictionary);
|
var a = int.Parse(temperature) * 100;
|
dictionary(temperaturedictionary, "Data2", a.ToString());
|
|
SpeedState(speedstring, speeddictionary);
|
|
|
}
|
};
|
|
#endregion
|
//默认26,自动,中风
|
int indextemperature = 10, indexmode = 2, indexspeed = 1;
|
if (edit && TaskList != null)
|
{
|
foreach (var value in TaskList)
|
{
|
if (value["TaskType"] == "1")
|
{
|
dictionary(switchdictionary, "Data1", value["Data1"]);
|
if (value["Data1"] == "1")
|
{
|
openBtnSelected.Visible = true;
|
closeBtnSelected.Visible = false;
|
pausePickerViewfra.Height = Application.GetRealHeight(0);
|
}
|
else if (value["Data1"] == "0")
|
{
|
openBtnSelected.Visible = false;
|
closeBtnSelected.Visible = true;
|
pausePickerViewfra.Height = Application.GetRealHeight(600);
|
}
|
|
}
|
else if (value["TaskType"] == "5")
|
{
|
if (value["Data1"] == "3")
|
{//3---设置工作模式(1:自动;3:制冷;4:制热;7:送风;8:除湿)
|
dictionary(modedictionary, "Data2", value["Data2"]);
|
string modetext = "";
|
switch (value["Data2"])
|
{
|
case "3":
|
{
|
modetext = Language.StringByID(MyInternationalizationString.logiccool);
|
//indexmode = 0;
|
}
|
break;
|
case "4":
|
{
|
modetext = Language.StringByID(MyInternationalizationString.logicheat);
|
// indexmode = 1;
|
}
|
break;
|
case "1":
|
{
|
modetext = Language.StringByID(MyInternationalizationString.logicauto);
|
// indexmode = 2;
|
}
|
break;
|
case "8":
|
{
|
modetext = Language.StringByID(MyInternationalizationString.logicdry);
|
// indexmode = 3;
|
}
|
break;
|
case "7":
|
{
|
modetext = Language.StringByID(MyInternationalizationString.logicfanonly);
|
//indexmode = 4;
|
}
|
break;
|
}
|
indexmode = mList2.IndexOf(modetext);
|
}
|
else if (value["Data1"] == "6")
|
{//6---设置风扇模式(1:低风;2:中风;3:高风;)
|
dictionary(speeddictionary, "Data2", value["Data2"]);
|
string speedtext = "";
|
switch (value["Data2"])
|
{
|
case "1":
|
{
|
speedtext = Language.StringByID(MyInternationalizationString.logiclow);
|
//indexspeed = 0;
|
}
|
break;
|
|
case "2":
|
{
|
speedtext = Language.StringByID(MyInternationalizationString.logicmedium);
|
// indexspeed = 1;
|
}
|
break;
|
case "3":
|
{
|
speedtext = Language.StringByID(MyInternationalizationString.logichigh);
|
// indexspeed = 2;
|
}
|
break;
|
|
}
|
indexspeed = mList3.IndexOf(speedtext);
|
}
|
//4---设置加热度数;5---设置制冷、除湿度数;7---设置自动度数
|
else if (value["Data1"] == "4" || value["Data1"] == "5" || value["Data1"] == "7")
|
{
|
var s = int.Parse(value["Data2"]) / 100;
|
indextemperature = mList1.IndexOf(s.ToString() + " " + "℃");
|
dictionary(temperaturedictionary, "Data1", value["Data1"]);
|
dictionary(temperaturedictionary, "Data2", value["Data2"]);
|
}
|
|
}
|
}
|
}
|
///更新最新空调状态;
|
mUIPickerView.setCurrentItems(indextemperature, indexmode, indexspeed);
|
|
///确认事件
|
EventHandler<MouseEventArgs> openclick = (sender, e) =>
|
{
|
pausePickerViewfra.Height = Application.GetRealHeight(0);
|
SelectedDeviceStatusaction = "yes";
|
openBtnSelected.Visible = true;
|
closeBtnSelected.Visible = false;
|
dictionary(switchdictionary, "Data1", "1");
|
var temperature = mList1[indextemperature].Split(' ')[0];
|
var modestring = mList2[indexmode].Split(' ')[0];
|
var speedstring = mList3[indexspeed].Split(' ')[0];
|
|
ModeState(modestring, temperaturedictionary, modedictionary);
|
var a = int.Parse(temperature) * 100;
|
dictionary(temperaturedictionary, "Data2", a.ToString());
|
SpeedState(speedstring, speeddictionary);
|
|
};
|
openrowlayout.MouseUpEventHandler += openclick;
|
btnopen.MouseUpEventHandler += openclick;
|
openBtnSelected.MouseUpEventHandler += openclick;
|
openframelayout.MouseUpEventHandler += openclick;
|
|
///取消事件
|
EventHandler<MouseEventArgs> closeclick = (sender, e) =>
|
{
|
pausePickerViewfra.Height = Application.GetRealHeight(600);
|
|
SelectedDeviceStatusaction = "yes";
|
openBtnSelected.Visible = false;
|
closeBtnSelected.Visible = true;
|
dictionary(switchdictionary, "Data1", "0");
|
};
|
closerowlayout.MouseUpEventHandler += closeclick;
|
btnclose.MouseUpEventHandler += closeclick;
|
closeBtnSelected.MouseUpEventHandler += closeclick;
|
closeframelayout.MouseUpEventHandler += closeclick;
|
}
|
break;
|
|
|
}
|
|
Btncomplete.MouseUpEventHandler += (sender, e) =>
|
{
|
|
if (SelectedDeviceStatusaction == "yes")
|
{
|
LogicIfon.AddDeviceactions(common, actionsInfo);
|
}
|
else
|
{
|
if (!edit)
|
{
|
var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt),
|
Language.StringByID(MyInternationalizationString.selectdevicestatuscondition),
|
Language.StringByID(MyInternationalizationString.complete));
|
alert.Show();
|
return;
|
}
|
|
}
|
flMain.RemoveFromParent();
|
var templatePage = new TemplatePage();
|
UserView.HomePage.Instance.AddChidren(templatePage);
|
UserView.HomePage.Instance.PageIndex += 1;
|
templatePage.Show();
|
|
};
|
|
}
|
|
public static void dictionary(Dictionary<string, string> deviceactionsInfo, string Key, string Value)
|
{
|
if (deviceactionsInfo.ContainsKey(Key))
|
{
|
deviceactionsInfo.Remove(Key);
|
}
|
deviceactionsInfo.Add(Key, Value);
|
}
|
/// <summary>
|
/// 空调模式的状态
|
/// </summary>
|
/// <param name="modestring"></param>
|
/// <param name="temperaturedictionary"></param>
|
/// <param name="modedictionary"></param>
|
public static void ModeState(string modestring, Dictionary<string, string> temperaturedictionary, Dictionary<string, string> modedictionary)
|
{
|
|
if (modestring == Language.StringByID(MyInternationalizationString.logiccool))
|
{
|
dictionary(modedictionary, "Data2", "3");
|
dictionary(temperaturedictionary, "Data1", "5");
|
}
|
else if (modestring == Language.StringByID(MyInternationalizationString.logicheat))
|
{
|
|
dictionary(modedictionary, "Data2", "4");
|
dictionary(temperaturedictionary, "Data1", "4");
|
}
|
else if (modestring == Language.StringByID(MyInternationalizationString.logicauto))
|
{
|
|
dictionary(modedictionary, "Data2", "1");
|
dictionary(temperaturedictionary, "Data1", "7");
|
}
|
else if (modestring == Language.StringByID(MyInternationalizationString.logicdry))
|
{
|
|
dictionary(modedictionary, "Data2", "8");
|
dictionary(temperaturedictionary, "Data1", "5");
|
}
|
else if (modestring == Language.StringByID(MyInternationalizationString.logicfanonly))
|
{
|
dictionary(temperaturedictionary, "Data1", "20");
|
dictionary(modedictionary, "Data2", "7");
|
}
|
|
}
|
/// <summary>
|
/// 风速的模式
|
/// </summary>
|
/// <param name="speedstring"></param>
|
/// <param name="speeddictionary"></param>
|
public static void SpeedState(string speedstring, Dictionary<string, string> speeddictionary)
|
{
|
|
if (speedstring == Language.StringByID(MyInternationalizationString.logiclow))
|
{
|
|
dictionary(speeddictionary, "Data2", "1");
|
|
}
|
else if (speedstring == Language.StringByID(MyInternationalizationString.logicmedium))
|
{
|
|
dictionary(speeddictionary, "Data2", "2");
|
|
}
|
else if (speedstring == Language.StringByID(MyInternationalizationString.logichigh))
|
{
|
|
dictionary(speeddictionary, "Data2", "3");
|
}
|
|
}
|
|
}
|
}
|