From 5d84c3e739f8909d9e9f2a10c97684d5a7c2cca4 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 19 九月 2023 09:30:52 +0800
Subject: [PATCH] 全视通可视对讲修改
---
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs | 242 +++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 235 insertions(+), 7 deletions(-)
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
index d23adfd..0edb7a4 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -1,5 +1,6 @@
锘縰sing System;
using System.Collections.Generic;
+using System.Linq;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation
{
@@ -156,6 +157,83 @@
}
/// <summary>
+ /// 澶氶�夋嫨
+ /// </summary>
+ /// <param name="frameLayout">鐖舵帶浠�</param>
+ /// <param name="list">鏄剧ず鏁版嵁婧�</param>
+ /// <param name="titleText"></param>
+ /// <param name="stateTextList">涔嬪墠鐘舵�佹枃鏈�</param>
+ /// <param name="action">杩斿洖绱㈠紩鍊煎垪琛�</param>
+ /// <param name="textSize">鏄剧ず鏂囨湰瀛椾綋澶у皬</param>
+ public void MultiSelectShow(FrameLayout frameLayout, List<Face> list, string titleText, string stateTexts, Action<List<int>> action, int textSize = LogicView.TextSize.text14)
+ {
+ LogicView.DateView view = new LogicView.DateView();
+ view.btnTitle.Text = titleText;
+ view.FLayoutView(frameLayout, list.Count);
+ view.btnCancel.MouseUpEventHandler += (sender, e) =>
+ {
+ //绉婚櫎fLayout鐣岄潰
+ view.frameLayout.RemoveFromParent();
+ };
+ List<int> intList = new List<int>();
+ for (int i = 0; i < list.Count; i++)
+ {
+ var face= list[i];
+ LogicView.CheckView checkView = new LogicView.CheckView();
+ checkView.frameLayout.Y = Application.GetRealHeight(56 + 50 * i);
+ checkView.btnText.TextSize = textSize;
+ view.frameLayout.AddChidren(checkView.FLayoutView());
+ checkView.btnText.Text = face.userName;
+ checkView.btnClick.Tag = i;//鏍囪
+
+ if (stateTexts.Contains(face.userId))
+ {
+ //鏄剧ず涔嬪墠鐨勯�変腑鐘舵��
+ checkView.btnCheckIcon.IsSelected = true;
+ intList.Add(i);
+ }
+ //鐐瑰嚮浜嬩欢
+ checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
+ {
+
+ int clickIndex =int.Parse(checkView.btnClick.Tag.ToString());
+ checkView.btnClick.IsSelected = !checkView.btnClick.IsSelected;
+ if (checkView.btnClick.IsSelected)
+ {
+ checkView.btnCheckIcon.IsSelected = true;
+ if (!intList.Contains(clickIndex))
+ {
+ //娣诲姞閫変腑鏁版嵁
+ intList.Add(clickIndex);
+ }
+ }
+ else
+ {
+ checkView.btnCheckIcon.IsSelected = false;
+ if (intList.Contains(clickIndex))
+ {
+ //绉婚櫎閫変腑鏁版嵁
+ intList.Remove(clickIndex);
+ }
+ }
+
+ };
+
+ }
+ view.btnConfirm.MouseUpEventHandler += (sender1, e1) =>
+ {
+ if (intList.Count == 0)
+ {
+ return;
+ }
+ action(intList);
+ //绉婚櫎fLayout鐣岄潰
+ view.frameLayout.RemoveFromParent();
+ };
+
+ }
+
+ /// <summary>
/// 鏈�-澶氶�夋嫨
/// </summary>
/// <param name="frameLayout">鐖舵帶浠�</param>
@@ -261,9 +339,11 @@
/// </summary>
/// <param name="frame">鏄剧ず鍦ㄥ摢涓晫闈㈢殑鐖舵帶浠�</param>
/// <param name="list">鏄剧ず鏁版嵁婧�</param>
+ /// <param name="stateList">涔嬪墠鐘舵�佹暟鎹簮</param>
/// <param name="titleText">鏍囬</param>
/// <param name="action">杩斿洖鍊肩储寮曞��</param>
- public void FrameOrVv(FrameLayout frame, List<string> list, List<string> stateList, int titleText, Action<int> action)
+ /// <param name="isIcon">鏁版嵁婧愭病鏈夋暟鎹槸鍚︽樉绀烘彁绀哄浘鏍�(榛樿(true)鏄剧ず)</param>
+ public void FrameOrVv(FrameLayout frame, List<string> list, List<string> stateList, string titleText, Action<int> action,bool isIcon=true)
{
int line = 0;
@@ -284,7 +364,7 @@
frame.AddChidren(frameLayout);
LogicView.DateView view = new LogicView.DateView();
- view.btnTitle.TextID = titleText;
+ view.btnTitle.Text = titleText;
view.FLayoutView(frameLayout, line);
view.btnCancel.MouseUpEventHandler += (sender, e) =>
{
@@ -310,7 +390,7 @@
verticalRefresh.EndHeaderRefreshing();
};
- if (list.Count == 0)
+ if (list.Count == 0&&isIcon)
{
Button btnTipNot = new Button
{
@@ -367,12 +447,18 @@
verticalRefresh.AddChidren(checkView.FLayoutView());
}
- if (stateList.Contains(strName))
- {
- checkView.btnCheckIcon.IsSelected = true;
- }
checkView.btnText.Text = strName;
checkView.btnClick.Tag = i;//鏍囪
+
+ if (stateList.Contains(strName))
+ {
+ //checkView.btnCheckIcon.IsSelected = true;
+
+ checkBtn.IsSelected = false;
+ checkView.btnCheckIcon.IsSelected = true;
+ checkBtn = checkView.btnCheckIcon;
+ checkBtn.Tag = checkView.btnClick.Tag.ToString();
+ }
//鐐瑰嚮浜嬩欢
checkView.btnClick.MouseUpEventHandler += (sender1, e1) =>
{
@@ -747,6 +833,93 @@
}
return list;
}
+ /// <summary>
+ /// 鍔ㄦ�佽幏鍙栦紶鎰熷櫒绛夌骇鍒楄〃
+ /// </summary>
+ /// <param name="device">鍔熻兘(sid)</param>
+ /// <returns></returns>
+ public List<string> GetSensorLevelList(Entity.Function device)
+ {
+ List<string> list = new List<string>();
+ var dic = GetSensorLevelDic(device);
+ foreach (var d in dic) {
+ list.Add(d.Key);
+ }
+ return list;
+ }
+ /// <summary>
+ /// 鎸囧畾鑾峰彇绛夌骇鎷兼帴鐨勫瓧绗︿覆
+ /// </summary>
+ /// <param name="device">鍔熻兘(sid)</param>
+ /// <param name="s">鍒濆鍊�</param>
+ /// <param name="isTextBoolean">琛ㄧずtrue(杩斿洖key);false(杩斿洖values)</param>
+ /// <returns></returns>isTextBoolean
+ public string GetSensorLevelText(Entity.Function device, string s, bool isTextBoolean)
+ {
+ if (device == null || device.attrKeyConfigs == null)
+ {
+ return "";
+ }
+ var dic = GetSensorLevelDic(device);
+ if (isTextBoolean)
+ {
+ foreach (var d in dic)
+ {
+ if (d.Value==s)
+ {
+ //濡傛灉values鍊煎瓨鍦紝杩斿洖key鍊�
+ return d.Key.ToString();
+ }
+ }
+
+ }
+ else
+ {
+ foreach (var d in dic)
+ {
+ if (d.Key==s)
+ {
+ //濡傛灉key鍊煎瓨鍦紝杩斿洖values鍊�
+ return d.Value.ToString();
+ }
+ }
+ }
+ return "";
+ }
+ /// <summary>
+ /// 鍔ㄦ�佽幏鍙栦紶鎰熷櫒绛夌骇瀛楀吀
+ /// </summary>
+ /// <param name="device">鍔熻兘(sid)</param>
+ /// <returns></returns>
+ public Dictionary<string,string> GetSensorLevelDic(Entity.Function device)
+ {
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ if (device == null || device.attrKeyConfigs == null)
+ {
+ return dic;
+ }
+ string strKey = "";
+ string strKeyValues = "";
+ for (int i = 0; i < device.attrKeyConfigs.Count; i++)
+ {
+ var attrKeyConfig = device.attrKeyConfigs[i];
+ foreach (var attrKeyInfo in attrKeyConfig.configs)
+ {
+ //鍔ㄦ�佹嫾鎺ュ瓧绗︿覆
+ strKey = attrKeyInfo.desc + ":" + attrKeyInfo.start + "~" + attrKeyInfo.end + attrKeyConfig.unit;
+ strKeyValues = "(" + attrKeyInfo.start + "," + attrKeyInfo.end + "]";
+ if (!dic.ContainsKey(strKey))
+ {
+ //娌℃湁鍐嶆坊鍔�
+ dic.Add(strKey, strKeyValues);
+ }
+
+ }
+
+ }
+ return dic;
+ }
+
/// <summary>
/// 妯″紡/椋庨�熶簰鐩歌浆鎹㈠�肩殑鏂规硶
/// </summary>
@@ -1133,6 +1306,61 @@
return value;
}
+
+ /// <summary>
+ /// 鑾峰彇key鍊�
+ /// </summary>
+ /// <param name="value"></param>
+ /// <returns>涓嶅瓨鍦ㄨ繑鍥炵┖瀛楃鈥溾��</returns>
+ public string GetKey(Dictionary<string, string> dic, string value)
+ {
+ if (string.IsNullOrEmpty(value)) {
+ return string.Empty;
+ }
+ if (dic==null||dic.Count==0)
+ {
+ return string.Empty;
+ }
+ //濡傛灉鍑虹幇澶氫釜鐩稿悓Value锛岃繖閲岄粯璁よ繑鍥炴槸绗竴涓猭ey鍊�
+ var key = dic.FirstOrDefault(q => q.Value == value).Key;
+ return key == null ? string.Empty : key;
+ }
+
+ /// <summary>
+ /// 鑾峰彇value鍊�
+ /// </summary>
+ /// <param name="key">閿�</param>
+ /// <returns>涓嶅瓨鍦ㄨ繑鍥炵┖瀛楃鈥溾��</returns>
+ public string GetValue(Dictionary<string, string> dic, string key)
+ {
+ if (string.IsNullOrEmpty(key))
+ {
+ return string.Empty;
+ }
+ if (dic == null || dic.Count == 0)
+ {
+ return string.Empty;
+ }
+ string value = string.Empty;
+ dic.TryGetValue(key, out value);
+ return value == null ? string.Empty : value;
+ }
+ /// <summary>
+ /// 鑾峰彇娴蜂俊鐢佃淇″彿婧愬垪琛�( 0:LiveTV;2:PS;3:HDMI_1;4:HDMI_2;5:HDMI_3;6:HDMI_4;11:AV;)
+ /// </summary>
+ /// <returns></returns>
+ public Dictionary<string, string> GetHisenseSignalSourceDic()
+ {
+ var dic = new Dictionary<string, string>();
+ dic.Add("HDML 1", "3");
+ dic.Add("HDML 2", "4");
+ dic.Add("HDML 3", "5");
+ dic.Add("HDML 4", "6");
+ dic.Add("Live TV", "0");
+ dic.Add("PS", "2");
+ dic.Add("AV", "11");
+ return dic;
+ }
}
}
--
Gitblit v1.8.0