From 580a4715eeb88e13128e65963834b159768444cf Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期三, 08 一月 2020 10:19:39 +0800
Subject: [PATCH] 2019.1.8
---
ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs | 40 +-----
ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml | 16 +
ZigbeeApp/Shared/Phone/Device/Light/OnOffControl.cs | 243 +++++++++++++++++++++++++++++-----------
ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide | 0
ZigbeeApp/Shared/Phone/Device/Category/Category.cs | 39 +-----
5 files changed, 203 insertions(+), 135 deletions(-)
diff --git a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
index 686a202..65a5a8f 100644
--- a/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
+++ b/ZigbeeApp/.vs/GateWay/xs/UserPrefs.xml
@@ -2,14 +2,17 @@
<MonoDevelop.Ide.ItemProperties.GateWay.Droid PreferredExecutionTarget="Android.M7BBB18B19152766" />
<MonoDevelop.Ide.ItemProperties.GateWay.Ios automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.8c0bdb303f25d82c2a42fb8bfca449bfaca00260" />
<MonoDevelop.Ide.ItemProperties.ShardLib PreferredExecutionTarget="Android.M7BBB18B19152766" />
- <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/UserView/UserHomeView.cs">
+ <MonoDevelop.Ide.Workbench ActiveDocument="Shared/Phone/Device/Light/PlugControl.cs">
<Files>
<File FileName="Shared/R.cs" Line="988" Column="13" />
<File FileName="GateWay.Droid/Assets/Language.ini" />
- <File FileName="Shared/Phone/UserView/UserHomeView.cs" Line="1020" Column="90" />
+ <File FileName="Shared/Phone/UserView/UserHomeView.cs" Line="1207" Column="103" />
<File FileName="Shared/Phone/Device/Category/Category.cs" />
<File FileName="Shared/Phone/Device/CommonForm/DeviceDetailInfo.cs" />
<File FileName="Shared/Common/Room.cs" />
+ <File FileName="Shared/Phone/Device/Light/OnOffControl.cs" Line="566" Column="10" />
+ <File FileName="Shared/Phone/Device/Light/LightControl.cs" Line="471" Column="19" />
+ <File FileName="Shared/Phone/Device/Light/PlugControl.cs" Line="423" Column="52" />
</Files>
<Pads>
<Pad Id="ProjectPad">
@@ -31,10 +34,13 @@
<Node name="Category" expanded="True" />
<Node name="CommonForm" expanded="True" />
<Node name="Curtain" expanded="True" />
- <Node name="Light" expanded="True" />
+ <Node name="Light" expanded="True">
+ <Node name="PlugControl.cs" selected="True" />
+ </Node>
</Node>
- <Node name="UserView" expanded="True">
- <Node name="UserHomeView.cs" selected="True" />
+ <Node name="UserView" expanded="True" />
+ <Node name="ZigBee" expanded="True">
+ <Node name="Device" expanded="True" />
</Node>
</Node>
</Node>
diff --git a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
index 1d6b88b..c4cc576 100644
--- a/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
+++ b/ZigbeeApp/.vs/GateWay/xs/sqlite3/storage.ide
Binary files differ
diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
index 36aa8a7..cef4542 100644
--- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -1134,39 +1134,14 @@
};
deviceRow.ClickBtn.MouseUpEventHandler += (send2, e2) =>
{
- if (deviceUI.CommonDevice.DfunctionType == DeviceFunctionType.A寮�鍏�)
+ var lightControl = new Phone.Device.Light.OnOffControl();
+ UserView.HomePage.Instance.AddChidren(lightControl);
+ UserView.HomePage.Instance.PageIndex += 1;
+ lightControl.Show(deviceUI, Common.Room.CurrentRoom);
+ lightControl.action += (curDev, curRoom) =>
{
- var lightControl = new Phone.Device.Light.OnOffControl();
- UserView.HomePage.Instance.AddChidren(lightControl);
- UserView.HomePage.Instance.PageIndex += 1;
- lightControl.Show(deviceUI, Common.Room.CurrentRoom);
- lightControl.action += (curDev, curRoom) =>
- {
- ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
- };
- }
- else if (deviceUI.CommonDevice.DfunctionType == DeviceFunctionType.A鎻掑骇)
- {
- var lightControl = new Phone.Device.Light.PlugControl();
- UserView.HomePage.Instance.AddChidren(lightControl);
- UserView.HomePage.Instance.PageIndex += 1;
- lightControl.Show(deviceUI, Common.Room.CurrentRoom);
- lightControl.action += (curDev, curRoom) =>
- {
- ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
- };
- }
- else
- {
- var lightControl = new Phone.Device.Light.LightControl();
- UserView.HomePage.Instance.AddChidren(lightControl);
- UserView.HomePage.Instance.PageIndex += 1;
- lightControl.Show(deviceUI, Common.Room.CurrentRoom);
- lightControl.action += (curDev, curRoom) =>
- {
- ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
- };
- }
+ ReFreshDeviceAction(deviceUI, curRoom, sameTypeList, deviceListScrolView, deviceRow);
+ };
};
EventHandler<MouseEventArgs> deviceDetailHandler = (send2, e2) =>
diff --git a/ZigbeeApp/Shared/Phone/Device/Light/OnOffControl.cs b/ZigbeeApp/Shared/Phone/Device/Light/OnOffControl.cs
index 1ecca52..6bf5fb6 100644
--- a/ZigbeeApp/Shared/Phone/Device/Light/OnOffControl.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Light/OnOffControl.cs
@@ -144,8 +144,22 @@
return;
}
light.OnOffStatus = light.DeviceStatusReport.AttriBute[0].AttriButeData;
- SetONOFFStatu(light.OnOffStatus == 1);
StatuBtn.Text = $"{Language.StringByID(R.MyInternationalizationString.Current)} {device.GetDeviceStatu()}";
+
+ if (device.CommonDevice.DfunctionType == DeviceFunctionType.A寮�鍏�)
+ {
+ SetONOFFStatu(light.OnOffStatus == 1);
+ }
+ else if (device.CommonDevice.DfunctionType == DeviceFunctionType.A鎻掑骇)
+ {
+ deviceIMG.IsSelected = switchBtn.IsSelected = light.OnOffStatus == 1;
+ }
+ else
+ {
+ deviceIMG.IsSelected = switchBtn.IsSelected = light.OnOffStatus == 1;
+ }
+
+
light.LastDateTime = DateTime.Now;
}
}
@@ -354,40 +368,6 @@
};
itemView.AddChidren(StatuBtn);
- deviceIMG = new Button()
- {
- Y = Application.GetRealHeight(340),
- Width = Application.GetMinRealAverage(579),
- Height = Application.GetMinRealAverage(579),
- Gravity = Gravity.CenterHorizontal,
- UnSelectedImagePath = "Light/OnOff.png",
- };
- itemView.AddChidren(deviceIMG);
-
- OffBtn = new Button
- {
- X = Application.GetRealWidth(294),
- Y = Application.GetRealHeight(588),
- Width = Application.GetMinRealAverage(81),
- Height = Application.GetMinRealAverage(81),
- UnSelectedImagePath = "Light/OFF.png",
- SelectedImagePath = "Light/OFFSelected.png",
- IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 0
- };
- itemView.AddChidren(OffBtn);
-
- OnBtn = new Button
- {
- X = Application.GetRealWidth(590),
- Y = Application.GetRealHeight(588),
- Width = Application.GetMinRealAverage(81),
- Height = Application.GetMinRealAverage(81),
- UnSelectedImagePath = "Light/ON.png",
- SelectedImagePath = "Light/ONSelected.png",
- IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 1
- };
- itemView.AddChidren(OnBtn);
-
var roomBG = new Button
{
Y = Application.GetRealHeight(1178 - 50),
@@ -427,6 +407,138 @@
TextSize = 12
};
itemView.AddChidren(roomName);
+
+ AddByFunctionType(itemView);
+ }
+
+ /// <summary>
+ /// AddByFunctionType
+ /// </summary>
+ private void AddByFunctionType(FrameLayout itemView)
+ {
+ if(device.CommonDevice.DfunctionType == DeviceFunctionType.A寮�鍏�)
+ {
+ AddOnOff(itemView);
+ }
+ else if(device.CommonDevice.DfunctionType == DeviceFunctionType.A鎻掑骇)
+ {
+ AddPlug(itemView);
+ }
+ else
+ {
+ AddLight(itemView);
+ }
+ }
+
+ /// <summary>
+ /// AddOnOff
+ /// </summary>
+ private void AddOnOff(FrameLayout itemView)
+ {
+ deviceIMG = new Button()
+ {
+ Y = Application.GetRealHeight(340),
+ Width = Application.GetMinRealAverage(579),
+ Height = Application.GetMinRealAverage(579),
+ Gravity = Gravity.CenterHorizontal,
+ UnSelectedImagePath = "Light/OnOff.png",
+ };
+ itemView.AddChidren(deviceIMG);
+
+ OffBtn = new Button
+ {
+ X = Application.GetRealWidth(294),
+ Y = Application.GetRealHeight(588),
+ Width = Application.GetMinRealAverage(81),
+ Height = Application.GetMinRealAverage(81),
+ UnSelectedImagePath = "Light/OFF.png",
+ SelectedImagePath = "Light/OFFSelected.png",
+ IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 0
+ };
+ itemView.AddChidren(OffBtn);
+
+ OnBtn = new Button
+ {
+ X = Application.GetRealWidth(590),
+ Y = Application.GetRealHeight(588),
+ Width = Application.GetMinRealAverage(81),
+ Height = Application.GetMinRealAverage(81),
+ UnSelectedImagePath = "Light/ON.png",
+ SelectedImagePath = "Light/ONSelected.png",
+ IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 1
+ };
+ itemView.AddChidren(OnBtn);
+
+ OnBtn.MouseUpEventHandler += ON;
+ OffBtn.MouseUpEventHandler += OFF;
+ }
+
+ /// <summary>
+ /// light
+ /// </summary>
+ /// <param name="itemView"></param>
+ private void AddLight(FrameLayout itemView)
+ {
+ deviceIMG = new Button()
+ {
+ Y = Application.GetRealHeight(389),
+ Width = Application.GetMinRealAverage(377),
+ Height = Application.GetMinRealAverage(435),
+ Gravity = Gravity.CenterHorizontal,
+ UnSelectedImagePath = "Light/DeskLamp.png",
+ SelectedImagePath = "Light/DeskLampSelected.png",
+ IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 1
+ };
+ itemView.AddChidren(deviceIMG);
+
+ switchBtn = new Button()
+ {
+ Y = Application.GetRealHeight(996),
+ Width = Application.GetMinRealAverage(81),
+ Height = Application.GetMinRealAverage(81),
+ Gravity = Gravity.CenterHorizontal,
+ UnSelectedImagePath = "Item/Switch.png",
+ SelectedImagePath = "Item/SwitchSelected.png",
+ IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 1
+ };
+ itemView.AddChidren(switchBtn);
+
+ switchBtn.MouseUpEventHandler += Switch;
+ deviceIMG.MouseUpEventHandler += Switch;
+ }
+
+ /// <summary>
+ /// plug
+ /// </summary>
+ /// <param name="itemView"></param>
+ private void AddPlug(FrameLayout itemView)
+ {
+ deviceIMG = new Button()
+ {
+ Y = Application.GetRealHeight(344),
+ Width = Application.GetMinRealAverage(567),
+ Height = Application.GetMinRealAverage(567),
+ Gravity = Gravity.CenterHorizontal,
+ UnSelectedImagePath = "Light/Plug.png",
+ SelectedImagePath = "Light/PlugSelected.png",
+ IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 1
+ };
+ itemView.AddChidren(deviceIMG);
+
+ switchBtn = new Button()
+ {
+ Y = Application.GetRealHeight(996),
+ Width = Application.GetMinRealAverage(81),
+ Height = Application.GetMinRealAverage(81),
+ Gravity = Gravity.CenterHorizontal,
+ UnSelectedImagePath = "Item/Switch.png",
+ SelectedImagePath = "Item/SwitchSelected.png",
+ IsSelected = (device.CommonDevice as ToggleLight).OnOffStatus == 1
+ };
+ itemView.AddChidren(switchBtn);
+
+ switchBtn.MouseUpEventHandler += Switch;
+ deviceIMG.MouseUpEventHandler += Switch;
}
#endregion
@@ -437,8 +549,6 @@
/// </summary>
private void BindEvent()
{
- OnBtn.MouseUpEventHandler += ON;
- OffBtn.MouseUpEventHandler += OFF;
collectionBtn.MouseUpEventHandler += Collection;
}
@@ -451,35 +561,36 @@
/// </summary>
/// <param name="sender">Sender.</param>
/// <param name="eventArgs">Event arguments.</param>
- //private void Switch(object sender, MouseEventArgs eventArgs)
- //{
- // sendedControlCommand = false;
- // zbGateway.ReportAction += UpdateDeviceControllStatu;
- // switchBtn.IsSelected = !switchBtn.IsSelected;
- // deviceIMG.IsSelected = !deviceIMG.IsSelected;
- // StatuBtn.Text = CommonFormResouce.GetSwitchStatu(deviceIMG.IsSelected);
- // if (switchBtn.IsSelected == true)
- // {
- // (device.CommonDevice as ToggleLight).SwitchControl(1);
- // }
- // else
- // {
- // (device.CommonDevice as ToggleLight).SwitchControl(0);
- // }
- // //鎺у埗寤舵椂鍥炶皟
- // DeviceUI.SendCommandDelayAction(device.CommonDevice, () =>
- // {
- // if (Parent == null)
- // {
- // return;
- // }
- // RemoveUpdateControlDeviceStatuAction();
- // if (sendedControlCommand == false)
- // {
- // DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL);
- // }
- // });
- //}
+ private void Switch(object sender, MouseEventArgs eventArgs)
+ {
+ sendedControlCommand = false;
+ zbGateway.ReportAction += UpdateDeviceControllStatu;
+ switchBtn.IsSelected = !switchBtn.IsSelected;
+ deviceIMG.IsSelected = !deviceIMG.IsSelected;
+ StatuBtn.Text = deviceIMG.IsSelected ? $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Open)}" : $"{Language.StringByID(R.MyInternationalizationString.Current)} {Language.StringByID(R.MyInternationalizationString.Shut)}";
+
+ if (switchBtn.IsSelected == true)
+ {
+ (device.CommonDevice as ToggleLight).SwitchControl(1);
+ }
+ else
+ {
+ (device.CommonDevice as ToggleLight).SwitchControl(0);
+ }
+ //鎺у埗寤舵椂鍥炶皟
+ DeviceUI.SendCommandDelayAction(device.CommonDevice, () =>
+ {
+ if (Parent == null)
+ {
+ return;
+ }
+ RemoveUpdateControlDeviceStatuAction();
+ if (sendedControlCommand == false)
+ {
+ DeviceUI.ShowStatuTip(R.MyInternationalizationString.FAIL);
+ }
+ });
+ }
/// <summary>
/// ON
diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
index 4be7cd0..2f4638f 100644
--- a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
+++ b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
@@ -1202,39 +1202,15 @@
functionView.CardBG.MouseUpEventHandler += (sender, e) =>
{
CommonPage.Instance.IsDrawerLockMode = true;
- if (device.CommonDevice.DfunctionType == DeviceFunctionType.A寮�鍏�)
+
+ var lightControl = new Phone.Device.Light.OnOffControl();
+ UserView.HomePage.Instance.AddChidren(lightControl);
+ UserView.HomePage.Instance.PageIndex += 1;
+ lightControl.Show(device, Room.CurrentRoom);
+ lightControl.action += (curDev, curRoom) =>
{
- var lightControl = new Phone.Device.Light.OnOffControl();
- UserView.HomePage.Instance.AddChidren(lightControl);
- UserView.HomePage.Instance.PageIndex += 1;
- lightControl.Show(device, Room.CurrentRoom);
- lightControl.action += (curDev, curRoom) =>
- {
- ReFreshEditDeviceAction(device, curRoom, functionView);
- };
- }
- else if (device.CommonDevice.DfunctionType == DeviceFunctionType.A鎻掑骇)
- {
- var lightControl = new Phone.Device.Light.PlugControl();
- UserView.HomePage.Instance.AddChidren(lightControl);
- UserView.HomePage.Instance.PageIndex += 1;
- lightControl.Show(device, Room.CurrentRoom);
- lightControl.action += (curDev, curRoom) =>
- {
- ReFreshEditDeviceAction(device, curRoom, functionView);
- };
- }
- else
- {
- var lightControl = new Phone.Device.Light.LightControl();
- UserView.HomePage.Instance.AddChidren(lightControl);
- UserView.HomePage.Instance.PageIndex += 1;
- lightControl.Show(device, Room.CurrentRoom);
- lightControl.action += (curDev, curRoom) =>
- {
- ReFreshEditDeviceAction(device, curRoom, functionView);
- };
- }
+ ReFreshEditDeviceAction(device, curRoom, functionView);
+ };
};
functionView.CollectButton.MouseUpEventHandler += collectionEvent;
--
Gitblit v1.8.0