| | |
| | | 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; |
| | | } |
| | |
| | | |
| | | btnDoorlockSystemVolumeText.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | LoadEditDialog(StringId.DoorlockSystemVolume, 3-doorlockSystemSound, btnDoorlockSystemVolumeStateText); |
| | | LoadEditDialog(StringId.DoorlockSystemVolume, btnDoorlockSystemVolumeStateText,true); |
| | | }; |
| | | #endregion |
| | | |
| | |
| | | |
| | | btnDoorbellVolumeText.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | LoadEditDialog(StringId.DoorbellVolume, doorbelVol, btnDoorbellVolumeStateText); |
| | | LoadEditDialog(StringId.DoorbellVolume, btnDoorbellVolumeStateText,false); |
| | | |
| | | }; |
| | | #endregion |
| | |
| | | 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; |
| | | } |
| | |
| | | //失败提示 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (!string.IsNullOrEmpty(pack.message)) |
| | | |
| | | if (string.IsNullOrEmpty(pack.message)) |
| | | { |
| | | pack.message = Language.StringByID(StringId.OperationFailed); |
| | | } |
| | | { |
| | | var tip = new Tip() |
| | | { |
| | |
| | | { |
| | | 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; |
| | | } |
| | | } |
| | |
| | | //失败提示 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (!string.IsNullOrEmpty(pack.message)) |
| | | if (string.IsNullOrEmpty(pack.message)) |
| | | { |
| | | pack.message = Language.StringByID(StringId.OperationFailed); |
| | | } |
| | | { |
| | | var tip = new Tip() |
| | | { |
| | |
| | | /// <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(); |
| | | |
| | |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextAlignment = TextAlignment.Center, |
| | | Width = Application.GetRealWidth(100), |
| | | Width = Application.GetRealWidth(150), |
| | | TextID = titleId, |
| | | IsBold = true, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | |
| | | TextID = StringId.Complete, |
| | | }; |
| | | topView.AddChidren(btnConfrim); |
| | | int hei = 1; |
| | | int index = 1; |
| | | var statusList = new List<string> |
| | | { |
| | | Language.StringByID(StringId.High), |
| | |
| | | { |
| | | 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() |
| | | { |
| | |
| | | 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() |
| | | { |
| | |
| | | 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++; |
| | | } |
| | | |
| | | |
| | |
| | | }; |
| | | 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 |
| | | { |
| | |
| | | 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; |
| | | } |
| | |
| | | //失败提示 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (!string.IsNullOrEmpty(pack.message)) |
| | | if (string.IsNullOrEmpty(pack.message)) |
| | | { |
| | | pack.message = Language.StringByID(StringId.OperationFailed); |
| | | } |
| | | { |
| | | var tip = new Tip() |
| | | { |
| | |
| | | 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; |
| | | } |
| | |
| | | //失败提示 |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (!string.IsNullOrEmpty(pack.message)) |
| | | if (string.IsNullOrEmpty(pack.message)) |
| | | { |
| | | pack.message = Language.StringByID(StringId.OperationFailed); |
| | | } |
| | | { |
| | | var tip = new Tip() |
| | | { |