From b676eb467a770d4037646136e91da43b9793a885 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期二, 29 三月 2022 14:02:23 +0800
Subject: [PATCH] 2022年03月29日14:01:32

---
 SiriIntents/SiriIntents.csproj                                 |    6 +-
 HDL_ON/DAL/Server/HttpUtil.cs                                  |    4 
 HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs     |   29 ++++++++-
 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs |   83 ++++++++++++++++++++++++---
 HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs                |    1 
 HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs        |    2 
 HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs |   47 +++++++++++++--
 HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs            |    1 
 8 files changed, 147 insertions(+), 26 deletions(-)

diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs
index ce16936..82b6dd0 100644
--- a/HDL_ON/DAL/Server/HttpUtil.cs
+++ b/HDL_ON/DAL/Server/HttpUtil.cs
@@ -17,8 +17,8 @@
         /// 鍥哄畾鍩熷悕,姝e紡鐜
         /// 鍏叡鍩熷悕灏辫繎瑙f瀽
         /// </summary>
-        //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
-        public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm
+        public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
+        //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm
         /// <summary>
         /// RegionMark
         /// </summary>
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
index b9c6f17..aff5ca0 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs
@@ -992,8 +992,6 @@
                                     }
                                     break;
                                 case SPK.CurtainSwitch:
-                                case SPK.CurtainTrietex:
-                                case SPK.CurtainRoller:
                                     {
                                         foreach (var dic in dicList)
                                         {
@@ -1016,6 +1014,29 @@
                                                     }
                                                     break;
                                             }
+                                        }
+                                    }
+                                    break;
+                                case SPK.CurtainTrietex:
+                                case SPK.CurtainRoller:
+                                    {
+                                        string on_off = GetKeyValue("on_off", dicList);
+                                        string percent = GetKeyValue("percent", dicList); 
+                                        if (on_off == "on" && percent != "")
+                                        {
+                                            stateStr = Language.StringByID(StringId.onLogic) + percent + "%";
+                                        }
+                                        else if (on_off == "on")
+                                        {
+                                            stateStr = Language.StringByID(StringId.onLogic);
+                                        }
+                                        else if (on_off == "off")
+                                        {
+                                            stateStr = Language.StringByID(StringId.offLogic);
+                                        }
+                                        else if (percent != "")
+                                        {
+                                            stateStr = percent + "%";
                                         }
                                     }
                                     break;
@@ -1455,8 +1476,6 @@
                     }
                     break;
                 case SPK.CurtainSwitch:
-                case SPK.CurtainTrietex:
-                case SPK.CurtainRoller:
                     {
                         foreach (var dic in dicList)
                         {
@@ -1480,6 +1499,52 @@
                                     break;
                             }
                         }
+                    }
+                    break;
+                case SPK.CurtainTrietex:
+                case SPK.CurtainRoller:
+                    {
+                        foreach (var dic in dicList)
+                        {
+                            string value = dic["value"];
+                            switch (dic["key"])
+                            {
+                                case "on_off":
+                                    {
+                                        switch (value)
+                                        {
+                                            case "on":
+                                                {
+                                                    button1.Text = Language.StringByID(StringId.onLogic);
+                                                }
+                                                break;
+                                            case "off":
+                                                {
+                                                    button1.Text = Language.StringByID(StringId.offLogic);
+                                                }
+                                                break;
+                                            case "stop":
+                                                {
+                                                    button1.Text = Language.StringByID(StringId.stop);
+                                                }
+                                                break;
+                                        }
+                                    }
+                                    break;
+                                case "percent":
+                                    {
+                                        if (button2 == null)
+                                        {
+                                            //鎬曡皟璇曡蒋浠朵贡涓婁笢瑗垮鑷存姏寮傚父
+                                            break;
+                                        }
+                                        button2.Text = value + "%";
+                                    }
+                                    break;
+                            }
+
+                        }
+                        
                     }
                     break;
                 case SPK.AcStandard:
