From 9a4b76398009cf76c508d61f7e48fb6f5cb7ac2d Mon Sep 17 00:00:00 2001
From: xm <1271024303@qq.com>
Date: 星期二, 21 七月 2020 09:46:53 +0800
Subject: [PATCH] 请合并最新多功能面板代码
---
ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceCurtainDetailCardForm.cs | 424 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 424 insertions(+), 0 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceCurtainDetailCardForm.cs b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceCurtainDetailCardForm.cs
new file mode 100755
index 0000000..9c67d14
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/MainPage/ControlForm/DeviceCurtainDetailCardForm.cs
@@ -0,0 +1,424 @@
+锘縰sing Shared.Common;
+using Shared.Phone.UserCenter;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using ZigBee.Device;
+
+namespace Shared.Phone.MainPage.ControlForm
+{
+ /// <summary>
+ /// 绐楀笜绫诲瀷鐨勬繁搴﹀崱鐗囩晫闈�
+ /// </summary>
+ public class DeviceCurtainDetailCardForm : DeviceDetailCardCommonForm
+ {
+ #region 鈻� 鍙橀噺澹版槑___________________________
+
+ /// <summary>
+ /// 鎵撳紑鎺т欢
+ /// </summary>
+ private IconBigViewControl btnOpen = null;
+ /// <summary>
+ /// 鍋滄鎺т欢
+ /// </summary>
+ private IconBigViewControl btnStop = null;
+ /// <summary>
+ /// 鍏抽棴鎺т欢
+ /// </summary>
+ private IconBigViewControl btnClose = null;
+ /// <summary>
+ /// 绐楀笜绫诲瀷 4锛氬紑鍚堝笜 0锛氬嵎甯�
+ /// </summary>
+ private int WcdType = -2;
+ /// <summary>
+ /// 寮�鍚堝笜鎺т欢
+ /// </summary>
+ private CurtainSeekBar SeekBarOpenCurtain = null;
+ /// <summary>
+ /// 鍗峰笜鎺т欢
+ /// </summary>
+ private CurtainRollSeekBar SeekBarSiphonateCurtain = null;
+ /// <summary>
+ /// 杩涘害鍊兼槸鍚﹀湪鏀瑰彉涓�
+ /// </summary>
+ private bool isProgressing = false;
+ /// <summary>
+ /// 鏄惁宸茬粡鍒濆鍖栦簡鎺т欢(鍥犱负搴曞眰鏈夊彲鑳戒細鍒锋柊鏁翠釜鐣岄潰)
+ /// </summary>
+ private bool hadInitControl = false;
+
+ #endregion
+
+ #region 鈻� 鍒濆鍖朹____________________________
+
+ /// <summary>
+ /// 搴曞眰鍒濆鍖栦腑閮ㄦ帶浠跺畬鎴愪箣鍚�
+ /// </summary>
+ /// <param name="frameWhiteBack"></param>
+ public override void InitMiddleFrameAfter(FrameLayout frameWhiteBack)
+ {
+ //宸︽粦涓嶈兘
+ this.ScrollEnabled = false;
+ this.WcdType = ((Rollershade)this.device).WcdType;
+ //璁剧疆鐘舵�佹枃瀛�
+ this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
+
+ if (WcdType == 0)
+ {
+ //鍒濆鍖栧嵎甯樻帶浠�
+ this.InitSiphonateCurtainControl(frameWhiteBack);
+ }
+ else
+ {
+ //鍒濆鍖栧紑鍚堝笜鎺т欢
+ this.InitOpenCurtainControl(frameWhiteBack);
+ }
+
+ //鎵撳紑鎺т欢
+ this.btnOpen = new IconBigViewControl(81, 81);
+ btnOpen.btnIcon.UseClickStatu = true;
+ frameWhiteBack.AddChidren(btnOpen);
+ btnOpen.InitControl();
+ btnOpen.X = Application.GetRealWidth(253) - btnOpen.XOffset;
+ btnOpen.Y = Application.GetRealHeight(994) - btnOpen.YOffset;
+ btnOpen.ButtonClickEvent += (sender, e) =>
+ {
+ //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欐鍔熻兘鏃犳晥
+ if (Common.Config.Instance.Home.IsVirtually == true)
+ {
+ ((Rollershade)device).WcdCurrentPositionLiftPercentage = 100;
+ if (this.WcdType == 0)
+ {
+ SeekBarSiphonateCurtain.Progress = 100;
+ }
+ else
+ {
+ SeekBarOpenCurtain.Progress = 100;
+ }
+ //璁剧疆鐘舵�佹枃瀛�
+ this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
+ return;
+ }
+ //鍙戦�佺獥甯樺懡浠�
+ this.SetCurtainCommand(0);
+ };
+
+ //鍋滄鎺т欢
+ this.btnStop = new IconBigViewControl(81, 81);
+ btnStop.btnIcon.UseClickStatu = true;
+ btnStop.UnSelectedImagePath = "RollerShade/Stop.png";
+ btnStop.SelectedImagePath = "RollerShade/StopSelected.png";
+ frameWhiteBack.AddChidren(btnStop);
+ btnStop.InitControl();
+ btnStop.X = btnOpen.Right + Application.GetRealWidth(109) - btnOpen.XOffset;
+ btnStop.Y = btnOpen.Y;
+ btnStop.ButtonClickEvent += (sender, e) =>
+ {
+ //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欐鍔熻兘鏃犳晥
+ if (Common.Config.Instance.Home.IsVirtually == true)
+ {
+ return;
+ }
+ //鍙戦�佺獥甯樺懡浠�
+ this.SetCurtainCommand(2);
+ };
+
+ //鍏抽棴
+ this.btnClose = new IconBigViewControl(81, 81);
+ btnClose.btnIcon.UseClickStatu = true;
+ frameWhiteBack.AddChidren(btnClose);
+ btnClose.InitControl();
+ btnClose.X = btnStop.Right + Application.GetRealWidth(109) - btnOpen.XOffset;
+ btnClose.Y = btnOpen.Y;
+ btnClose.ButtonClickEvent += (sender, e) =>
+ {
+ //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鍒欐鍔熻兘鏃犳晥
+ if (Common.Config.Instance.Home.IsVirtually == true)
+ {
+ ((Rollershade)device).WcdCurrentPositionLiftPercentage = 0;
+ if (this.WcdType == 0)
+ {
+ SeekBarSiphonateCurtain.Progress = 0;
+ }
+ else
+ {
+ SeekBarOpenCurtain.Progress = 0;
+ }
+ //璁剧疆鐘舵�佹枃瀛�
+ this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
+ return;
+ }
+ //鍙戦�佺獥甯樺懡浠�
+ this.SetCurtainCommand(1);
+ };
+
+ if (this.WcdType == 0)
+ {
+ btnOpen.UnSelectedImagePath = "RollerShade/Up.png";
+ btnOpen.SelectedImagePath = "RollerShade/UpSelected.png";
+ btnClose.UnSelectedImagePath = "RollerShade/Down.png";
+ btnClose.SelectedImagePath = "RollerShade/DownSelected.png";
+ }
+ else
+ {
+ btnOpen.UnSelectedImagePath = "RollerShade/Open.png";
+ btnOpen.SelectedImagePath = "RollerShade/OpenSelected.png";
+ btnClose.UnSelectedImagePath = "RollerShade/Close.png";
+ btnClose.SelectedImagePath = "RollerShade/CloseSelected.png";
+ }
+ }
+
+ #endregion
+
+ #region 鈻� 鍒濆鍖栧嵎甯樻帶浠禵____________________
+
+ /// <summary>
+ /// 鍒濆鍖栧嵎甯樻帶浠�
+ /// </summary>
+ private void InitSiphonateCurtainControl(FrameLayout frameWhiteBack)
+ {
+ //鍗峰笜鎺т欢
+ this.SeekBarSiphonateCurtain = new CurtainRollSeekBar();
+ SeekBarSiphonateCurtain.Y = Application.GetRealHeight(300);
+ SeekBarSiphonateCurtain.Width = this.GetPictrueRealSize(438);
+ SeekBarSiphonateCurtain.Height = this.GetPictrueRealSize(576);
+ SeekBarSiphonateCurtain.Gravity = Gravity.CenterHorizontal;
+ SeekBarSiphonateCurtain.Progress = (device as Rollershade).WcdCurrentPositionLiftPercentage;
+ frameWhiteBack.AddChidren(SeekBarSiphonateCurtain);
+ SeekBarSiphonateCurtain.IsProgressTextShow = false;
+ SeekBarSiphonateCurtain.CurtainPaddingTop = Application.GetRealHeight(110);
+
+ //鍗峰笜鎺т欢閲岄潰鐨勯偅涓樉绀虹櫨鍒嗘瘮鐨勬帶浠�
+ int progressY = SeekBarSiphonateCurtain.Y - Application.GetMinReal(204);
+ var btnProgress = new NormalViewControl(Application.GetMinReal(135), Application.GetMinReal(104), false);
+ btnProgress.Y = progressY;
+ btnProgress.UnSelectedImagePath = "Item/ProgressBubbles.png";
+ btnProgress.IsBold = true;
+ btnProgress.TextColor = UserCenterColor.Current.White;
+ btnProgress.Gravity = Gravity.CenterHorizontal;
+ btnProgress.TextAlignment = TextAlignment.Center;
+ frameWhiteBack.AddChidren(btnProgress);
+ btnProgress.Visible = false;
+
+ //寮�濮嬫粦鍔ㄤ簨浠�
+ SeekBarSiphonateCurtain.OnStartTrackingTouchEvent += (sender, e) =>
+ {
+ //杩涘害鍊煎紑濮嬪彉鏇�
+ this.isProgressing = true;
+ //鍙樻洿杩涘害鐧惧垎姣旂殑鏄剧ず
+ btnProgress.Y = progressY + SeekBarSiphonateCurtain.NowProgressY;
+ btnProgress.Text = SeekBarSiphonateCurtain.Progress + "%";
+ if (btnProgress.Visible == false)
+ {
+ btnProgress.Visible = true;
+ }
+ };
+
+ //缁撴潫婊戝姩浜嬩欢
+ SeekBarSiphonateCurtain.OnStopTrackingTouchEvent += (sender, e) =>
+ {
+ //杩涘害鍊煎紑濮嬬粨鏉�
+ this.isProgressing = false;
+ btnProgress.Visible = false;
+ };
+
+ //婊戝姩杩囩▼涓�
+ int oldProgressValue = SeekBarSiphonateCurtain.Progress;//涔嬪墠鐨勫��
+ int nowProgressValue = oldProgressValue;//鍙樻洿鐨勫��
+ SeekBarSiphonateCurtain.OnProgressChangedEvent += (send2, value) =>
+ {
+ //鍙樻洿杩涘害鐧惧垎姣旂殑鏄剧ず
+ btnProgress.Y = progressY + SeekBarSiphonateCurtain.NowProgressY;
+ btnProgress.Text = value + "%";
+
+ if (Common.Config.Instance.Home.IsVirtually == false)
+ {
+ nowProgressValue = value;
+ }
+ else
+ {
+ //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鐩存帴鏀圭紦瀛�
+ (device as Rollershade).WcdCurrentPositionLiftPercentage = value;
+ }
+ };
+
+ if (this.hadInitControl == true)
+ {
+ //宸茬粡瀹屾垚鍒濆鍖�
+ return;
+ }
+ this.hadInitControl = true;
+
+ //寮�涓�涓嚎绋�,鐩戣鏄惁婊戝姩鐨勬粦鍔ㄦ潯,姣忕妫�娴嬩竴娆�
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ while (this.Parent != null)
+ {
+ System.Threading.Thread.Sleep(1000);
+ if (nowProgressValue == oldProgressValue)
+ {
+ //鍊间竴鏍�
+ continue;
+ }
+ oldProgressValue = nowProgressValue;
+ //鍙戦�佽繘搴﹀��
+ (device as Rollershade).WcdGoToTiltValue(oldProgressValue);
+ }
+ });
+ }
+
+ #endregion
+
+ #region 鈻� 鍒濆鍖栧紑鍚堝笜鎺т欢___________________
+
+ /// <summary>
+ /// 鍒濆鍖栧紑鍚堝笜鎺т欢
+ /// </summary>
+ private void InitOpenCurtainControl(FrameLayout frameWhiteBack)
+ {
+ //寮�鍚堝笜鎺т欢
+ this.SeekBarOpenCurtain = new CurtainSeekBar();
+ SeekBarOpenCurtain.Y = Application.GetRealHeight(334);
+ SeekBarOpenCurtain.Width = this.GetPictrueRealSize(570);
+ SeekBarOpenCurtain.Height = this.GetPictrueRealSize(513);
+ SeekBarOpenCurtain.Gravity = Gravity.CenterHorizontal;
+ SeekBarOpenCurtain.IsProgressTextShow = false;
+ SeekBarOpenCurtain.Progress = (device as Rollershade).WcdCurrentPositionLiftPercentage;
+ frameWhiteBack.AddChidren(SeekBarOpenCurtain);
+
+ //寮�鍚堝笜鎺т欢閲岄潰鐨勯偅涓樉绀虹櫨鍒嗘瘮鐨勬帶浠�
+ int progressX = SeekBarOpenCurtain.X - Application.GetMinReal(20);
+ var btnProgress = new NormalViewControl(Application.GetMinReal(135), Application.GetMinReal(104), false);
+ btnProgress.X = progressX;
+ btnProgress.Y = SeekBarOpenCurtain.Y + SeekBarOpenCurtain.Height / 2 - Application.GetMinReal(180);
+ btnProgress.UnSelectedImagePath = "Item/ProgressBubbles.png";
+ btnProgress.IsBold = true;
+ btnProgress.TextColor = UserCenterColor.Current.White;
+ btnProgress.TextAlignment = TextAlignment.Center;
+ frameWhiteBack.AddChidren(btnProgress);
+ btnProgress.Visible = false;
+
+ //寮�濮嬫粦鍔ㄧ殑浜嬩欢
+ SeekBarOpenCurtain.OnStartTrackingTouchEvent += (sender, e) =>
+ {
+ //杩涘害鍊煎紑濮嬪彉鏇�
+ this.isProgressing = true;
+ btnProgress.X = progressX + SeekBarOpenCurtain.NowProgressX - Application.GetMinReal(5);
+ btnProgress.Text = SeekBarOpenCurtain.Progress + "%";
+ if (btnProgress.Visible == false)
+ {
+ btnProgress.Visible = true;
+ }
+ };
+
+ //缁撴潫婊戝姩鐨勪簨浠�
+ SeekBarOpenCurtain.OnStopTrackingTouchEvent += (sender, e) =>
+ {
+ //杩涘害鍊煎紑濮嬬粨鏉�
+ this.isProgressing = false;
+ btnProgress.Visible = false;
+ };
+
+ //婊戝姩杩囩▼涓�
+ int oldProgressValue = SeekBarOpenCurtain.Progress;//涔嬪墠鐨勫��
+ int nowProgressValue = oldProgressValue;//鍙樻洿鐨勫��
+ SeekBarOpenCurtain.OnProgressChangedEvent += (sender, value) =>
+ {
+ btnProgress.X = progressX + SeekBarOpenCurtain.NowProgressX - Application.GetMinReal(5);
+ btnProgress.Text = value + "%";
+
+ if (Common.Config.Instance.Home.IsVirtually == false)
+ {
+ nowProgressValue = value;
+ }
+ else
+ {
+ //濡傛灉浣忓畢涓鸿櫄鎷熶綇瀹�,鐩存帴淇敼缂撳瓨
+ (device as Rollershade).WcdCurrentPositionLiftPercentage = value;
+ }
+ };
+
+ //寮�涓�涓嚎绋�,鐩戣鏄惁婊戝姩鐨勬粦鍔ㄦ潯,姣忕妫�娴嬩竴娆�
+ HdlThreadLogic.Current.RunThread(() =>
+ {
+ while (this.Parent != null)
+ {
+ System.Threading.Thread.Sleep(1000);
+ if (nowProgressValue == oldProgressValue)
+ {
+ //鍊间竴鏍�
+ continue;
+ }
+ oldProgressValue = nowProgressValue;
+ //鍙戦�佽繘搴﹀��
+ (device as Rollershade).WcdGoToTiltValue(oldProgressValue);
+ }
+ });
+ }
+
+ #endregion
+
+ #region 鈻� 鍙戦�佺獥甯樺懡浠______________________
+
+ /// <summary>
+ /// 鍙戦�佺獥甯樺懡浠�
+ /// </summary>
+ /// <param name="comand"></param>
+ private void SetCurtainCommand(int comand)
+ {
+ //鍦ㄦ病鏈夋帴鏀跺埌鍙嶉涔嬪墠,涓嶈兘鍐嶇偣鍑�
+ this.btnClose.CanClick = false;
+ this.btnOpen.CanClick = false;
+ this.btnStop.CanClick = false;
+
+ //妫�娴嬫槸鍚﹁幏鍙栫綉鍏冲弽棣堢殑缁撴灉,濡傛灉缃戝叧娌℃湁鍥炲,鍒欎細寮瑰嚭娑堟伅
+ this.StartCheckResponeResult(new List<ButtonBase>(), (result) =>
+ {
+ //鏃堕棿缁撴潫,鍙互鍐嶆鐐瑰嚮
+ this.btnClose.CanClick = true;
+ this.btnOpen.CanClick = true;
+ this.btnStop.CanClick = true;
+ });
+ //鍙戦�佸懡浠�
+ ((Rollershade)device).CurtainUpDownStopControl(comand);
+ }
+
+ #endregion
+
+ #region 鈻� 鏄惁鑾峰彇缃戝叧鍙嶉鐨勭粨鏋淿____________
+
+ /// <summary>
+ /// 妫�娴嬬綉鍏崇殑鍙嶉缁撴灉(灞炴�т笂鎶ョ殑瀵硅薄锛歞evice.DeviceStatusReport)
+ /// </summary>
+ /// <param name="comandDiv">鍛戒护鍖哄垎</param>
+ /// <param name="report">涓婃姤鏁版嵁</param>
+ /// <returns></returns>
+ public override bool CheckResponeResultStatu(ReceiveComandDiv comandDiv, CommonDevice report)
+ {
+ if (comandDiv == ReceiveComandDiv.A璁惧灞炴�т笂鎶�)
+ {
+ HdlThreadLogic.Current.RunMain(() =>
+ {
+ //璁剧疆鐘舵�佹枃瀛�
+ this.SetStatuText(HdlDeviceOtherLogic.Current.GetDeviceStatu(this.device));
+ if (this.isProgressing == false)
+ {
+ //褰撹繘搴﹀�煎湪鎵嬪姩鍙樻洿涓椂,涓嶆帴鏀舵帹閫�
+ if (this.WcdType == 0)
+ {
+ SeekBarSiphonateCurtain.Progress = (device as Rollershade).WcdCurrentPositionLiftPercentage;
+ }
+ else
+ {
+ SeekBarOpenCurtain.Progress = (device as Rollershade).WcdCurrentPositionLiftPercentage;
+ }
+ }
+ });
+ return true;
+ }
+ return false;
+ }
+
+ #endregion
+ }
+}
--
Gitblit v1.8.0