From d6fb0646531172f23648441c224cdcccd721b894 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期一, 14 十二月 2020 09:59:01 +0800 Subject: [PATCH] 请合并代码,完成晾衣架最终功能。 --- ZigbeeApp/Shared/Phone/SmartSound/Forms/AddSmartSound.cs | 238 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 238 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/SmartSound/Forms/AddSmartSound.cs b/ZigbeeApp/Shared/Phone/SmartSound/Forms/AddSmartSound.cs new file mode 100644 index 0000000..54020d7 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/SmartSound/Forms/AddSmartSound.cs @@ -0,0 +1,238 @@ +锘縰sing System; +using System.Collections.Generic; +using Shared.Phone.UserCenter; +using Shared.Phone.UserCenter.SmartSound.Forms; + +namespace Shared.Phone.SmartSound.Forms +{ + public class AddSmartSound : EditorCommonForm + { + + /// 鍒楄〃鎺т欢 + /// </summary> + private VerticalListControl listView = null; + + private FrameLayout contentLayout = null; + /// <summary> + /// 褰撳墠妤煎眰鐨勭储寮� + /// </summary> + public int CurrentIndex = 0; + private BottomClickButton bottomClickButton = null; + private RoomRowLayout xiaoduRowLayout = null;//灏忓害 + private RoomRowLayout sbcRowLayout = null; + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + public void ShowForm() + { + this.ScrollEnabled = false; + base.SetTitleText("娣诲姞闊崇");//璁剧疆鏍囬淇℃伅 + + contentLayout = new FrameLayout(); + this.bodyFrameLayout.AddChidren(contentLayout); + + IniAllDataView(); + } + + #region 鍔犺浇鏈湴鎵�鏈夋暟鎹紝鐢熸垚渚涚敤鎴烽�夋嫨鎴块棿鐨勭晫闈� + + private void IniAllDataView() + { + contentLayout.RemoveAll(); + + if (listView == null) + { + listView = new VerticalListControl(); + contentLayout.AddChidren(listView); + listView.Height = bodyFrameLayout.Height - Application.GetRealHeight(173); + } + + Sound sound = new Sound(); + //娣诲姞灏忓害闊崇 + sound.Checked = false; + sound.Name = "灏忓害"; + sound.type = 0; + xiaoduRowLayout = new RoomRowLayout(sound); + listView.AddChidren(xiaoduRowLayout); + xiaoduRowLayout.InitControl(); + xiaoduRowLayout.Right_icon.IsSelected = true; + xiaoduRowLayout.ButtonClickEvent += (sender, e) => + { + xiaoduRowLayout.Right_icon.IsSelected = true; + sbcRowLayout.Right_icon.IsSelected = false; + CurrentIndex = 0; + }; + + //娣诲姞鎬濆繀椹伴煶绠� + sound.Checked = false; + sound.Name = "鎬濆繀椹�"; + sound.type = 1 ; + sbcRowLayout = new RoomRowLayout(sound); + listView.AddChidren(sbcRowLayout); + sbcRowLayout.InitControl(); + sbcRowLayout.Right_icon.IsSelected = false; + sbcRowLayout.ButtonClickEvent += (sender, e) => + { + xiaoduRowLayout.Right_icon.IsSelected = false; + sbcRowLayout.Right_icon.IsSelected = true; + CurrentIndex = 1; + }; + + //璺宠浆鑷崇涓夋柟涓嬭浇鎸夐挳 + bottomClickButton = new BottomClickButton(); + this.bodyFrameLayout.AddChidren(bottomClickButton); + bottomClickButton.Text = "璺宠浆鑷崇涓夋柟APP"; + bottomClickButton.ButtonClickEvent += (sender, e) => + { + // + if (CurrentIndex == 0) + { + OpenXiaoDuAPP(); + + } + else if (CurrentIndex == 1) + { + OpenSBCAPP(); + } + }; + + //bottomClickButton.Visible = false; + } + + /// <summary> + /// 灏忓害 + /// </summary> + private void OpenXiaoDuAPP() + { + bool bol = false; + try + { +#if Android + bol = HDLUtils.OpenAppWithPackageName("com.baidu.duer.superapp"); +#else + bol=HDLUtils.OpenApp("xiaoduapp://"); +#endif + + if (!bol) + { +#if Android + HDLUtils.OpenUrl("market://details?id=com.baidu.duer.superapp"); +#else + HDLUtils.OpenUrl("https://apps.apple.com/cn/app/%E5%B0%8F%E5%BA%A6/id1437733193"); +#endif + } + } + catch (Exception e) + { + string error = e.Message; + bol = false; + } + } + + /// <summary> + /// 鎬濆繀椹� + /// </summary> + private void OpenSBCAPP() + { + bool bol = false; + try + { +#if Android + bol = HDLUtils.OpenAppWithPackageName("com.aispeech.companionapp"); +#else + bol=HDLUtils.OpenApp("AispeechMobile://"); +#endif + + if (!bol) + { +#if Android + HDLUtils.OpenUrl("market://details?id=com.aispeech.companionapp"); +#else + HDLUtils.OpenUrl("https://apps.apple.com/cn/app/id1460767442"); +#endif + } + } + catch (Exception e) + { + string error = e.Message; + bol = false; + } + } + + #endregion + + + #region 鈻� 鑷畾涔夋埧闂撮�夋嫨鎺т欢_____________________ + + /// <summary> + /// 鎴块棿鍒楄〃琛� + /// </summary> + private class RoomRowLayout : FrameRowControl + { + /// <summary> + /// 鎴块棿鍚嶇О + /// </summary> + private NormalViewControl btnName = null; + /// <summary> + /// + /// </summary> + private Sound sound=null; + public MostRightIconControl Right_icon = null; + private IconViewControl iconViewControl = null; + private NormalViewControl bottomLine = null; + + /// <summary> + /// 鎴块棿鍒楄〃琛� + /// </summary> + public RoomRowLayout(Sound _sound) + { + this.sound = _sound; + this.UseClickStatu = false; + this.BackgroundColor = UserCenterColor.Current.White; + this.Height = Application.GetRealHeight(170); + } + + /// <summary> + /// 鍒濆鍖栨帶浠� + /// </summary> + public void InitControl() + { + //鍥炬爣 + if (sound.type == 0) + { + iconViewControl = this.AddLeftIcon(81, "SmartSound/Xiaodu.png"); + } + else + { + iconViewControl = this.AddLeftIcon(81, "SmartSound/Sibici.png"); + } + + //鏄剧ず鏂囨湰 + btnName = this.AddLeftCaption(string.Empty, 2000); + btnName.Height = Application.GetRealHeight(60); + btnName.TextSize = 14; + btnName.Y = Application.GetRealHeight(57); + btnName.Text = sound.Name; + //btnName.X = iconViewControl.X + iconViewControl.Width ; + + Right_icon = this.AddMostRightEmptyIcon(58, 58); + Right_icon.Gravity = Gravity.CenterVertical; + + Right_icon.SelectedImagePath = "Item/ItemSelected.png"; + Right_icon.UnSelectedImagePath = "Item/ItemUnSelected.png"; + + bottomLine = AddBottomLine(); + bottomLine.X = btnName.X; + } + } + #endregion + + private class Sound + { + public int type = 0; + public string Name=""; + public bool Checked = false; + } + } +} -- Gitblit v1.8.0