@@ -2147,11 +2212,11 @@
             //纭畾鐐瑰嚮浜嬩欢
             timePointView.btnConfirm.MouseUpEventHandler += (sender, e3) =>
             {
-                if (timepoint == 0)
-                {
-                    //鎻愮ず
-                    return;
-                }
+                //if (timepoint == 0)
+                //{
+                //    //鎻愮ず
+                //    return;
+                //}
                 fLayout.RemoveFromParent();
                 action(timepoint);
             };
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
index 8cae2d3..7258f5f 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs
@@ -173,6 +173,7 @@
         logicIfon.Add("noticeConfig", noticeConfigJObject);
         logicIfon.Add("pushConfigs", pushConfigsArray);
         logicjArray.Add(logicIfon);
+        //string str = logicIfon.ToString();
         var jObject = new JObject { { "homeId", LogicMethod.CurrLogicMethod.HomeId }, { "logics", logicjArray } };
         responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Add, 5);
         //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
index 9866147..e5894e8 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/TargetDeviceFunList.cs
@@ -68,6 +68,7 @@
                         lightSwitchView.btnText.TextID = StringId.switchLogic;
                         fLayout.AddChidren(lightSwitchView.FLayoutView());
 
+
                         ///璁惧寤舵椂iewv
                         DelayView(fLayout, lightSwitchView.frameLayout.Bottom);
                         #endregion
@@ -101,7 +102,7 @@
                         brightnessView.frameLayout.Y = lightSwitchView.frameLayout.Bottom;
                         brightnessView.btnText.TextID = StringId.brightnesLogic;
                         fLayout.AddChidren(brightnessView.FLayoutView());
-                        brightnessView.btnState.Text = "5%";//浜у搧缁忕悊鏅撹緣瑕佹眰鏀圭殑 2021-11-06
+                        //brightnessView.btnState.Text = "5%";//浜у搧缁忕悊鏅撹緣瑕佹眰鏀圭殑 2021-11-06
                         ///璁惧寤舵椂iewv
                         DelayView(fLayout, brightnessView.frameLayout.Bottom);
                         #endregion
@@ -127,15 +128,12 @@
                     break;
                 //绐楀笜
                 case SPK.CurtainSwitch:
-                case SPK.CurtainTrietex:
-                case SPK.CurtainRoller:
                     {
                         #region 鐣岄潰
                         ///寮�鍏�
                         LogicView.FunTypeView curtainSwitchView = new LogicView.FunTypeView();
                         curtainSwitchView.btnText.TextID = StringId.switchLogic;
                         fLayout.AddChidren(curtainSwitchView.FLayoutView());
-                        ///璁惧寤舵椂iewv
                         DelayView(fLayout, curtainSwitchView.frameLayout.Bottom);
                         #endregion
                         #region 鐐瑰嚮浜嬩欢
@@ -148,6 +146,42 @@
                         {
                             //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
                             GetEditState(device, index, curtainSwitchView.btnState, null, null, null);
+                        }
+                        #endregion
+                    }
+                    break;
+                case SPK.CurtainTrietex:
+                case SPK.CurtainRoller:
+                    {
+                        #region 鐣岄潰
+                        ///寮�鍏�
+                        LogicView.FunTypeView curtainSwitchView = new LogicView.FunTypeView();
+                        curtainSwitchView.btnText.TextID = StringId.switchLogic;
+                        fLayout.AddChidren(curtainSwitchView.FLayoutView());
+                        ///鐧惧垎姣�
+                        LogicView.FunTypeView crtainPercentumView = new LogicView.FunTypeView();
+                        crtainPercentumView.frameLayout.Y = curtainSwitchView.frameLayout.Bottom;
+                        crtainPercentumView.btnText.TextID = StringId.percentum;
+                        fLayout.AddChidren(crtainPercentumView.FLayoutView());
+                        crtainPercentumView.btnState.Text = "5%";//浜у搧缁忕悊鏅撹緣瑕佹眰鏀圭殑 2021-11-06
+                        ///璁惧寤舵椂iewv
+                        DelayView(fLayout, crtainPercentumView.frameLayout.Bottom);
+                        #endregion
+                        #region 鐐瑰嚮浜嬩欢
+                        ///寮�鍏崇偣鍑讳簨浠�
+                        curtainSwitchView.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            SwitchViewMethod(device, curtainSwitchView.btnState, 3);
+                        };
+                        ///鐧惧垎姣旂偣鍑讳簨浠�
+                        crtainPercentumView.btnClick.MouseUpEventHandler += (sender, e) =>
+                        {
+                            BrightnessMethod(device, crtainPercentumView.btnState, crtainPercentumView.btnText.Text);
+                        };
+                        if (edit)
+                        {
+                            //鏄剧ず缂栬緫涔嬪墠鐨勮澶囩姸鎬�
+                            GetEditState(device, index, curtainSwitchView.btnState, crtainPercentumView.btnState, null, null);
                         }
                         #endregion
                     }
