From 74a9ba8e9a2df9c39f9c2eb212a5ac889a055cd4 Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期二, 03 十二月 2019 10:47:51 +0800
Subject: [PATCH] 优化UI细节(请合并最新代码)
---
ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs | 424 +++++++++++++++++++++++++++++-----------------------
1 files changed, 238 insertions(+), 186 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs
index 9d85f19..d349226 100755
--- a/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/DeviceTarget.cs
@@ -17,149 +17,273 @@
}
public void Show ()
{
-
- this.BackgroundColor = ZigbeeColor.Current.LogicTopViewBackgroundColor;
- var topFrameLayout = new FrameLayout
+ #region 鏈�涓婇潰鐨勫竷灞�浠g爜
+ var topRowLayout = new RowLayout
{
- Height = Application.GetRealHeight(140),
- Y = Application.GetRealHeight(80),
+ BackgroundColor = ZigbeeColor.Current.LogicTopBackgroundColor,
+ Height = Application.GetRealHeight(184),
+ LineColor = ZigbeeColor.Current.LogicRowLayoutTopLineColor,
};
- AddChidren(topFrameLayout);
+ this.AddChidren(topRowLayout);
-
- var titleName = new Button {
- //Text = "娣诲姞鎵ц鐩爣",
- //TextID = MyInternationalizationString.addImplementationgoals,
+ var titleName = new Button
+ {
TextSize = 17,
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+ TextAlignment = TextAlignment.CenterLeft,
+ X = Application.GetRealWidth(176),
+ Width = Application.GetRealWidth(600),
+ Height = Application.GetRealHeight(69),
+ Y = Application.GetRealHeight(92),
+ TextID = MyInternationalizationString.addaction,
};
- topFrameLayout.AddChidren (titleName);
+ topRowLayout.AddChidren(titleName);
- var back = new Button {
- Width = Application.GetRealWidth (110),
- Height = Application.GetRealHeight (110),
- X = Application.GetRealWidth (20),
- Gravity = Gravity.CenterVertical,
- UnSelectedImagePath = "ZigeeLogic/Back.png",
+ var clickBtn = new Button
+ {
+ Width = Application.GetRealWidth(81 + 51),
+ Height = Application.GetRealHeight(58 + 40),
+ Y = Application.GetRealHeight(98 - 40),
};
- topFrameLayout.AddChidren (back);
+ topRowLayout.AddChidren(clickBtn);
+ clickBtn.MouseDownEventHandler += (sender, e) =>
+ {
+ RemoveFromParent();
+ };
+
+ 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 ();
+ RemoveFromParent();
};
+ #endregion
-
- var middle = new VerticalScrolViewLayout ();
- middle.Y = topFrameLayout.Bottom;
- middle.Height = Application.GetRealHeight(1920 - 220);
- middle.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
+
+ var middle = new FrameLayout
+ {
+ Y = topRowLayout.Bottom,
+ Height = Application.GetRealHeight(1920 - 184),
+ BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
+ };
this.AddChidren(middle);
- var deviceRowLayout = new RowLayout
+ #region ----- 璁惧------
+ var deviceframelayout = new FrameLayout
{
- Height = Application.GetRealHeight(180),
- //BackgroundColor = 0xff323232,
+ Height = Application.GetRealHeight(160),
+ BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
};
- middle.AddChidren (deviceRowLayout);
+ middle.AddChidren(deviceframelayout);
- var device = new Button {
- Width = Application.GetRealWidth (400),
+ var deviceiconBtn = new Button
+ {
+ Width = Application.GetRealWidth(81),
+ Height = Application.GetRealHeight(81),
+ X = Application.GetRealWidth(58),
+ Y = Application.GetRealHeight(55),
+ UnSelectedImagePath = "ZigeeLogic/function.png",
+
+ };
+ deviceframelayout.AddChidren(deviceiconBtn);
+
+ var devicerow = new RowLayout
+ {
+ Y = Application.GetRealHeight(30),
+ Width = Application.GetRealWidth(850),
+ Height = Application.GetRealHeight(130),
+ X = Application.GetRealWidth(176),
+ LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+ };
+ deviceframelayout.AddChidren(devicerow);
+
+
+ var btndevice = new Button
+ {
TextID = MyInternationalizationString.device,
- //Text = "璁惧",
- TextSize = 16,
TextAlignment = TextAlignment.CenterLeft,
- X = Application.GetRealWidth (40),
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+ TextSize=15,
};
- deviceRowLayout.AddChidren (device);
+ devicerow.AddChidren(btndevice);
- var btndeviceback = new Button {
- Width = Application.GetRealWidth (110),
- Height = Application.GetRealHeight (110),
- UnSelectedImagePath = "ZigeeLogic/next.png",
- SelectedImagePath = "ZigeeLogic/NextSelecte.png",
- X = Application.GetRealWidth (1080-140),//550
+ var btndeviceback = new Button
+ {
+ Width = Application.GetRealWidth(58),
+ Height = Application.GetRealHeight(58),
+ X = Application.GetRealWidth(789),
Gravity = Gravity.CenterVertical,
- };
- deviceRowLayout.AddChidren (btndeviceback);
+ UnSelectedImagePath = "ZigeeLogic/next.png",
- EventHandler<MouseEventArgs> deviceclick = (sender, e) => {
- Common.Logic.LogicDviceList.Clear();
- if (Common.Logic.LogicDviceList.Count == 0)
- {
- Common.Logic.LogicDviceList.AddRange(LocalDevice.Current.listAllDevice.ToArray());
- }
+ };
+ devicerow.AddChidren(btndeviceback);
+
+ EventHandler<MouseEventArgs> devicestateclick = (sender, e) =>
+ {
var logicDevicePage = new LogicDevicePage();
UserView.HomePage.Instance.AddChidren(logicDevicePage);
UserView.HomePage.Instance.PageIndex += 1;
logicDevicePage.Show();
};
- deviceRowLayout.MouseUpEventHandler += deviceclick;
- device.MouseUpEventHandler += deviceclick;
- btndeviceback.MouseUpEventHandler += deviceclick;
+ deviceframelayout.MouseUpEventHandler += devicestateclick;
+ btndevice.MouseUpEventHandler += devicestateclick;
+ btndeviceback.MouseUpEventHandler += devicestateclick;
+ deviceiconBtn.MouseUpEventHandler += devicestateclick;
+ devicerow.MouseUpEventHandler += devicestateclick;
+ #endregion
+
+ #region ----- 鍦烘櫙------
+
+
+ var sceneframelayout = new FrameLayout
+ {
+ Height = Application.GetRealHeight(160),
+ BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+ Y= deviceframelayout.Bottom,
+ };
+ middle.AddChidren(sceneframelayout);
+
+ var sceneiconBtn = new Button
+ {
+ Width = Application.GetRealWidth(81),
+ Height = Application.GetRealHeight(81),
+ X = Application.GetRealWidth(58),
+ Y = Application.GetRealHeight(55),
+ UnSelectedImagePath = "ZigeeLogic/scene.png",
+
+ };
+ sceneframelayout.AddChidren(sceneiconBtn);
+
var sceneRowLayout = new RowLayout {
- Height = Application.GetRealHeight (180),
- //BackgroundColor = 0xff323232,
- Y=deviceRowLayout.Bottom,
+ Y = Application.GetRealHeight(30),
+ Width = Application.GetRealWidth(850),
+ Height = Application.GetRealHeight(130),
+ X = Application.GetRealWidth(176),
+ LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
};
- middle.AddChidren (sceneRowLayout);
+ sceneframelayout.AddChidren (sceneRowLayout);
var scene = new Button {
- Width = Application.GetRealWidth (400),
TextID = MyInternationalizationString.scene,
- //Text = "鍦烘櫙",
- TextSize = 16,
TextAlignment = TextAlignment.CenterLeft,
- X = Application.GetRealWidth (40),
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+ TextSize = 15,
};
sceneRowLayout.AddChidren (scene);
var btnsceneback = new Button {
- Width = Application.GetRealWidth (110),
- Height = Application.GetRealHeight (110),
- UnSelectedImagePath = "ZigeeLogic/next.png",
- SelectedImagePath = "ZigeeLogic/NextSelecte.png",
- X = Application.GetRealWidth (1080-140),//550
+ Width = Application.GetRealWidth(58),
+ Height = Application.GetRealHeight(58),
+ X = Application.GetRealWidth(789),
Gravity = Gravity.CenterVertical,
+ UnSelectedImagePath = "ZigeeLogic/next.png",
};
sceneRowLayout.AddChidren (btnsceneback);
- EventHandler<MouseEventArgs> sceneclick = (sender, e) => {
- CommonPage.Loading.Start ();
- System.Threading.Tasks.Task.Run (() => {
- Application.RunOnMainThread (() => {
- CommonPage.Loading.Hide ();
- var addScenePage = new AddScenePage ();
- UserView.HomePage.Instance.AddChidren (addScenePage);
- UserView.HomePage.Instance.PageIndex += 1;
- addScenePage.Show ();
-
- });
- });
+ EventHandler<MouseEventArgs> sceneclick = (sender, e) =>
+ {
+ var addScenePage = new AddScenePage();
+ UserView.HomePage.Instance.AddChidren(addScenePage);
+ UserView.HomePage.Instance.PageIndex += 1;
+ addScenePage.Show();
};
sceneRowLayout.MouseUpEventHandler += sceneclick;
scene.MouseUpEventHandler += sceneclick;
btnsceneback.MouseUpEventHandler += sceneclick;
+ sceneframelayout.MouseUpEventHandler += sceneclick;
+ sceneiconBtn.MouseUpEventHandler += sceneclick;
+ #endregion
+ #region ----- 瀹夐槻妯″紡------
+ var securityframelayout = new FrameLayout
+ {
+ Height = Application.GetRealHeight(160),
+ Y = sceneframelayout.Bottom,
+ BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+ };
+ middle.AddChidren(securityframelayout);
+
+ var securityiconBtn = new Button
+ {
+ Width = Application.GetRealWidth(81),
+ Height = Application.GetRealHeight(81),
+ UnSelectedImagePath = "ZigeeLogic/security.png",
+ X = Application.GetRealWidth(58),
+ Y = Application.GetRealHeight(55),
+ };
+ securityframelayout.AddChidren(securityiconBtn);
+
+ var securityrow = new RowLayout
+ {
+ Y = Application.GetRealHeight(30),
+ Width = Application.GetRealWidth(850),
+ Height = Application.GetRealHeight(130),
+ X = Application.GetRealWidth(176),
+ LineColor = ZigbeeColor.Current.LogicRowLayoutLineColor,
+ };
+ securityframelayout.AddChidren(securityrow);
+
+
+ var btnsecurity = new Button
+ {
+ TextAlignment = TextAlignment.CenterLeft,
+ TextID = MyInternationalizationString.securitymode,
+ TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+ TextSize = 15,
+ };
+ securityrow.AddChidren(btnsecurity);
+
+ var btnsecurityback = new Button
+ {
+ Width = Application.GetRealWidth(58),
+ Height = Application.GetRealHeight(58),
+ UnSelectedImagePath = "ZigeeLogic/next.png",
+ X = Application.GetRealWidth(789),
+ Gravity = Gravity.CenterVertical,
+ };
+ securityrow.AddChidren(btnsecurityback);
+
+ EventHandler<MouseEventArgs> securityclick = (sender, e) => {
+ var securityMode = new SecurityMode();
+ UserView.HomePage.Instance.AddChidren(securityMode);
+ UserView.HomePage.Instance.PageIndex += 1;
+ securityMode.Show();
+ };
+
+ securityframelayout.MouseUpEventHandler += securityclick;
+ btnsecurity.MouseUpEventHandler += securityclick;
+ btnsecurityback.MouseUpEventHandler += securityclick;
+ securityiconBtn.MouseUpEventHandler += securityclick;
+ securityrow.MouseUpEventHandler += securityclick;
+ #endregion
+
+ #region ----- 宸叉湁鑷姩鍖�------
///宸叉湁鑷姩鍖�
var existenceRowLayout = new RowLayout
{
Height = Application.GetRealHeight(180),
//BackgroundColor = 0xff323232,
- Y = sceneRowLayout.Bottom,
+ Y = securityframelayout.Bottom,
};
- middle.AddChidren(existenceRowLayout);
+ //middle.AddChidren(existenceRowLayout);
var existence = new Button
{
Width = Application.GetRealWidth(400),
TextID = MyInternationalizationString.Alreadyautomated,
//Text = "宸叉湁鑷姩鍖�",
- TextSize = 16,
+ TextSize = 15,
TextAlignment = TextAlignment.CenterLeft,
X = Application.GetRealWidth(40),
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
@@ -187,146 +311,74 @@
existenceRowLayout.MouseUpEventHandler += existenceclick;
existence.MouseUpEventHandler += existenceclick;
btnexistenceback.MouseUpEventHandler += existenceclick;
+ #endregion
- ///瀹夐槻妯″紡
- var securityRowLayout = new RowLayout
+ #region ----- 寤舵椂------
+
+ var delayedframelayout = new FrameLayout
{
- Height = Application.GetRealHeight(180),
- //BackgroundColor = 0xff323232,
- Y = existenceRowLayout.Bottom,
+ Height = Application.GetRealHeight(160),
+ BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
+ Y = securityframelayout.Bottom,
};
- middle.AddChidren(securityRowLayout);
+ middle.AddChidren(delayedframelayout);
- var security = new Button
+ var delayediconBtn = new Button
{
- Width = Application.GetRealWidth(400),
- TextID = MyInternationalizationString.securitymode,
- //Text = "瀹夐槻妯″紡",
- TextSize = 16,
- TextAlignment = TextAlignment.CenterLeft,
- X = Application.GetRealWidth(40),
- TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+ Width = Application.GetRealWidth(81),
+ Height = Application.GetRealHeight(81),
+ X = Application.GetRealWidth(58),
+ Y = Application.GetRealHeight(55),
+ UnSelectedImagePath = "ZigeeLogic/delay.png",
+
};
- securityRowLayout.AddChidren(security);
-
- var btnsecurityback = new Button
- {
- Width = Application.GetRealWidth(110),
- Height = Application.GetRealHeight(110),
- UnSelectedImagePath = "ZigeeLogic/next.png",
- SelectedImagePath = "ZigeeLogic/NextSelecte.png",
- X = Application.GetRealWidth(1080 - 140),//550
- Gravity = Gravity.CenterVertical,
- };
- securityRowLayout.AddChidren(btnsecurityback);
-
- EventHandler<MouseEventArgs>securityclick = (sender, e) => {
- var securityMode = new SecurityMode();
- UserView.HomePage.Instance.AddChidren(securityMode);
- UserView.HomePage.Instance.PageIndex += 1;
- securityMode.Show();
- };
-
- securityRowLayout.MouseUpEventHandler += securityclick;
- security.MouseUpEventHandler += securityclick;
- btnsecurityback.MouseUpEventHandler += securityclick;
-
-
+ delayedframelayout.AddChidren(delayediconBtn);
var delayedRowLayout = new RowLayout
{
- Height = Application.GetRealHeight(180),
- //BackgroundColor = 0xff323232,
- Y=securityRowLayout.Bottom,
+ Y = Application.GetRealHeight(30),
+ Width = Application.GetRealWidth(850),
+ Height = Application.GetRealHeight(130),
+ X = Application.GetRealWidth(176),
+ LineColor = ZigbeeColor.Current.LogicBlankBackgroundColor,
};
- middle.AddChidren(delayedRowLayout);
+ delayedframelayout.AddChidren(delayedRowLayout);
var delayed = new Button
{
- Width = Application.GetRealWidth(400),
- TextID = MyInternationalizationString.delayed,
- //Text = "寤舵椂",
- TextSize = 16,
TextAlignment = TextAlignment.CenterLeft,
- X = Application.GetRealWidth(40),
+ TextID = MyInternationalizationString.delayed,
TextColor = ZigbeeColor.Current.LogicTextBlackColor,
+ TextSize = 15,
};
delayedRowLayout.AddChidren(delayed);
var btndelayedback = new Button
{
- Width = Application.GetRealWidth(110),
- Height = Application.GetRealHeight(110),
+ Width = Application.GetRealWidth(58),
+ Height = Application.GetRealHeight(58),
UnSelectedImagePath = "ZigeeLogic/next.png",
- SelectedImagePath = "ZigeeLogic/NextSelecte.png",
- X = Application.GetRealWidth(1080 - 140),//550
+ X = Application.GetRealWidth(789),
Gravity = Gravity.CenterVertical,
};
delayedRowLayout.AddChidren(btndelayedback);
EventHandler<MouseEventArgs> delayedclick = (sender, e) =>
{
- //var delayTime = new DelayTime();
- //UserView.HomePage.Instance.AddChidren(delayTime);
- //UserView.HomePage.Instance.PageIndex += 1;
- //delayTime.Show();
- DelayTimeView();
+ var delayTime = new DelayTime();
+ UserView.HomePage.Instance.AddChidren(delayTime);
+ UserView.HomePage.Instance.PageIndex += 1;
+ delayTime.Show();
};
delayedRowLayout.MouseUpEventHandler += delayedclick;
delayed.MouseUpEventHandler += delayedclick;
btndelayedback.MouseUpEventHandler += delayedclick;
-
+ delayedframelayout.MouseUpEventHandler += delayedclick;
+ delayediconBtn.MouseUpEventHandler += delayedclick;
+ #endregion
}
- public static void DelayTimeView(Dictionary<string, object> delayactionsInfo=null)
- {
- var listValues = new List<string>();
- for (int i = 0; i < 60; i++)
- {
- listValues.Add(i.ToString() + " " + Language.StringByID(MyInternationalizationString.second));
- }
- var list = new List<KeyValuePair<string, string[]>> { };
- for (int i = 0; i <= 60; i++)
- {
- list.Add(new KeyValuePair<string, string[]>(i.ToString() + " " + Language.StringByID(MyInternationalizationString.minute), listValues.ToArray()));
- }
-
- /*
- PickerView.Show(list, (obj) =>
- {
- var minute = obj.Split(',')[0].Split(' ')[0];
- var second = obj.Split(',')[1].Split(' ')[0];
- int value = int.Parse(minute) * 60 + int.Parse(second);
- if (value == 0)
- {
- var alert = new Alert(Language.StringByID(MyInternationalizationString.Prompt),
- "鏃堕棿涓嶈兘涓�0",
- Language.StringByID(MyInternationalizationString.complete));
- alert.Show();
- return;
- }
- if (delayactionsInfo == null)
- {
- Dictionary<string, object> actionsInfo = new Dictionary<string, object>();
- actionsInfo.Add("LinkType", 10);
- actionsInfo.Add("DelayTime", value);
- Common.Logic.CurrentLogic.Actions.Add(actionsInfo);
- }
- else
- {
- if (delayactionsInfo.ContainsKey("DelayTime"))
- {
- delayactionsInfo.Remove("DelayTime");
- }
- delayactionsInfo.Add("DelayTime", value);
- }
- var logicCommunalPage = new LogicCommunalPage { };
- UserView.HomePage.Instance.AddChidren(logicCommunalPage);
- UserView.HomePage.Instance.PageIndex += 1;
- logicCommunalPage.Show(() => { });
- }, Language.StringByID(MyInternationalizationString.complete), "");
- */
- }
+
}
}
--
Gitblit v1.8.0