From 675df74cdd4103ffdcbfa0a6ccfc105fd61af15a Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期五, 29 十月 2021 15:44:18 +0800
Subject: [PATCH] 2021-10-29 1.更新乐橙 AndroidSDK
---
HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs | 329 +++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 299 insertions(+), 30 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs
index 6ab343a..03fb2c6 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs
@@ -1,4 +1,6 @@
锘縰sing System;
+using System.Collections.Generic;
+using HDL_ON.DriverLayer;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
@@ -9,7 +11,48 @@
/// <summary>
/// 涓荤獥浣�
/// </summary>
- FrameLayout bodyView;
+ public static ArmCenterPage bodyView;
+ /// <summary>
+ /// 鑷畾涔夊竷闃插尯鍩�
+ /// </summary>
+ HorizontalScrolViewLayout customDeploymentView;
+ /// <summary>
+ ///
+ /// </summary>
+ FrameLayout alarmIconBgView;
+ //瀹夐槻鐘舵�佽儗鏅浘
+ Button btnArmTipIcon;
+ /// <summary>
+ /// 瀹夐槻璀︽姤鍥炬爣
+ /// </summary>
+ Button btnInalarmIcon;
+ /// <summary>
+ /// 褰撳墠甯冮槻鍚嶇О
+ /// </summary>
+ Button btnDefenseName;
+
+ /// <summary>
+ /// 鎾ら槻鍖哄煙
+ /// </summary>
+ FrameLayout disarmView;
+
+ /// <summary>
+ /// 甯冮槻鎺ュ彛
+ /// </summary>
+ SecurityAlarm InDefenseMode = null;
+ /// <summary>
+ /// 鑷畾涔夊竷闃叉帶浠跺垪琛�
+ /// </summary>
+ List<ArmDiyView> armDiyViewList = new List<ArmDiyView>();
+
+
+ Action refreshAction = null;
+
+ public ArmCenterPage(Action action)
+ {
+ refreshAction = action;
+ bodyView = this;
+ }
public ArmCenterPage()
{
bodyView = this;
@@ -37,21 +80,89 @@
Height =Application.GetRealWidth(32),
});
- //瀹夐槻鐘舵�佽儗鏅浘
- Button btnArmTipIcon = new Button()
+ alarmIconBgView = new FrameLayout()
{
Gravity = Gravity.CenterHorizontal,
Width = Application.GetRealWidth(198),
Height = Application.GetRealWidth(198),
+ };
+ contentView.AddChidren(alarmIconBgView);
+
+ btnArmTipIcon = new Button()
+ {
+ //Gravity = Gravity.CenterHorizontal,
+ //Width = Application.GetRealWidth(198),
+ //Height = Application.GetRealWidth(198),
UnSelectedImagePath = "FunctionIcon/ArmCenter/NoDefenseBigIcon.png",
SelectedImagePath = "FunctionIcon/ArmCenter/InDefenseBigIcon.png",
};
- contentView.AddChidren(btnArmTipIcon);
+ alarmIconBgView.AddChidren(btnArmTipIcon);
+
+ btnInalarmIcon = new Button()
+ {
+ Width = Application.GetRealWidth(198),
+ Height = Application.GetRealWidth(198),
+ UnSelectedImagePath = "FunctionIcon/ArmCenter/InAlarmBigIcon.png",
+ };
+ btnInalarmIcon.MouseUpEventHandler = (sender, e) => {
+ if(InDefenseMode!= null)
+ {
+ Action action = () =>
+ {
+ InDefenseMode.alarm = false;
+ Control.Ins.ControlSecurity(InDefenseMode, "enable");
+ };
+ new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.ClearTheSecurityAlarmTip, action);
+
+ }
+ };
+
+ btnDefenseName = new Button()
+ {
+ Y = Application.GetRealWidth(117),
+ Height = Application.GetRealHeight(81),
+ TextAlignment = TextAlignment.Center,
+ TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+ TextColor = CSS_Color.MainBackgroundColor,
+ };
+ alarmIconBgView.AddChidren(btnDefenseName);
contentView.AddChidren(new Button()
{
Height = Application.GetRealWidth(16),
});
+
+
+ #region 鎾ら槻鍖哄煙
+ Button btnDisarm;
+ disarmView = new FrameLayout()
+ {
+ Height = 0,
+ };
+ contentView.AddChidren(disarmView);
+
+ btnDisarm = new Button()
+ {
+ Y = Application.GetRealHeight(10),
+ Width = Application.GetRealWidth(148),
+ Height = Application.GetRealHeight(40),
+ BackgroundColor = CSS_Color.MainColor,
+ TextAlignment = TextAlignment.Center,
+ TextColor = CSS_Color.MainBackgroundColor,
+ TextID = StringId.chefang,// = "鎾ら槻",
+ Radius = (uint)Application.GetRealWidth(20),
+ Gravity = Gravity.CenterHorizontal,
+ };
+ disarmView.AddChidren(btnDisarm);
+
+ btnDisarm.MouseUpEventHandler = (sender, e) => {
+ if(InDefenseMode!= null)
+ {
+ Control.Ins.ControlSecurity(InDefenseMode, "disable");
+ }
+ };
+
+ #endregion
#region 鑷畾涔夊竷闃�
//鑷畾涔夊竷闃叉爣棰�
@@ -67,7 +178,7 @@
};
contentView.AddChidren(btnCustomDeploymentTitle);
- HorizontalScrolViewLayout customDeploymentView = new HorizontalScrolViewLayout()
+ customDeploymentView = new HorizontalScrolViewLayout()
{
X = Application.GetRealWidth(23),
Height = Application.GetRealWidth(80),
@@ -75,28 +186,7 @@
};
contentView.AddChidren(customDeploymentView);
- //customDeploymentView.AddChidren(new Button()
- //{
- // Width = Application.GetRealWidth(23),
- //});
- var view = new ArmDiyView("FunctionIcon/ArmCenter/AtHomeDefenseIcon.png", "FunctionIcon/ArmCenter/AtHomeDefenseIconOn.png",
- Language.StringByID(StringId.HouseDefense));
- customDeploymentView.AddChidren(view);
- EventHandler<MouseEventArgs> event1 = (sender, e) =>
- {
- ShowArmDialog(new SecurityAlarm());
- };
- view.SetClickEvent(event1);
-
- if(FunctionList.List.securities.Count>3)
- {
- customDeploymentView.ScrollEnabled = true;
- }
-
- foreach (var mode in FunctionList.List.securities)
- {
- }
#endregion
contentView.AddChidren(new Button()
@@ -104,6 +194,8 @@
Height = Application.GetRealHeight(20),
});
+ #region 鍥哄畾甯冮槻鍖哄煙
+ /*
var fixedDeploymentView = new FrameLayout()
{
Height = Application.GetRealHeight(133),
@@ -134,7 +226,6 @@
};
fixedDeploymentView.AddChidren(btnFixedDeploymentTip);
- //鍥哄畾甯冮槻鍖哄煙
var fixedDeploymentTypeView = new HorizontalScrolViewLayout()
{
Y = btnFixedDeploymentTip.Bottom + Application.GetRealHeight(15),
@@ -148,7 +239,7 @@
Width = Application.GetRealWidth(24),
});
-
+ #endregion
//鐏惧鎶ヨ
@@ -163,10 +254,89 @@
//闃茬洍鎶ヨ
var burglarAlarmView = new FixedArmView("FunctionIcon/ArmCenter/BurglarAlarmIcon.png", Language.StringByID(StringId.BurglarAlarm), Language.StringByID(StringId.AlarmMute));
fixedDeploymentTypeView.AddChidren(burglarAlarmView);
+ */
+ #endregion
+
+
+ iniCustomDeploymentView();
}
+ /// <summary>
+ /// 鍒濆鍖栨姤璀︾姸鎬�
+ /// </summary>
+ /// <param name="inAlarm"></param>
+ public void InitAlarmStatus(bool inAlarm)
+ {
+ try
+ {
+ if (inAlarm)
+ {
+ if (btnInalarmIcon.Parent == null)
+ {
+ alarmIconBgView.AddChidren(btnInalarmIcon);
+ }
+ }
+ else
+ {
+ if (btnInalarmIcon.Parent != null)
+ {
+ btnInalarmIcon.RemoveFromParent();
+ }
+ }
+ }
+ catch { }
+ }
+ /// <summary>
+ /// 鍒濆鍖栬嚜瀹氫箟甯冮槻鍖哄煙
+ /// </summary>
+ private void iniCustomDeploymentView()
+ {
+ customDeploymentView.RemoveAll();
+ armDiyViewList.Clear();
+ foreach (var mode in FunctionList.List.securities)
+ {
+ var armDiyView = new ArmDiyView("FunctionIcon/ArmCenter/AtHomeDefenseIcon.png", "FunctionIcon/ArmCenter/AtHomeDefenseIconOn.png",
+ mode.name,mode.sid);
+ customDeploymentView.AddChidren(armDiyView);
+ EventHandler<MouseEventArgs> event2 = (sender, e) =>
+ {
+ ShowArmDialog(mode);
+ };
+ armDiyView.SetClickEvent(event2);
+ if (mode.status == "enable")
+ {
+ armDiyView.LightingView(true);
+ InDefenseMode = mode;
+
+ ///鍒锋柊鐣岄潰
+ LoadEvent_RefreshSecurityStatus(InDefenseMode);
+ }
+ armDiyViewList.Add(armDiyView);
+ }
+
+ if (FunctionList.List.securities.Count < 4)
+ {
+ var view = new ArmDiyView("FunctionIcon/ArmCenter/AddDefenseIcon.png", "FunctionIcon/ArmCenter/AddDefenseIcon.png",
+ Language.StringByID(StringId.Custom),"customSid");
+ customDeploymentView.AddChidren(view);
+ EventHandler<MouseEventArgs> event1 = (sender, e) =>
+ {
+ Action refreshAction = () =>
+ {
+ iniCustomDeploymentView();
+ };
+
+ var addDefensePage = new AddAlarmDeploymentPage(new SecurityAlarm(), refreshAction);
+ MainPage.BasePageView.AddChidren(addDefensePage);
+ addDefensePage.LoadPage();
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ };
+ view.SetClickEvent(event1);
+ }
+
+ }
private void ShowArmDialog(SecurityAlarm alarm)
{
@@ -231,10 +401,30 @@
dialog.Show();
+ if(alarm.status == "enable")
+ {
+ btnOpen.TextColor = CSS_Color.PromptingColor1;
+ btnOpen.Text = Language.StringByID(StringId.AlreadyOpened).Trim() ;
+ }
+
+ btnOpen.MouseUpEventHandler = (sender, e) => {
+ string controlStatus = alarm.status == "disable" ? "enable" : "disable";
+ new System.Threading.Thread(() =>
+ {
+ Control.Ins.ControlSecurity(alarm, controlStatus);
+ })
+ { IsBackground = true }.Start();
+ dialog.Close();
+ };
+
btnCheckModify.MouseUpEventHandler = (sender, e) => {
dialog.Close();
- var armSetPage = new ArmDeploymentSettingPage(alarm);
+ Action refreshAction = () =>
+ {
+ iniCustomDeploymentView();
+ };
+ var armSetPage = new AddAlarmDeploymentPage(alarm,refreshAction);
MainPage.BasePageView.AddChidren(armSetPage);
armSetPage.LoadPage();
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
@@ -247,7 +437,73 @@
}
+ public static void LoadEvent_RefreshSecurityStatus(SecurityAlarm updataTemp)
+ {
+ Application.RunOnMainThread(() =>
+ {
+ try
+ {
+ if (bodyView != null)
+ {
+ bodyView.refreshAction?.Invoke();
+ //甯冮槻
+ if (updataTemp.status == "enable")
+ {
+ bodyView.InDefenseMode = updataTemp;
+ foreach (var tempView in bodyView.armDiyViewList)
+ {
+ tempView.LightingView(false);
+ if (tempView.sid == updataTemp.sid)
+ {
+ tempView.LightingView(updataTemp.status == "enable");
+ }
+ }
+ }
+ else
+ {
+ //鎾ら槻
+ if(bodyView.InDefenseMode.sid == updataTemp.sid)
+ {
+ foreach (var tempView in bodyView.armDiyViewList)
+ {
+ tempView.LightingView(false);
+ }
+ }
+ }
+
+
+ //foreach(var tempView in bodyView.armDiyViewList)
+ //{
+ // tempView.LightingView(false);
+ // if(tempView.sid == updataTemp.sid)
+ // {
+ // tempView.LightingView(updataTemp.status == "enable");
+ // }
+ //}
+
+ //娌℃湁甯冮槻鐨勬儏鍐�
+ if (bodyView.InDefenseMode ==null|| bodyView.InDefenseMode.status == "disable")
+ {
+ bodyView.disarmView.Height = 0;
+ bodyView.btnArmTipIcon.IsSelected = false;
+ bodyView.btnDefenseName.Text = "";
+ }
+ else
+ {
+ bodyView.disarmView.Height = Application.GetRealHeight(68);
+ bodyView.btnArmTipIcon.IsSelected = true;
+ bodyView.btnDefenseName.Text = bodyView.InDefenseMode.name;
+ }
+ bodyView.InitAlarmStatus(bodyView.InDefenseMode.alarm);
+ }
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log($"瀹夐槻鐣岄潰鏇存柊寮傚父锛歿ex.Message}");
+ }
+ });
+ }
}
@@ -258,14 +514,16 @@
{
Button btnIcon;
Button btnText;
+ public string sid;
/// <summary>
/// 鑷畾涔夊竷闃茬晫闈�
/// </summary>
/// <param name="UnSelectedIconPath">鍥剧墖璺緞</param>
/// <param name="SelectedIconPath">鍥剧墖璺緞</param>
/// <param name="Text">鏄剧ず鏂囨湰</param>
- public ArmDiyView(string UnSelectedIconPath, string SelectedIconPath, string Text)
+ public ArmDiyView(string UnSelectedIconPath, string SelectedIconPath, string Text,string inSid)
{
+ sid = inSid;
this.Width = Application.GetRealWidth(82);
this.Height = Application.GetRealWidth(80);
@@ -298,9 +556,20 @@
btnText.MouseUpEventHandler = eventHandler;
}
+ /// <summary>
+ /// 鐐逛寒鍖哄煙
+ /// </summary>
+ public void LightingView(bool seleted)
+ {
+ btnIcon.IsSelected = seleted;
+ }
+
}
+ /// <summary>
+ /// 鍥哄畾甯冮槻鎺т欢
+ /// </summary>
public class FixedArmView : FrameLayout
{
/// <summary>
--
Gitblit v1.8.0