From 264f86c363a6a019fac8eb138877fee9e4734e2d Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期六, 21 八月 2021 17:45:44 +0800
Subject: [PATCH] Merge branch 'WJC' into wxr7
---
HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs | 12
HDL-ON_Android/Assets/Language.ini | 79 ++--
HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 28 +
HDL-ON_iOS/Resources/Phone/LogicIcon/security.png | 0
HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs | 106 +++++
HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs | 79 ++++
HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs | 28 +
HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs | 79 ++++
HDL-ON_iOS/Resources/Language.ini | 82 ++--
HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs | 35 +
HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs | 7
HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs | 5
HDL-ON_Android/Assets/Phone/LogicIcon/security.png | 0
HDL_ON/Common/R.cs | 8
HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs | 423 ++++++++----------------
15 files changed, 578 insertions(+), 393 deletions(-)
diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini
index 895b1a4..b23332d 100644
--- a/HDL-ON_Android/Assets/Language.ini
+++ b/HDL-ON_Android/Assets/Language.ini
@@ -810,43 +810,7 @@
6095=More than 30 add buttons
-7108=Leak/No Leak
-7109=Leak
-7110=No leak
-7111=Water leaking/no water leaking
-7112=Water leaking
-7113=No water leaking
-7114=Someone/Nobody
-7115=Someone
-7116=Nobody
-7117=Open/Close
-7118=On
-7119=Close
-7120=Anti-dismantling function
-7121=Online
-7122=Not online
-7123=Air quality
-7124=Excellent
-7125=Good
-7126=Poor
-7127=Send notification
-7128=Notification content
-7129=(within 100 characters)
-7130=Account selection
-7131=App push
-7132=Automation
-7133=Executed
-7134=Target State
-7135=Tumble
-7136=Temperature
-7137=Humidity
-7138=PM2.5
-7139=CO2
-7140=TVOC
-7141=Exceeding
-7142=Serious
-7143=High
-7144=excellence
+
6000=Rename
@@ -975,6 +939,46 @@
7105=Light pollution: 75 ~ 115ug/m3
7106=Moderate pollution: 115 ~ 150ug/m3
7107=Heavy pollution: > 150ug/m3
+7108=Leak/No Leak
+7109=Leak
+7110=No leak
+7111=Water leaking/no water leaking
+7112=Water leaking
+7113=No water leaking
+7114=Someone/Nobody
+7115=Someone
+7116=Nobody
+7117=Open/Close
+7118=On
+7119=Close
+7120=Anti-dismantling function
+7121=Online
+7122=Not online
+7123=Air quality
+7124=Excellent
+7125=Good
+7126=Poor
+7127=Send notification
+7128=Notification content
+7129=(within 100 characters)
+7130=Account selection
+7131=App push
+7132=Automation
+7133=Executed
+7134=Target State
+7135=Tumble
+7136=Temperature
+7137=Humidity
+7138=PM2.5
+7139=CO2
+7140=TVOC
+7141=Exceeding
+7142=Serious
+7143=High
+7144=excellence
+7145=Security
+7146=Add security
+7146=娣诲姞瀹夐槻
9000=Please sign in with new cell phone number.
9001=Please sign in with new email address.
@@ -2041,6 +2045,7 @@
7142=涓ラ噸
7143=鍋忛珮
7144=浼樼
+7145=瀹夐槻
9000=璇蜂娇鐢ㄦ柊鐨勬墜鏈鸿处鍙风櫥褰旳PP
9001=璇蜂娇鐢ㄦ柊鐨勯偖绠辫处鍙风櫥褰旳PP
diff --git a/HDL-ON_Android/Assets/Phone/LogicIcon/security.png b/HDL-ON_Android/Assets/Phone/LogicIcon/security.png
new file mode 100644
index 0000000..6514330
--- /dev/null
+++ b/HDL-ON_Android/Assets/Phone/LogicIcon/security.png
Binary files differ
diff --git a/HDL-ON_iOS/Resources/Language.ini b/HDL-ON_iOS/Resources/Language.ini
index 14e0b7c..853795f 100644
--- a/HDL-ON_iOS/Resources/Language.ini
+++ b/HDL-ON_iOS/Resources/Language.ini
@@ -824,43 +824,7 @@
6095=More than 30 add buttons
-7108=Leak/No Leak
-7109=Leak
-7110=No leak
-7111=Water leaking/no water leaking
-7112=Water leaking
-7113=No water leaking
-7114=Someone/Nobody
-7115=Someone
-7116=Nobody
-7117=Open/Close
-7118=On
-7119=Close
-7120=Anti-dismantling function
-7121=Online
-7122=Not online
-7123=Air quality
-7124=Excellent
-7125=Good
-7126=Poor
-7127=Send notification
-7128=Notification content
-7129=(within 100 characters)
-7130=Account selection
-7131=App push
-7132=Automation
-7133=Executed
-7134=Target State
-7135=Tumble
-7136=Temperature
-7137=Humidity
-7138=PM2.5
-7139=CO2
-7140=TVOC
-7141=Exceeding
-7142=Serious
-7143=High
-7144=excellence
+
6000=Rename
@@ -989,6 +953,47 @@
7105=Light pollution: 75 ~ 115ug/m3
7106=Moderate pollution: 115 ~ 150ug/m3
7107=Heavy pollution: > 150ug/m3
+7108=Leak/No Leak
+7109=Leak
+7110=No leak
+7111=Water leaking/no water leaking
+7112=Water leaking
+7113=No water leaking
+7114=Someone/Nobody
+7115=Someone
+7116=Nobody
+7117=Open/Close
+7118=On
+7119=Close
+7120=Anti-dismantling function
+7121=Online
+7122=Not online
+7123=Air quality
+7124=Excellent
+7125=Good
+7126=Poor
+7127=Send notification
+7128=Notification content
+7129=(within 100 characters)
+7130=Account selection
+7131=App push
+7132=Automation
+7133=Executed
+7134=Target State
+7135=Tumble
+7136=Temperature
+7137=Humidity
+7138=PM2.5
+7139=CO2
+7140=TVOC
+7141=Exceeding
+7142=Serious
+7143=High
+7144=excellence
+7145=Security
+7146=Add security
+
+
9000=Please sign in with new cell phone number.
9001=Please sign in with new email address.
@@ -2068,6 +2073,9 @@
7142=涓ラ噸
7143=鍋忛珮
7144=浼樼
+7145=瀹夐槻
+7146=娣诲姞瀹夐槻
+
9000=璇蜂娇鐢ㄦ柊鐨勬墜鏈鸿处鍙风櫥褰旳PP
9001=璇蜂娇鐢ㄦ柊鐨勯偖绠辫处鍙风櫥褰旳PP
diff --git a/HDL-ON_iOS/Resources/Phone/LogicIcon/security.png b/HDL-ON_iOS/Resources/Phone/LogicIcon/security.png
new file mode 100644
index 0000000..6514330
--- /dev/null
+++ b/HDL-ON_iOS/Resources/Phone/LogicIcon/security.png
Binary files differ
diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs
index 7fad7c1..3160dc2 100644
--- a/HDL_ON/Common/R.cs
+++ b/HDL_ON/Common/R.cs
@@ -2539,6 +2539,14 @@
/// 浼樼
/// </summary>
public const int youxiu = 7144;
+ /// <summary>
+ /// 瀹夐槻
+ /// </summary>
+ public const int anfang = 7145;
+ /// <summary>
+ /// 娣诲姞瀹夐槻
+ /// </summary>
+ public const int addSecurityLogic = 7046;
#region LE鏂板
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
index 3f835d8..65f2bec 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddInputType.cs
@@ -49,9 +49,16 @@
functionView.frameLayout.Y = Application.GetRealHeight(0);
}
+ //鍦烘櫙
+ LogicView.SelectTypeView sceneView = new LogicView.SelectTypeView();
+ sceneView.frameLayout.Y = functionView.frameLayout.Bottom;
+ sceneView.btnText.TextID = StringId.Scenes;
+ sceneView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png";
+ viewLayout.AddChidren(sceneView.FLayoutView());
+
//瀹ゅ鍙樺寲
LogicView.SelectTypeView shiwaiView = new LogicView.SelectTypeView();
- shiwaiView.frameLayout.Y = functionView.frameLayout.Bottom;
+ shiwaiView.frameLayout.Y = sceneView.frameLayout.Bottom;
shiwaiView.btnText.TextID = StringId.shiwaibainhua;
shiwaiView.btnIcon.UnSelectedImagePath = "LogicIcon/changesinoutdoor.png";
@@ -78,6 +85,11 @@
funTpye.Show(LogicMethod.condition_if);
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
};
+ //鍦烘櫙鐐瑰嚮浜嬩欢
+ sceneView.btnClick.MouseUpEventHandler += (sen, e) =>
+ {
+ SceneMethod();
+ };
//瀹ゅ鍙樺寲
shiwaiView.btnClick.MouseUpEventHandler += (sen, e) => {
Weather weather = new Weather();
@@ -88,5 +100,70 @@
#endregion
}
+
+ /// <summary>
+ /// 娣诲姞鍦烘櫙
+ /// </summary>
+ public void SceneMethod()
+ {
+ var sceneList = LogicMethod.CurrLogicMethod.GetSceneList();
+ List<string> nameList = new List<string>();
+ for (int i = 0; i < sceneList.Count; i++)
+ {
+ var scene = sceneList[i];
+ nameList.Add(scene.name);
+ }
+ PublicInterface publicInterface = new PublicInterface();
+ publicInterface.FrameOrVv(this, nameList, new List<string> { }, StringId.addSceneLogic, (index) =>
+ {
+ var sceneSelecetd = sceneList[index];
+ Input input = new Input();
+ input.sid = sceneSelecetd.sid;
+ input.condition_type = "10";
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ LogicMethod.CurrLogicMethod.dictionary(dic, "key", "scene");
+ LogicMethod.CurrLogicMethod.dictionary(dic, "comparator", "=");
+ LogicMethod.CurrLogicMethod.dictionary(dic, "data_type", "string");
+ LogicMethod.CurrLogicMethod.dictionary(dic, "value", "on");
+ input.condition.Add(dic);
+ AddCondition(input);
+ LogicMethod.CurrLogicMethod.RemoveAllView();
+ AddLogic addLogic = new AddLogic();
+ MainPage.BasePageView.AddChidren(addLogic);
+ addLogic.Show();
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ });
+ }
+
+ /// <summary>
+ /// 娣诲姞鏉′欢
+ /// </summary>
+ /// <param name="input"></param>
+ private void AddCondition(Input input)
+ {
+ ///璁板綍绱㈠紩鍊�
+ int index = -1;
+ for (var i = 0; i < Logic.currlogic.input.Count; i++)
+ {
+ var condition_type = Logic.currlogic.input[i].condition_type;
+ if (condition_type == "10")
+ {
+ ///鎵惧埌鏍囪绱㈠紩锛岄��鍑哄惊鐜綋
+ index = i;
+ break;
+ }
+ }
+ if (index != -1)
+ {
+ //绉婚櫎鏃ф暟鎹�
+ Logic.currlogic.input.RemoveAt(index);
+ //鏂版暟鎹彃鍏ユ棫鏁版嵁鐨勪綅缃�
+ Logic.currlogic.input.Insert(index, input);
+ }
+ else
+ {
+ Logic.currlogic.input.Add(input);
+ }
+ }
}
}
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
index cdb06f7..31845a4 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddTarget.cs
@@ -36,11 +36,18 @@
viewLayout.AddChidren(functionView.FLayoutView());
//鍦烘櫙
- LogicView.SelectTypeView sceneView = new LogicView.SelectTypeView();
+ LogicView.SelectTypeView sceneView= new LogicView.SelectTypeView();
sceneView.frameLayout.Y = functionView.frameLayout.Bottom;
sceneView.btnText.TextID = StringId.Scenes;
sceneView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png";
viewLayout.AddChidren(sceneView.FLayoutView());
+
+ //瀹夐槻
+ LogicView.SelectTypeView securityView = new LogicView.SelectTypeView();
+ securityView.frameLayout.Y = sceneView.frameLayout.Bottom;
+ securityView.btnText.TextID = StringId.anfang;
+ securityView.btnIcon.UnSelectedImagePath = "LogicIcon/security.png";
+ viewLayout.AddChidren(securityView.FLayoutView());
//寤舵椂
LogicView.SelectTypeView delayView = new LogicView.SelectTypeView();
@@ -64,6 +71,11 @@
sceneView.btnClick.MouseUpEventHandler += (sen, e) =>
{
SceneMethod();
+ };
+ //瀹夐槻鐐瑰嚮浜嬩欢
+ securityView.btnClick.MouseUpEventHandler += (sen, e) =>
+ {
+ SecurityMethod(this);
};
//寤舵椂鐐瑰嚮浜嬩欢
delayView.btnClick.MouseUpEventHandler += (sen, e) =>
@@ -92,7 +104,7 @@
nameList.Add(scene.name);
}
PublicInterface publicInterface = new PublicInterface();
- publicInterface.FrameOrVv(this, nameList, StringId.addSceneLogic, (index) =>
+ publicInterface.FrameOrVv(this, nameList,new List<string> { }, StringId.addSceneLogic, (index) =>
{
var sceneSelecetd = sceneList[index];
Output outputDevice = new Output();
@@ -108,7 +120,41 @@
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
});
}
-
+ /// <summary>
+ /// 娣诲姞瀹夐槻
+ /// </summary>
+ public void SecurityMethod(FrameLayout frameLayout, bool edit=false, int index1=-1)
+ {
+ List<string> stateList = new List<string>();
+ if (edit&& index1 != -1) {
+ Output output = Logic.currlogic.output[index1];
+ var security = LogicMethod.CurrLogicMethod.GetSecurity(output.sid);
+ stateList.Add(security.name);
+ }
+ var securityList = LogicMethod.CurrLogicMethod.GetSecurityList();
+ List<string> nameList = new List<string>();
+ for (int i = 0; i < securityList.Count; i++)
+ {
+ var security = securityList[i];
+ nameList.Add(security.name);
+ }
+ PublicInterface publicInterface = new PublicInterface();
+ publicInterface.FrameOrVv(frameLayout, nameList, stateList, StringId.addSecurityLogic,(index) =>
+ {
+ var securitySelecetd = securityList[index];
+ Output outputDevice = new Output();
+ outputDevice.target_type = "3";
+ outputDevice.sid = securitySelecetd.sid;
+ //娌″暐浣滅敤锛屼负浜嗗彂閫佹暟鎹牸寮忕粺涓�;
+ outputDevice.status = new List<Dictionary<string, string>> { new Dictionary<string, string> { { "key", "security" }, { "value", "0" } } };
+ AddOutput(outputDevice,true);
+ LogicMethod.CurrLogicMethod.RemoveAllView();
+ AddLogic addLogic = new AddLogic();
+ MainPage.BasePageView.AddChidren(addLogic);
+ addLogic.Show();
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ });
+ }
/// <summary>
/// 寤舵椂鏃堕棿鏂规硶
/// </summary>
@@ -137,7 +183,7 @@
if (edit)
{
Output output = Logic.currlogic.output[index];
- if (output.target_type == "3")
+ if (output.target_type == "4")
{
List<Dictionary<string, string>> dicList = output.status as List<Dictionary<string, string>>;
foreach (var dic in dicList)
@@ -169,7 +215,7 @@
}
Output outputTime= new Output();
outputTime.sid = LogicMethod.CurrLogicMethod.NewSid();
- outputTime.target_type = "3";
+ outputTime.target_type = "4";
Dictionary<string, string> dic = new Dictionary<string, string>();
LogicMethod.CurrLogicMethod.dictionary(dic, "key", "delay");
LogicMethod.CurrLogicMethod.dictionary(dic, "value", timepoint);
@@ -195,23 +241,34 @@
};
}
-
/// <summary>
/// 娣诲姞鐩爣
/// </summary>
/// <param name="target"></param>
- private void AddOutput(Output target)
+ /// <param name="bool_if">琛ㄧず鍚敤涓嶅悓鏉′欢</param>
+ private void AddOutput(Output target,bool bool_if=false)
{
int indexValue = -1;
for (int i = 0; i < Logic.currlogic.output.Count; i++)
{
- if (Logic.currlogic.output[i].sid == target.sid)
+ if (bool_if)
{
- indexValue = i;
- break;
+ ///瀹夐槻鍏佽涓�绉�
+ if (Logic.currlogic.output[i].target_type == target.target_type)
+ {
+ indexValue = i;
+ break;
+ }
+ }
+ else
+ {
+ if (Logic.currlogic.output[i].sid == target.sid)
+ {
+ indexValue = i;
+ break;
+ }
}
}
-
if (indexValue != -1)
{
Logic.currlogic.output.RemoveAt(indexValue);
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index 398c19a..22c90d5 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -504,6 +504,17 @@
}
}
break;
+ case "10":
+ {
+ //鐢╯id鎵惧埌鍦烘櫙锛�
+ var scene = LogicMethod.CurrLogicMethod.GetSecne(inputCondition.sid);
+ inputView.btnIcon.UnSelectedImagePath = "LogicIcon/scene.png";
+ inputView.btnNextIcon.Visible = false;
+ inputView.btnClick.Visible = false;
+ //鏄剧ず鍦烘櫙鍚嶇О
+ inputView.btnText.Text = scene.name;
+ }
+ break;
}
//鍐嶆缂栬緫鏉′欢鐘舵�佺偣鍑讳簨浠�
@@ -755,6 +766,7 @@
MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
}
break;
+
}
};
///鍒犻櫎鎺т欢
@@ -1088,6 +1100,15 @@
break;
case "3":
{
+ //鐢╯id鎵惧埌瀹夐槻锛�
+ var security = LogicMethod.CurrLogicMethod.GetSecurity(outputTarget.sid);
+ targetView.btnIcon.UnSelectedImagePath = "LogicIcon/security.png";
+ //鏄剧ず瀹夐槻鍚嶇О
+ stateStr = security.name;
+ }
+ break;
+ case "4":
+ {
targetView.btnIcon.UnSelectedImagePath = "LogicIcon/time.png";
foreach (var dic in dicList)
{
@@ -1139,7 +1160,12 @@
break;
case "3":
{
-
+ AddTarget addTarget = new AddTarget();
+ addTarget.SecurityMethod(thisView, edit, indexVulae);
+ }
+ break;
+ case "4":
+ {
FrameLayout fLayout = new FrameLayout
{
BackgroundColor = CSS.CSS_Color.viewTrans60lucence,
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs
index f076168..19c31ea 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs
@@ -93,6 +93,8 @@
/// 浜戠澶╂皵鏉′欢=6;
/// 鏌愪釜閫昏緫/鍦烘櫙鐨勮緭鍑烘潯浠�=7;
/// 鍦扮悊鍥存爮=8;
+ /// 绌烘皵璐ㄩ噺=9;
+ /// 鍦烘櫙=10;
/// </summary>
public string condition_type = "";
public List<Dictionary<string, string>> condition = new List<Dictionary<string, string>>();
@@ -119,7 +121,8 @@
/// 閫昏緫杈撳嚭鐩爣绫诲瀷
/// 璁惧=1;
/// 鍦烘櫙=2;
- /// 寤舵椂=3;
+ /// 瀹夐槻=3;
+ /// 寤舵椂=4;
/// </summary>
public string target_type = "";
public List<Dictionary<string, string>> status = new List<Dictionary<string, string>>();
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
index f55167c..8acfce2 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicMethod.cs
@@ -179,12 +179,21 @@
return Entity.FunctionList.List.GetDeviceFunctionList();
}
/// <summary>
- /// 鑾峰彇缃戝叧鍦烘櫙鍒楄〃
+ /// 鑾峰彇鍦烘櫙鍒楄〃
/// </summary>
/// <returns></returns>
public List<HDL_ON.Entity.Scene> GetSceneList()
{
return HDL_ON.Entity.FunctionList.List.scenes;
+ }
+
+ /// <summary>
+ /// 鑾峰彇瀹夐槻鍒楄〃
+ /// </summary>
+ /// <returns></returns>
+ public List<HDL_ON.Entity.SecurityAlarm> GetSecurityList()
+ {
+ return FunctionList.List.securities;
}
/// <summary>
/// 鑾峰彇鎴块棿鐨勮澶囧垪琛�
@@ -217,7 +226,7 @@
return deviceLists;
}
/// <summary>
- /// 鑾峰彇褰撲釜璁惧
+ /// 鑾峰彇璁惧锛堝姛鑳斤級瀵硅薄
/// </summary>
/// <param name="sid">璁惧鍞竴鏍囪瘑</param>
/// <returns></returns>
@@ -238,7 +247,7 @@
}
/// <summary>
- /// 鑾峰彇褰撲釜鍦烘櫙
+ /// 鑾峰彇鍦烘櫙瀵硅薄
/// </summary>
/// <param name="sid">鍦烘櫙鍞竴鏍囪瘑</param>
/// <returns></returns>
@@ -258,6 +267,26 @@
return scene;
}
/// <summary>
+ /// 鑾峰彇瀹夐槻瀵硅薄
+ /// </summary>
+ /// <param name="sid">瀹夐槻鍞竴鏍囪瘑</param>
+ /// <returns></returns>
+ public HDL_ON.Entity.SecurityAlarm GetSecurity(string sid)
+ {
+ HDL_ON.Entity.SecurityAlarm security = new Entity.SecurityAlarm() { name = "Unknown" };
+ List<HDL_ON.Entity.SecurityAlarm> SecurityLists = GetSecurityList();
+ for (int i = 0; i < SecurityLists.Count; i++)
+ {
+ var sce = SecurityLists[i];
+ if (sce.sid == sid)
+ {
+ security = sce;
+ break;
+ }
+ }
+ return security;
+ }
+ /// <summary>
/// 鑾峰彇鎴块棿鍚�(鍗虫槸=鍖哄煙鍚嶇О)
/// </summary>
/// <param name="device">璁惧</param>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
index 372f4bb..e933b09 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/MainView.cs
@@ -357,6 +357,8 @@
//1-10(琛ㄧず鏉′欢鍥炬爣)鑷繁灞�閮ㄥ畾涔変负浜嗘樉绀洪�変腑鏉′欢绫诲瀷鍥炬爣
//1-鏃堕棿鍥炬爣
//2-鍔熻兘鍥炬爣
+ //3-浜戠鍥炬爣
+ //4-鍦烘櫙鍥炬爣
for (int i = 0; i < logic.input.Count; i++)
{
if (logic.input[i] == null)
@@ -386,6 +388,12 @@
}
break;
+ case 10:
+ {
+ iconInt = 4;
+
+ }
+ break;
}
if (!iconIntValue.Contains(iconInt))
@@ -401,6 +409,7 @@
//12-20(琛ㄧず鐩爣鍥炬爣)鑷繁灞�閮ㄥ畾涔変负浜嗘樉绀洪�変腑鐩爣绫诲瀷鍥炬爣
//12-鍔熻兘鍥炬爣
//13-鍦烘櫙鍥炬爣
+ //14-瀹夐槻鍥炬爣
//14-寤舵椂鍥炬爣
for (int i = 0; i < logic.output.Count; i++)
{
@@ -423,6 +432,12 @@
case 3:
{
iconInt = 14;
+
+ }
+ break;
+ case 4:
+ {
+ iconInt = 15;
}
break;
@@ -483,6 +498,12 @@
strIcon = "LogicIcon/shiwaitianqi.png";
}
break;
+ case 4:
+ {
+
+ strIcon = "LogicIcon/selectTheScene.png";
+ }
+ break;
case 11:
{
//鍒嗗壊鏉′欢鍜岀洰鏍囩殑鍥炬爣
@@ -502,7 +523,14 @@
break;
case 14:
{
+
+ strIcon = "LogicIcon/security.png";
+ }
+ break;
+ case 15:
+ {
//strIcon = "LogicIcon/timeicon.png";
+
}
break;
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
index 27524ab..92fc099 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/PublicInterface.cs
@@ -263,7 +263,7 @@
/// <param name="list">鏄剧ず鏁版嵁婧�</param>
/// <param name="titleText">鏍囬</param>
/// <param name="action">杩斿洖鍊肩储寮曞��</param>
- public void FrameOrVv(FrameLayout frame, List<string> list, int titleText, Action<int> action)
+ public void FrameOrVv(FrameLayout frame, List<string> list, List<string> stateList, int titleText, Action<int> action)
{
int line = 0;
@@ -366,6 +366,11 @@
{
verticalRefresh.AddChidren(checkView.FLayoutView());
}
+
+ if (stateList.Contains(strName))
+ {
+ checkView.btnCheckIcon.IsSelected = true;
+ }
checkView.btnText.Text = strName;
checkView.btnClick.Tag = i;//鏍囪
//鐐瑰嚮浜嬩欢
@@ -391,8 +396,7 @@
frameLayout.RemoveFromParent();
};
- }
-
+ }
/// <summary>
/// 瓒呭嚭5涓厓绱犺鐢ㄦ粦鍔ㄦ帶浠�
/// </summary>
@@ -400,7 +404,7 @@
/// <param name="list">鏄剧ず鏁版嵁婧�</param>
/// <param name="stateList">涔嬪墠鐘舵�佹暟鎹簮</param>
/// <param name="titleText">鏍囬</param>
- /// <param name="action">杩斿洖鍊肩储寮曞��</param>
+ /// <param name="action">杩斿洖鍊煎垪琛�</param>
public void FrameOrVvList(FrameLayout frame, List<string> list, List<string> stateList, int titleText, Action<List<string>> action)
{
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
index d651ae9..097d477 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
@@ -97,6 +97,8 @@
///鍒囨崲鎾斁妯″紡鐐瑰嚮浜嬩欢;
playView.playOrderBtn.MouseUpEventHandler += (sender, e) =>
{
+ //single/single_cycle/order/list_cycle/random
+ string modeValueString = string.Empty;
string msg = Language.StringByID(StringId.switchTo);
switch (A31MusicModel.Current.A31PlayStatus.loop)
{
@@ -119,8 +121,9 @@
break;
}
new PublicAssmebly().TipMsgAutoClose(msg, false,1000);
- string url = "http://" + A31MusicModel.Current.IPAddress + "/httpapi.asp?command=setPlayerCmd:" + "loopmode:" + A31MusicModel.Current.A31PlayStatus.loop;
- SendMethod.SendCommand(url);
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ dic.Add("mode",modeValueString);
+ //SendMethod.sendMethod.SendControlCommand(,dic);
};
///娣诲姞鍠滅埍鐐瑰嚮浜嬩欢;
playView.loveBtn.MouseUpEventHandler += (sender, e) =>
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs
index 01c7106..6c88a70 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs
@@ -3,6 +3,8 @@
using Shared;
using Shared.IO;
using System.Net;
+using HDL_ON.Entity;
+
namespace HDL_ON.UI.Music
{
public class MusicMain : FrameLayout
@@ -56,19 +58,22 @@
/// <summary>
/// 鏄剧ず鍔犺浇鐣岄潰
/// </summary>
- public static Loading loading = new Loading();
+ public static Loading loading = new Loading();
/// <summary>
/// 瀹氫箟鍏ㄥ眬瀵硅薄
/// </summary>
VerticalRefreshLayout verticalRefresh;
+ /// <summary>
+ /// 涓轰簡闊充箰鍒锋柊鐘舵�佸畾涔夊叏灞�瀵硅薄
+ /// </summary>
+ MusicView musicView = new MusicView();
public void Show()
{
-
#region 鐣岄潰甯冨眬
this.BackgroundColor = MusicColor.ViewColor;
var topView = new TopView();
this.AddChidren(topView.TopFLayoutView());
- topView.topNameBtn.TextID =StringId.a31Music;
+ topView.topNameBtn.TextID = StringId.a31Music;
topView.clickBackBtn.MouseUpEventHandler += (sender, e) =>
{
RemoveFromParent();
@@ -84,200 +89,71 @@
verticalRefresh.BeginHeaderRefreshingAction += () =>
{
- SeachMusic(false);
-
+ SeachMusic();
};
this.AddChidren(loading);
+ SeachMusic();
- if (A31MusicModel.A31MusicModelList.Count == 0)
- {
- SeachMusic(true);
- }
- else
- {
- clearA31Threads();
- //verticalRefresh.RemoveAll();
- for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++)
- {
- var a31player = A31MusicModel.A31MusicModelList[i];
- ///杩欎釜鐘舵�佹槸涔嬪墠淇濆瓨鐨勶紝鍔犺浇瀹屾垚鍚庤鏍囪涓轰笉鍦ㄧ嚎锛屽悗闈㈠啀璇诲彇姝g‘鐨勭姸鎬�
- if (!a31player.IsCanShow)
- {
- continue;
- }
- if (A31MusicModel.A31MusicModelList.Count - 1 == i)
- {
- a31player.IsEnd = true;
- }
- else
- {
- a31player.IsEnd = false;
- }
- ///鍔犺浇鐣岄潰鏃堕粯璁や笉鍦ㄧ嚎
- ///杩欓噷鏍囪鏄负浜嗕笉璇诲彇涓嶅湪绾挎挱鏀惧櫒鐘舵��
- a31player.IsOnLine = false;
- MusicListView(a31player);
- }
- ///璇诲彇姝g‘鐨勪俊鎭紝鍖呮嫭IP鍜岀鍙e強鍚嶇О
- SendMethod.Seach((obj) =>
- {
- try
- {
- if (obj == null)
- {
- ///杩欓噷瑕佽鍙栦富浠庡叧绯�
- readServerOrClientMode();
- A31MusicModel.Save();
- return;
- }
- var a31MusicModel = A31MusicModel.A31MusicModelList.Find((music) => music.UniqueDeviceName == obj.UniqueDeviceName);
- if (a31MusicModel != null)
- {
- a31MusicModel.IPAddress = obj.IPAddress;
- a31MusicModel.Port = obj.Port;
- a31MusicModel.Name = obj.Name;
- a31MusicModel.IsCanShow = true;
- a31MusicModel.IsOnLine = true;
- }
- }
- catch (Exception e) { MainPage.Log(e.Message); }
- });
- }
}
/// <summary>
/// 鍒锋柊鎾斁鍣ㄥ垪琛�
/// </summary>
- /// <param name="Yes">鏄惁鏄剧ず鍒锋柊鍥炬爣</param>
- void SeachMusic(bool Yes = false)
+ void SeachMusic()
{
- for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++)
+ Application.RunOnMainThread(() =>
{
- var a31player = A31MusicModel.A31MusicModelList[i];
- a31player.IsCanShow = false;
- a31player.IsOnLine = false;
- }
- if (Yes)
- {
- //涓轰簡绗竴娆¤繘鏉og涓�涓�;
- loading.Start();
- }
- SendMethod.Seach((obj) =>
- {
- if (obj == null)
+ verticalRefresh.RemoveAll();
+ for (int i = 0; i < SendMethod.sendMethod.GetMusicList.Count; i++)
{
- readServerOrClientMode();
- A31MusicModel.Save();
- if (!Yes)
+ var playerFunction = SendMethod.sendMethod.GetMusicList[i];
+ if (!playerFunction.online)
{
- ///绛夊緟璺戝畬鍦ㄥ叧闂�
- verticalRefresh.EndHeaderRefreshing();
+ //杩囨护鎺変笉鍦ㄧ嚎鐨勯煶涔愭挱鏀惧櫒
+ continue;
}
- Application.RunOnMainThread(() =>
- {
- if (Yes)
- {
- //涓轰簡绗竴娆¤繘鏉og涓�涓�;
- loading.Hide();
- }
- verticalRefresh.RemoveAll();
- for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++)
- {
- var a31player = A31MusicModel.A31MusicModelList[i];
- //杩欎釜鐘舵�佹槸涔嬪墠淇濆瓨鐨勶紝鍔犺浇瀹屾垚鍚庤鏍囪涓轰笉鍦ㄧ嚎锛屽悗闈㈠啀璇诲彇姝g‘鐨勭姸鎬�
- if (!a31player.IsCanShow)
- {
- continue;
- }
- if (A31MusicModel.A31MusicModelList.Count - 1 == i)
- {
- a31player.IsEnd = true;
- }
- else
- {
- a31player.IsEnd = false;
- }
- MusicListView(a31player);
- }
- //A31MusicModel.ReadMusicStates();
+ MusicListView(playerFunction);
+ }
- });
- return;
- }
- var a31MusicModel = A31MusicModel.A31MusicModelList.Find((music) => { return music.UniqueDeviceName == obj.UniqueDeviceName; });
- if (a31MusicModel == null)
- {
- //涓嶆槸鎴戜滑鏀寔鐨勫搧鐗屼笉鏀寔
- if (obj.Name != null)
- {
- obj.sid = "030101123456780909020123AABB" + obj.UniqueDeviceName;
- A31MusicModel.A31MusicModelList.Add(obj);
- }
- }
- else
- {
- a31MusicModel.IPAddress = obj.IPAddress;
- a31MusicModel.Port = obj.Port;
- a31MusicModel.Name = obj.Name;
- a31MusicModel.IsCanShow = true;
- a31MusicModel.IsOnLine = true;
- }
});
}
/// <summary>
/// 鏄剧ず闊充箰鍒楄〃鐨勬柟娉�
/// </summary>
- void MusicListView(A31MusicModel a31player)
+ void MusicListView(Function player)
{
- MusicView musicView = new MusicView();
musicView.View(verticalRefresh);
- musicView.singerBtn.Text = a31player.A31PlayStatus.Artist;
- musicView.songNameBtn.Text = a31player.A31PlayStatus.Title;
- musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(a31player);
- if (a31player.IsEnd)
- {
- musicView.muiscFl.Height = Application.GetRealHeight(12 + 139 + 12);
- }
+ musicView.singerBtn.Text = player.GetAttrState("song_name");
+ musicView.songNameBtn.Text = player.GetAttrState("song_name");
+ musicView.musicNameBtn.Text = player.name;
+ //if (player.IsEnd)
+ //{
+ // musicView.muiscFl.Height = Application.GetRealHeight(12 + 139 + 12);
+ //}
musicView.collectIconBtn.MouseUpEventHandler += (sender, e) =>
{
musicView.collectIconBtn.IsSelected = !musicView.collectIconBtn.IsSelected;
- if (a31player.ServerClientType == 1)
+ if (musicView.collectIconBtn.IsSelected)
{
- if (musicView.collectIconBtn.IsSelected)
- {
- a31player.MainPlayCollection = true;
- }
- else
- {
- a31player.MainPlayCollection = false;
- }
+ player.collect = true;
}
else
{
- if (musicView.collectIconBtn.IsSelected)
- {
- a31player.collect = true;
- }
- else
- {
- a31player.collect = false;
- }
+ player.collect = false;
}
- A31MusicModel.Save();
};
EventHandler<MouseEventArgs> clickMergence = (sender, e) =>
{
- if (a31player.ServerClientType == 0)
- {
- new View.DialogView { }.PlayMergence(a31player);
- }
- else if (a31player.ServerClientType == 1)
- {
- new View.DialogView { }.DetachPlayMergence(a31player);
-
- }
+ //if (player.ServerClientType == 0)
+ //{
+ // new View.DialogView { }.PlayMergence(player);
+ //}
+ //else if (player.ServerClientType == 1)
+ //{
+ // new View.DialogView { }.DetachPlayMergence(player);
+ //}
};
musicView.mergeBjBtn.MouseUpEventHandler += clickMergence;
musicView.mergeBtn.MouseUpEventHandler += clickMergence;
@@ -285,7 +161,6 @@
EventHandler<MouseEventArgs> clickPlayView = (sender, e) =>
{
- A31MusicModel.Current = a31player;//褰撳墠鎾斁鍣�
var a31PlayMusicPage = new A31PlayMusicPage();
MainPage.BasePageView.AddChidren(a31PlayMusicPage);
a31PlayMusicPage.Show();
@@ -302,7 +177,9 @@
musicView.prevBtn.MouseDownEventHandler += (sender, e) =>
{
musicView.prevBtn.IsSelected = true;
- SendMethod.Previous(a31player);
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ dic.Add("song_step", "up");
+ SendMethod.sendMethod.SendControlCommand(player, dic);
};
musicView.prevBtn.MouseUpEventHandler += (sender, e) =>
{
@@ -311,24 +188,28 @@
///鏆傚仠/鎾斁鐐瑰嚮浜嬩欢
musicView.playBtn.MouseDownEventHandler += (sender, e) =>
{
+ string status = "off";
if (musicView.playBtn.IsSelected)
{
musicView.playBtn.IsSelected = false;
- SendMethod.Pause(a31player);
- a31player.A31PlayStatus.status = "pause";
+ status = "off";
}
else
{
musicView.playBtn.IsSelected = true;
- SendMethod.Play(a31player);
- a31player.A31PlayStatus.status = "play";
+ status = "on";
}
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ dic.Add("on_off", status);
+ SendMethod.sendMethod.SendControlCommand(player, dic);
};
///涓嬩竴鏇茬偣鍑讳簨浠�
musicView.nextBtn.MouseDownEventHandler += (sender, e) =>
{
musicView.nextBtn.IsSelected = true;
- SendMethod.Next(a31player);
+ Dictionary<string, string> dic = new Dictionary<string, string>();
+ dic.Add("song_step", "down");
+ SendMethod.sendMethod.SendControlCommand(player, dic);
};
musicView.nextBtn.MouseUpEventHandler += (sender, e) =>
{
@@ -340,47 +221,49 @@
while (true)
{
System.Threading.Thread.Sleep(1000);
- if (!a31player.IsOnLine)
+ if (!player.online)
{
continue;
}
- SendMethod.ReadStatus(a31player);
+ //SendMethod.ReadStatus(player);
+ SendMethod.sendMethod.RefreshDeviceStatus(player,new List<string> { player.deviceId });
+
Application.RunOnMainThread(() =>
{
- musicView.singerBtn.Text = a31player.A31PlayStatus.Artist;
- musicView.songNameBtn.Text = a31player.A31PlayStatus.Title;
- musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(a31player);
- if (a31player.A31PlayStatus.status == "play")
- {
- musicView.playBtn.IsSelected = true;
- }
- else
- {
- musicView.playBtn.IsSelected = false;
- }
- musicView.regionBtn.Text = a31player.GetRoomListName();
- if (a31player.ServerClientType == 1)
- {
- if (a31player.MainPlayCollection)
- {
- musicView.collectIconBtn.IsSelected = true;
- }
- else
- {
- musicView.collectIconBtn.IsSelected = false;
- }
- }
- else
- {
- if (a31player.collect)
- {
- musicView.collectIconBtn.IsSelected = true;
- }
- else
- {
- musicView.collectIconBtn.IsSelected = false;
- }
- }
+ //musicView.singerBtn.Text = player.A31PlayStatus.Artist;
+ //musicView.songNameBtn.Text = player.A31PlayStatus.Title;
+ //musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(player);
+ //if (player.A31PlayStatus.status == "play")
+ //{
+ // musicView.playBtn.IsSelected = true;
+ //}
+ //else
+ //{
+ // musicView.playBtn.IsSelected = false;
+ //}
+ //musicView.regionBtn.Text = player.GetRoomListName();
+ //if (player.ServerClientType == 1)
+ //{
+ // if (player.MainPlayCollection)
+ // {
+ // musicView.collectIconBtn.IsSelected = true;
+ // }
+ // else
+ // {
+ // musicView.collectIconBtn.IsSelected = false;
+ // }
+ //}
+ //else
+ //{
+ // if (player.collect)
+ // {
+ // musicView.collectIconBtn.IsSelected = true;
+ // }
+ // else
+ // {
+ // musicView.collectIconBtn.IsSelected = false;
+ // }
+ //}
});
}
})
@@ -388,99 +271,67 @@
musicThread.Start();
threadLists.Add(musicThread);
}
+
/// <summary>
- /// 璇诲彇涓讳粠鍏崇郴
+ ///鎸囧畾鍒锋柊鐣岄潰
/// </summary>
- void readServerOrClientMode()
+ /// <param name="strView">鍒ゆ柇瀛楃</param>
+ public void RefreshView(string strView)
{
- try
+ Application.RunOnMainThread(() =>
{
- for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++)
+ try
{
- var a31player = A31MusicModel.A31MusicModelList[i];
- if (!a31player.IsOnLine)
+
+ for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--)
{
- continue;
- }
- try
- {
- a31player.ServerClientType = 0;
- var result = SendMethod.OpenWeb("http://" + a31player.IPAddress + "/httpapi.asp?command=multiroom:getSlaveList");
- if (result == null && result == "Failed")
+ var view = MainPage.BasePageView.GetChildren(i);
+ if (strView == view.Tag.ToString())
{
- result = SendMethod.OpenWeb("http://" + a31player.IPAddress + "/httpapi.asp?command=multiroom:getSlaveList");
- }
- if (result != null && result != "Failed")
- {
- a31player.Slave = Newtonsoft.Json.JsonConvert.DeserializeObject<Slaves>(result);
- }
- }
- catch (Exception e)
- {
- var d = e.Message;
- }
- }
-
- //鍒嗘瀽涓讳粠鍏崇郴
- for (int i = 0; i < A31MusicModel.A31MusicModelList.Count; i++)
- {
- var a31player = A31MusicModel.A31MusicModelList[i];
- if (!a31player.IsOnLine)
- {
- continue;
- }
- try
- {
- if (a31player.Slave != null && "0" != a31player.Slave.slaves)
- {
- a31player.ServerClientType = 1;//涓荤殑
- string str = a31player.Name;
- for (int j = 0; j < a31player.Slave.slave_list.Count; j++)
+ if (view.GetType() == typeof(MusicMain))
{
-
- var slave = a31player.Slave.slave_list[j];
- str = str + "+" + slave.name;
- var tempA31Player = A31MusicModel.A31MusicModelList.Find((obj) => slave.uuid.Replace("uuid:", "") == obj.UniqueDeviceName);
- if (tempA31Player == null)
- {
- A31MusicModel.A31MusicModelList.Add(new A31MusicModel
- {
- sid = "030101123456780909020123AABB" + slave.uuid.Replace("uuid:", ""),
- ServerClientType = -1,//浠庣殑
- IPAddress = slave.ip,
- MainPlayIP = a31player.IPAddress,
- UniqueDeviceName = slave.uuid.Replace("uuid:", ""),
- Name = slave.name,
- IsCanShow = false,
- IsOnLine = false,//true浣滅敤涓轰簡璇诲彇浠庢挱鏀惧櫒鐨勯煶閲�
- });
- }
- //濡傛灉鎵惧埌灏辨洿鏂颁负浠庣殑
- else
- {
- tempA31Player.ServerClientType = -1;//浠庣殑
- tempA31Player.IPAddress = slave.ip;
- tempA31Player.MainPlayIP = a31player.IPAddress;
- tempA31Player.Name = slave.name;
- tempA31Player.UniqueDeviceName = slave.uuid.Replace("uuid:", "");
- tempA31Player.IsCanShow = false;
- tempA31Player.IsOnLine = false;//true浣滅敤涓轰簡璇诲彇浠庢挱鏀惧櫒鐨勯煶閲�
-
- }
+ //musicView.singerBtn.Text = player.A31PlayStatus.Artist;
+ //musicView.songNameBtn.Text = player.A31PlayStatus.Title;
+ //musicView.musicNameBtn.Text = new View.DialogView { }.NamePlayer(player);
+ //if (player.A31PlayStatus.status == "play")
+ //{
+ // musicView.playBtn.IsSelected = true;
+ //}
+ //else
+ //{
+ // musicView.playBtn.IsSelected = false;
+ //}
+ //musicView.regionBtn.Text = player.GetRoomListName();
+ //if (player.ServerClientType == 1)
+ //{
+ // if (player.MainPlayCollection)
+ // {
+ // musicView.collectIconBtn.IsSelected = true;
+ // }
+ // else
+ // {
+ // musicView.collectIconBtn.IsSelected = false;
+ // }
+ //}
+ //else
+ //{
+ // if (player.collect)
+ // {
+ // musicView.collectIconBtn.IsSelected = true;
+ // }
+ // else
+ // {
+ // musicView.collectIconBtn.IsSelected = false;
+ // }
+ //}
}
- a31player.MainPlayName = str;
}
- }
- catch (Exception e)
- {
- var ss = e.Message;
+
}
}
-
- }
- catch { }
+ catch { }
+ });
}
-
}
}
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs
index dd36144..0a3fc25 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/SendMethod.cs
@@ -4,12 +4,28 @@
using System.Net.Sockets;
using System.Security;
using System.Text;
+using HDL_ON.DAL.Server;
+using HDL_ON.Entity;
using Shared;
namespace HDL_ON.UI.Music
{
public class SendMethod
{
+ private static SendMethod m_sendMethod=null;
+ public static SendMethod sendMethod
+ {
+ get
+ {
+ if (m_sendMethod == null)
+ {
+ m_sendMethod = new SendMethod();
+ }
+ return m_sendMethod;
+ }
+
+ }
+
/// <summary>
///鎼滅储A31闊充箰鎾斁鍣�
/// </summary>
@@ -209,7 +225,7 @@
a31MusicModel.A31PlayStatus.loop = se.SearchForTextOfTag("LoopMode");
a31MusicModel.A31PlayStatus.Source = se.SearchForTextOfTag("PlayMedium");
a31MusicModel.A31PlayStatus.playSource = se.SearchForTextOfTag("TrackSource");
- a31MusicModel.A31PlayStatus.TrackURL = se.SearchForTextOfTag("TrackURI").Replace("&", "&amp;");
+ a31MusicModel.A31PlayStatus.TrackURL = se.SearchForTextOfTag("TrackURI").Replace("&", "&amp;");
}
catch (Exception ex)
@@ -463,7 +479,8 @@
/// <param name="volume">Volume.</param>
public static void ControlVolume(int volume, A31MusicModel a31player)
{
- System.Threading.Tasks.Task.Run(() => {
+ System.Threading.Tasks.Task.Run(() =>
+ {
A31MusicModel.ProgressDateTime = DateTime.Now;
try
{
@@ -526,7 +543,7 @@
musicInfo.URL = track.SearchForTextOfTag("URL").Replace("&", "&amp;");
var metadata = track.SearchForTextOfTag("Metadata").Replace("&", "&");
var item = SecurityElement.FromString(metadata).SearchForChildByTag("item");
- musicInfo.Title = item.SearchForTextOfTag("dc:title").Replace("&", "&amp;");
+ musicInfo.Title = item.SearchForTextOfTag("dc:title").Replace("&", "&amp;");
musicInfo.Artist = item.SearchForTextOfTag("upnp:artist").Replace("&", "&amp;");
musicInfo.Album = item.SearchForTextOfTag("upnp:album").Replace("&", "&amp;");
musicInfo.Duration = item.SearchForTextOfTag("res");
@@ -597,7 +614,7 @@
/// <summary>
/// 鑾峰彇褰撳墠鎾斁鐨勫垪琛�
/// </summary>
- public static string GetCurrentPlayList(A31MusicModel a31player)
+ public static string GetCurrentPlayList(A31MusicModel a31player)
{
System.Text.StringBuilder getPlayList = new System.Text.StringBuilder();
getPlayList.AppendLine("<?xml version=\"1.0\"encoding=\"utf-8\"?>");
@@ -656,7 +673,7 @@
/// <param name="musicInfo">鎾斁闊充箰</param>
/// <param name="listName">鍒楄〃鍚嶇О</param>
/// <param name="musicList">鎺ㄩ�佸垪琛�(榛樿鎺�50棣�)</param>
- public static void PushList(MusicInfo musicInfo, string listName, List<MusicInfo> musicList, A31MusicModel a31player,string musicSource)
+ public static void PushList(MusicInfo musicInfo, string listName, List<MusicInfo> musicList, A31MusicModel a31player, string musicSource)
{
//鏈�澶у彂閫佺殑鏉℃暟
@@ -739,10 +756,12 @@
sb.AppendLine("&lt;dc:title&gt;" + tempMusicInfo.Title + "&lt;/dc:title&gt;");
sb.AppendLine("&lt;dc:creator&gt;DJ Sanny J&lt;/dc:creator&gt;");
- if (musicSource== "鎴戠殑鍒楄〃") {
+ if (musicSource == "鎴戠殑鍒楄〃")
+ {
sb.AppendLine("&lt;upnp:artist&gt;" + listName + "&lt;/upnp:artist&gt;");
}
- else {
+ else
+ {
sb.AppendLine("&lt;upnp:artist&gt;" + tempMusicInfo.Artist + "&lt;/upnp:artist&gt;");
}
sb.AppendLine("&lt;upnp:album&gt;" + tempMusicInfo.Album + "&lt;/upnp:album&gt;");
@@ -778,7 +797,7 @@
Play(a31player.IPAddress, a31player.Port, playString.ToString());
}
- static void SendMusicLists(string ip, int port, string soapAction, string listInfo)
+ static void SendMusicLists(string ip, int port, string soapAction, string listInfo)
{
System.Net.WebClient webClient = new System.Net.WebClient();
webClient.Headers.Add("SOAPACTION", "\"urn:schemas-wiimu-com:service:PlayQueue:1#" + soapAction + "\"");
@@ -788,13 +807,13 @@
byte[] recevieBytes = webClient.UploadData(new Uri("http://" + ip + ":" + port + "/upnp/control/PlayQueue1"), "POST", System.Text.Encoding.UTF8.GetBytes(listInfo));
var s = System.Text.Encoding.UTF8.GetString(recevieBytes, 0, recevieBytes.Length);
}
- catch(Exception e)
+ catch (Exception e)
{
var d = e.Message;
}
}
- static void Play(string ip, int port, string info)
+ static void Play(string ip, int port, string info)
{
System.Net.WebClient webClient = new System.Net.WebClient();
webClient.Headers.Add("SOAPACTION", "\"urn:schemas-wiimu-com:service:PlayQueue:1#PlayQueueWithIndex\"");
@@ -882,5 +901,72 @@
public string creator = string.Empty;
}
+ /// <summary>
+ /// 鑾峰彇闊充箰鍒楄〃
+ /// </summary>
+ public List<Function> GetMusicList
+ {
+ get
+ {
+ return FunctionList.List.GetMusicList();
+ }
+ }
+ /// <summary>
+ /// 鍙戦�佹帶鍒跺懡浠�
+ /// </summary>
+ /// <param name="function">褰撳墠璁惧</param>
+ /// <param name="dic">鍙戦�佹帶鍒舵暟鎹�</param>
+ public void SendControlCommand(Function function, Dictionary<string, string> dic)
+ {
+ new System.Threading.Thread(() =>
+ {
+ DriverLayer.Control.Ins.SendWriteCommand(function, dic);
+ })
+ { IsBackground = true }.Start();
+ }
+
+ /// <summary>
+ /// 鍒锋柊璁惧鐘舵��
+ /// </summary>
+ /// <returns></returns>
+ public void RefreshDeviceStatus(Function music, List<string> functionIds)
+ {
+ try
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+ d.Add("deviceIds", functionIds);
+ var responsePackNew = RequestServerhomeId(d, NewAPI.Api_Post_RefreshDeviceStatus);
+ if (responsePackNew.Code != "0")
+ {
+ return;
+ }
+ //鏁版嵁杩斿簭鍒楀寲涓篎unction瀵硅薄
+ var str = Newtonsoft.Json.JsonConvert.SerializeObject(responsePackNew.Data.ToString());
+ var function = Newtonsoft.Json.JsonConvert.DeserializeObject<Function>(str);
+ if (function == null)
+ {
+ return;
+ }
+ music.name = function.name;
+ music.sid = function.sid;
+ music.spk = function.spk;
+ music.status = function.status;
+ music.roomIds = function.roomIds;
+ music.attributes = function.attributes;
+ }
+ catch { }
+ }
+
+ /// <summary>
+ ///璇锋眰鏈嶅姟鍣紙涓庝綇瀹呮湁鍏�:渚嬪锛沨omeId锛�
+ /// </summary>
+ /// <returns></returns>
+ public ResponsePackNew RequestServerhomeId(object o, string api_Url, int mTimeout = 5)
+ {
+ var requestJson = HttpUtil.GetSignRequestJson(o);
+ return HttpUtil.RequestHttpsPostFroHome(api_Url, requestJson, mTimeout);
+
+ }
}
}
--
Gitblit v1.8.0