From 80075a89316729927db0ad65ca7674f81a942a93 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期三, 26 七月 2023 09:22:41 +0800
Subject: [PATCH] Merge branch 'Dev-Branch' into wjc

---
 HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockAudioSetupPage.cs |  130 +++++++++++++++++++++++++++++++++----------
 1 files changed, 100 insertions(+), 30 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockAudioSetupPage.cs b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockAudioSetupPage.cs
index cfa8765..3710ade 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockAudioSetupPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/VideoDoorLock/VideoDoorlockAudioSetupPage.cs
@@ -12,17 +12,17 @@
         FrameLayout bodyView;
 
         Function device;
-
         /// <summary>
-        /// 闂ㄩ搩绯荤粺闊抽噺
+        /// 闂ㄩ攣绯荤粺闊抽噺
         /// </summary>
-        int doorlockSystemSound = 0;
+        DoorLockSystemSound doorLockSystemSound;
         /// <summary>
         /// 闂ㄩ搩闊抽噺
         /// </summary>
-        int doorbelVol = 0;
+        int doorbellVol = 0;
         public VideoDoorlockAudioSetupPage(Function function)
         {
+            doorLockSystemSound = new DoorLockSystemSound();
             device = function;
             bodyView = this;
         }
@@ -74,7 +74,7 @@
 
             btnDoorlockSystemVolumeText.MouseUpEventHandler = (sender, e) =>
             {
-                LoadEditDialog(StringId.DoorlockSystemVolume, 3-doorlockSystemSound, btnDoorlockSystemVolumeStateText);
+                LoadEditDialog(StringId.DoorlockSystemVolume, btnDoorlockSystemVolumeStateText,true);
             };
             #endregion
 
@@ -124,7 +124,7 @@
 
             btnDoorbellVolumeText.MouseUpEventHandler = (sender, e) =>
             {
-                LoadEditDialog(StringId.DoorbellVolume, doorbelVol, btnDoorbellVolumeStateText);
+                LoadEditDialog(StringId.DoorbellVolume, btnDoorbellVolumeStateText,false);
 
             };
             #endregion