@@ -604,8 +638,9 @@
         /// <summary>
         /// 浜害/鐧惧垎姣�=鍔熻兘涓嬩竴绾х晫闈�
         /// </summary>
-        /// <param name="device"></param>
-        /// <param name="button"></param>
+        /// <param name="device">璁惧瀵硅薄</param>
+        /// <param name="button">鏄剧ず鐘舵�佸璞�</param>
+        /// <param name="titleName">鏍囬</param>
         private void BrightnessMethod(Entity.Function device, Button button, string titleName)
         {
             #region 鐣岄潰
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs
index 92009db..1e519bd 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31MusicModel.cs
@@ -117,7 +117,7 @@
         /// <summary>
         /// 璁板綍鏃堕棿
         /// </summary>
-        public static DateTime ProgressDateTime = DateTime.Now;
+        public static DateTime ProgressDateTime = DateTime.MinValue;
 
         /// <summary>
         /// 鍒ゆ柇鏄惁鏄痡son鏁版嵁
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
index 06bf5b9..d0d4d23 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/A31PlayMusicPage.cs
@@ -215,6 +215,8 @@
                 playView.volValueBtn.Text = playView.volSeekBar.Progress + "%";
                 if (startVolume != e)
                 {
+                    ///鏇存柊鏈�鏂板��
+                    A31MusicModel.ProgressDateTime = DateTime.Now;
                     startVolume = e;
                     A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.volume, startVolume);
                     Dictionary<string, string> dic = new Dictionary<string, string>();
@@ -247,7 +249,8 @@
                 if (playView.playBtn.IsSelected)
                 {
                     playView.playBtn.IsSelected = false;
-                    status = ValueProperty.off; 
+                    status = ValueProperty.off;
+                    
                 }
                 else
                 {
@@ -390,8 +393,8 @@
                             //        playView.volValueBtn.Text = A31MusicModel.Current.A31PlayStatus.vol + "%";
                             //    }
                             //}
-
-                            if (1000 < (DateTime.Now - A31MusicModel.ProgressDateTime).TotalMilliseconds)
+                            //涓轰簡闃叉闊抽噺鏉¤烦鍔�,寤堕暱鏇存柊鏃堕棿(澶氬姞1s)
+                            if (2000 < (DateTime.Now - A31MusicModel.ProgressDateTime).TotalMilliseconds || A31MusicModel.ProgressDateTime==DateTime.MinValue)
                             {
                                 //闊抽噺杩涘害鏉�;
                                 playView.volSeekBar.Progress = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.volume));
@@ -399,10 +402,23 @@
                                 playView.volValueBtn.Text = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.volume) + "%";
                             }
                             //鏇存柊鎾斁鍣ㄩ煶閲忕粰绯荤粺闊抽噺
-                            Volume.MusicVolume = playView.volSeekBar.Progress;
+                            //Volume.MusicVolume = playView.volSeekBar.Progress;
                             //褰撳墠鎾斁闊充箰鏃堕棿
                             //鎸夐亾鐞嗕笉浼氫负绌猴紝GetAttrState("playing_time")鍊煎彲鑳戒负绌猴紝寮哄埗杞崲int.Parse(锛変細鍑虹幇寮傚父锛屼笉杩囦篃鍋氫簡寮傚父澶勭悊浜�
-                            int playSecond = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playing_time))+ (int)(DateTime.Now - A31MusicModel.Current.LastDateTime).TotalSeconds;
+                            int playSecond = int.Parse(A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.playing_time));
+                            //璇嗗埆闊充箰鐘舵�佹槸鍚﹀湪鎾斁鐘舵��
+                            if (A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.on_off) == ValueProperty.on)
+                            {
+                                //闊充箰鍦ㄦ挱鏀炬椂锛屽啀璁$畻鎾斁鏃堕棿(鐜板湪鏃堕棿=鍘熸潵鏃堕棿+1绉�)
+                                playSecond +=(int)(DateTime.Now - A31MusicModel.Current.LastDateTime).TotalSeconds;
+                                ///姝屾洸璁板綍鏆傛椂鏃堕棿鍐欏叆缂撳瓨锛�
+                                A31MusicModel.Current.functionMusic.SetAttrState(KeyProperty.playing_time, playSecond);
+                            }
+                            if (playSecond<=0)
+                            {
+                                ///鎾斁鏃堕棿涓嶈兘灏忎簬0锛�
+                                playSecond = 0;
+                            }
                             if (playSecond >=totalSecond)
                             {
                                 ///鎾斁鏃堕棿涓嶈兘瓒呰繃鎬绘椂闂达紱
@@ -436,6 +452,9 @@
                                 playView.playBtn.IsSelected = false;
                                 //鍋滄鎾斁
                                 playView.startTimeBtn.Text =playTime;
+                                //playView.startTimeBtn.Text ="00:00";
+                                ///姝屾洸璁板綍鏆傚仠鏃堕棿锛�<LastDateTime 璁$畻鏃堕棿鎾斁鏃堕棿鏈夌敤鍒�>
+                                A31MusicModel.Current.LastDateTime = DateTime.Now;
                             }
                             playView.songNameTextView.Text = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_name) == null ? "Unkown" : A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_name);
                             playView.singerBtn.Text = A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_name) == null ? "Unkown" : A31MusicModel.Current.functionMusic.GetAttrState(KeyProperty.song_name);
diff --git a/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs b/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs
index f2c4b44..cef6e69 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Music/MusicMain.cs
@@ -291,6 +291,7 @@
                         musicView.musicNameBtn.Text = player.functionMusic.name;
                         if (player.functionMusic.GetAttrState(KeyProperty.on_off) == ValueProperty.on)
                         {
+
                             musicView.playBtn.IsSelected = true;
                         }
                         else
diff --git a/SiriIntents/SiriIntents.csproj b/SiriIntents/SiriIntents.csproj
index f33f658..5029570 100644
--- a/SiriIntents/SiriIntents.csproj
+++ b/SiriIntents/SiriIntents.csproj
@@ -86,15 +86,15 @@
     <Reference Include="System.Xml" />
     <Reference Include="System.Core" />
     <Reference Include="Xamarin.iOS" />
-    <Reference Include="Shared.IOS.HDLSceneSiri">
-      <HintPath>..\DLL\IOS\Shared.IOS.HDLSceneSiri.dll</HintPath>
-    </Reference>
     <Reference Include="Newtonsoft.Json">
       <HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\netstandard2.0\Newtonsoft.Json.dll</HintPath>
     </Reference>
     <Reference Include="RestSharp">
       <HintPath>..\packages\RestSharp.106.13.0\lib\netstandard2.0\RestSharp.dll</HintPath>
     </Reference>
+    <Reference Include="Shared.IOS.HDLSceneSiri">
+      <HintPath>..\DLL\IOS\Shared.IOS.HDLSceneSiri.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Resources\" />

--
Gitblit v1.8.0