@@ -149,25 +149,21 @@
                         Application.RunOnMainThread(() =>
                         {
                             //鏇存柊鐣岄潰
-                            var doorLockSystemSound = Newtonsoft.Json.JsonConvert.DeserializeObject<DoorLockSystemSound>(pack.Data.ToString());
+                            doorLockSystemSound = Newtonsoft.Json.JsonConvert.DeserializeObject<DoorLockSystemSound>(pack.Data.ToString());
                             if(doorLockSystemSound != null)
                             {
                                 switch (doorLockSystemSound.sound)
                                 {
                                     case 0:
-                                        doorlockSystemSound = 0;
                                         btnDoorlockSystemVolumeStateText.TextID = StringId.Mute;
                                         break;
                                     case 1:
-                                        doorlockSystemSound = 1;
                                         btnDoorlockSystemVolumeStateText.TextID = StringId.Low;
                                         break;
                                     case 2:
-                                        doorlockSystemSound = 2;
                                         btnDoorlockSystemVolumeStateText.TextID = StringId.Moderate;
                                         break;
                                     case 3:
-                                        doorlockSystemSound = 3;
                                         btnDoorlockSystemVolumeStateText.TextID = StringId.High;
                                         break;
                                 }
@@ -205,22 +201,22 @@
                             {
                                 if (doorbellTone.volume == 0)
                                 {
-                                    doorbelVol = 3;
+                                    doorbellVol = 0;
                                     btnDoorbellVolumeStateText.TextID = StringId.Mute;
                                 }
                                 else if (doorbellTone.volume > 0 && doorbellTone.volume < 35)
                                 {
-                                    doorbelVol = 2;
+                                    doorbellVol = 1;
                                     btnDoorbellVolumeStateText.TextID = StringId.Low;
                                 }
                                 else if (doorbellTone.volume > 35 && doorbellTone.volume < 70)
                                 {
-                                    doorbelVol = 1;
+                                    doorbellVol = 2;
                                     btnDoorbellVolumeStateText.TextID = StringId.Moderate;
                                 }
                                 else if (doorbellTone.volume > 70)
                                 {
-                                    doorbelVol = 0;
+                                    doorbellVol = 3;
                                     btnDoorbellVolumeStateText.TextID = StringId.High;
                                 }
                             }
@@ -271,10 +267,10 @@
         /// <summary>
         /// 鍔犺浇鍔熻兘灞炴�ф暟鎹�夋嫨寮圭獥
         /// </summary>
-        void LoadEditDialog(int titleId, int index, Button btn)
+        void LoadEditDialog(int titleId, Button btn,bool isDoorlockSystemVolume)
         {
             Button lastButton = new Button();
-            var lastData = "";
+            
             var lastText = "";
             Dialog dialog = new Dialog();
 
@@ -311,7 +307,7 @@
             {
                 Gravity = Gravity.CenterHorizontal,
                 TextAlignment = TextAlignment.Center,
-                Width = Application.GetRealWidth(100),
+                Width = Application.GetRealWidth(150),
                 TextID = titleId,
                 IsBold = true,
                 TextColor = CSS_Color.FirstLevelTitleColor,
@@ -340,7 +336,7 @@
                 TextID = StringId.Complete,
             };
             topView.AddChidren(btnConfrim);
-            int hei = 1;
+            int index = 1;
             var statusList = new List<string>
             {
                 Language.StringByID(StringId.High),
@@ -353,11 +349,11 @@
             {
                 var row = new FrameLayout()
                 {
-                    Y = Application.GetRealHeight(50 * hei),
+                    Y = Application.GetRealHeight(50 * index),
                     Height = Application.GetRealHeight(50),
                 };
                 optionBaseView.AddChidren(row);
-                if (statusList.Count > hei)
+                if (statusList.Count > index)
                 {
                     optionBaseView.AddChidren(new Button()
                     {
@@ -377,13 +373,76 @@
                     Height = Application.GetMinRealAverage(28),
                     UnSelectedImagePath = "Public/ChooseIcon.png",
                     SelectedImagePath = "Public/ChooseOnIcon.png",
-
+                    Tag = index - 1,
                 };
                 row.AddChidren(btnChoose);
-                if (index == hei - 1)
+                if (isDoorlockSystemVolume) {//璁剧疆闂ㄩ攣绯荤粺闊抽噺
+                    switch (doorLockSystemSound.sound)
+                    {
+                        case 0:
+                            if (index == 3 + 1)
+                            {
+                                lastButton = btnChoose;
+                                btnChoose.IsSelected = true;
+                            }
+                            break;
+                        case 1:
+                            if (index == 2 + 1)
+                            {
+                                lastButton = btnChoose;
+                                btnChoose.IsSelected = true;
+                            }
+                            break;
+                        case 2:
+                            if (index == 1 + 1)
+                            {
+                                lastButton = btnChoose;
+                                btnChoose.IsSelected = true;
+                            }
+                            break;
+                        case 3:
+                            if (index == 0 + 1)
+                            {
+                                lastButton = btnChoose;
+                                btnChoose.IsSelected = true;
+                            }
+                            break;
+                    }
+                }
+                else//璁剧疆闂ㄩ搩闊抽噺
                 {
-                    lastButton = btnChoose;
-                    btnChoose.IsSelected = true;
+                    switch (doorbellVol)
+                    {
+                        case 0:
+                            if (index == 3 + 1)
+                            {
+                                lastButton = btnChoose;
+                                btnChoose.IsSelected = true;
+                            }
+                            break;
+                        case 1:
+                            if (index == 2 + 1)
+                            {
+                                lastButton = btnChoose;
+                                btnChoose.IsSelected = true;
+                            }
+                            break;
+                        case 2:
+                            if (index == 1 + 1)
+                            {
+                                lastButton = btnChoose;
+                                btnChoose.IsSelected = true;
+                            }
+                            break;
+                        case 3:
+                            if (index == 0 + 1)
+                            {
+                                lastButton = btnChoose;
+                                btnChoose.IsSelected = true;
+                            }
+                            break;
+                    }
+
                 }
                 var btnPropertyTitle = new Button()
                 {
@@ -391,22 +450,24 @@
                     TextAlignment = TextAlignment.CenterLeft,
                     TextColor = CSS_Color.FirstLevelTitleColor,
                     TextSize = CSS_FontSize.TextFontSize,
-                    Tag = hei-1,
                     Text = m
                 };
                 row.AddChidren(btnPropertyTitle);
 
                 btnPropertyTitle.MouseUpEventHandler = (sender, e) => {
+                    if (btnChoose.IsSelected)
+                    {
+                        return;
+                    }
                     btnChoose.IsSelected = true;
                     if (lastButton != null)
                     {
                         lastButton.IsSelected = false;
                     }
                     lastButton = btnChoose;
-                    lastData = btnPropertyTitle.Tag.ToString();
                     lastText = btnPropertyTitle.Text;
                 };
-                hei++;
+                index++;
             }
 
 
@@ -423,13 +484,14 @@
             };
             btnConfrim.MouseUpEventHandler = (sender, e) => {
                 dialog.Close();
-                if(titleId == StringId.DoorlockSystemVolume)
+                var lastData = lastButton.Tag.ToString();
+
+                if (isDoorlockSystemVolume)
                 {
 
                     var waitPage = new Loading();
                     bodyView.AddChidren(waitPage);
                     waitPage.Start("");
-
                     new System.Threading.Thread(() => {
                         try
                         {
@@ -462,15 +524,19 @@
                                     switch (sound)
                                     {
                                         case 0:
+                                            doorLockSystemSound.sound = 0;
                                             btn.TextID = StringId.Mute;
                                             break;
                                         case 1:
+                                            doorLockSystemSound.sound = 1;
                                             btn.TextID = StringId.Low;
                                             break;
                                         case 2:
+                                            doorLockSystemSound.sound = 2;
                                             btn.TextID = StringId.Moderate;
                                             break;
                                         case 3:
+                                            doorLockSystemSound.sound = 3;
                                             btn.TextID = StringId.High;
                                             break;
                                     }
@@ -550,15 +616,19 @@
                                     switch (lastData)
                                     {
                                         case "0":
+                                            doorbellVol = 3;
                                             btn.TextID = StringId.High;
                                             break;
                                         case "1":
+                                            doorbellVol = 2;
                                             btn.TextID = StringId.Moderate;
                                             break;
                                         case "2":
+                                            doorbellVol = 1;
                                             btn.TextID = StringId.Low;
                                             break;
                                         case "3":
+                                            doorbellVol = 0;
                                             btn.TextID = StringId.Mute;
                                             break;
                                     }

--
Gitblit v1.8.0