From 304dca51c28183a9dfc192c6b93ea1c00bdd5d97 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期三, 01 七月 2020 15:00:40 +0800 Subject: [PATCH] 添加了写入功能类型 --- ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundControlContentForm.cs | 96 +++++++++++++++++++++++++++++++++--------------- 1 files changed, 66 insertions(+), 30 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundControlContentForm.cs b/ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundControlContentForm.cs index 121602e..dd55a25 100755 --- a/ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundControlContentForm.cs +++ b/ZigbeeApp/Shared/Phone/SmartSound/Forms/SmartSoundControlContentForm.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Shared.Common; using Shared.Phone.UserCenter.SmartSound.Util; +using Shared.Phone.UserCenter.SmartSound.Widget; using ZigBee.Device; namespace Shared.Phone.UserCenter.SmartSound.Forms @@ -22,8 +23,15 @@ private VerticalListControl listView = null; private FrameLayout contentLayout = null; - public int CurrentIndex = 0; + /// <summary> + /// 褰撳墠妤煎眰鐨勭储寮� + /// </summary> + public int CurrentIndex = 0; private BottomClickButton bottomClickButton = null; + /// <summary> + /// 褰撳墠妤煎眰鐨勫悕绉� + /// </summary> + private static NormalViewControl pullLayoutText = null; public SmartSoundControlContentForm(SmartSoundInfo.SoundInfo soundInfo) { @@ -64,31 +72,57 @@ bottomClickButton.Text = "纭"; bottomClickButton.ButtonClickEvent += (sender, e) => { - HdlThreadLogic.Current.RunThread(async () => + if (SmartSound.getInstantiate().LayerList != null && SmartSound.getInstantiate().LayerList.Count > 0) { - this.ShowProgressBar(); - //淇濆瓨鏁版嵁 - if (SmartSound.getInstantiate().LayerList == null) - SmartSound.getInstantiate().LayerList = new List<SmartSound.Layer>(); + //鐢熸垚涓�涓脊绐楃敾闈� + var dialogForm = new TextDialog("纭鍒犻櫎鐜版湁鎴块棿鍒楄〃鐨勬墍鏈夋帶鍒跺唴瀹癸紝娣诲姞鍏ㄦ柊鐨勫満鏅拰鍔熻兘锛�", "纭"); + dialogForm.SetTitleText("鎻愮ず"); - SmartSound.getInstantiate().LayerList.Clear(); - SmartSound.getInstantiate().LayerList = CollateData(); - SmartSound.getInstantiate().TokenID = mSoundInfo.Id; - SmartSound.getInstantiate().UserID = mSoundInfo.UserID; - SmartSound.getInstantiate().HomeID = mSoundInfo.HomeID; - - //涓婁紶鏁版嵁鍒版湇鍔″櫒 - string str = await postBatchEdit(); - CloseProgressBar(); - - HdlThreadLogic.Current.RunMainInThread(() => + //鎸変笅纭鎸夐挳 + dialogForm.ComfirmClickEvent += () => { - CloseForm(); - }); - }); + //鐢婚潰鍏抽棴 + dialogForm.CloseDialog(); + uploadData(); + }; + } + else + { + uploadData(); + } + }; bottomClickButton.Visible = false; + } + + /// <summary> + /// 鎻愪氦鏁版嵁鍒版湇鍔″櫒 + /// </summary> + private void uploadData() + { + HdlThreadLogic.Current.RunThread(async () => + { + this.ShowProgressBar(); + //淇濆瓨鏁版嵁 + if (SmartSound.getInstantiate().LayerList == null) + SmartSound.getInstantiate().LayerList = new List<SmartSound.Layer>(); + + SmartSound.getInstantiate().LayerList.Clear(); + SmartSound.getInstantiate().LayerList = CollateData(); + SmartSound.getInstantiate().TokenID = mSoundInfo.Id; + SmartSound.getInstantiate().UserID = mSoundInfo.UserID; + SmartSound.getInstantiate().HomeID = mSoundInfo.HomeID; + + //涓婁紶鏁版嵁鍒版湇鍔″櫒 + string str = await postBatchEdit(); + CloseProgressBar(); + + HdlThreadLogic.Current.RunMainInThread(() => + { + CloseForm(); + }); + }); } private void LoadAllRoomListView() @@ -109,6 +143,7 @@ listView.Height = bodyFrameLayout.Height- Application.GetRealHeight(173); } + pullLayoutText.Text = layer.LayerName; listView.RemoveAll(); foreach(SmartSound.Room room in layer.RoomList) @@ -332,7 +367,6 @@ if (tempLayer == null) return; - #region 娣诲姞妤煎眰 bool floor_exists = false; @@ -536,21 +570,21 @@ right_icon.ButtonClickEvent += (sender, e) => { ShowPullList(); - }; - - var layout = this.AddMostRightView(Layers[smartSoundDataAdd.CurrentIndex].LayerName, 300, false); - layout.Name = "pullLayout"; - layout.ButtonClickEvent += (sender, e) => + }; + + pullLayoutText = this.AddMostRightView(Layers[smartSoundDataAdd.CurrentIndex].LayerName, 300, false); + pullLayoutText.Name = "pullLayout"; + pullLayoutText.ButtonClickEvent += (sender, e) => { ShowPullList(); }; + pullLayoutText.Text = Layers[smartSoundDataAdd.CurrentIndex].LayerName; if (Layers.Count == 1) { right_icon.Visible = false; - layout.Visible = false; - } - + pullLayoutText.Visible = false; + } } private void ShowPullList() @@ -558,14 +592,16 @@ //鎴块棿鍒楄〃琛寋鎴块棿鍒楄〃 textView锛屾ゼ灞備笅鎷夌獥} //鏄剧ず鎴块棿{甯﹂�夋嫨妗嗙殑锛涘綋閫変腑浜嗘埧闂村悗闇�瑕佸湪搴曢儴寮瑰嚭纭鎸夐挳锛岀偣鍑荤‘璁よ烦杞埌鏂扮殑鐣岄潰} var pull_frame = new TopRightMenuControl(Layers.Count, 2); + pull_frame.Y = this.Height; for (int i = 0; i < Layers.Count; i++) { + int index = i; //鍒涘缓妤煎眰 pull_frame.AddRowMenu(Layers[i].LayerName, "Item/CreatFloor.png", "Item/CreatFloorSelected.png", () => { - smartSoundDataAdd.CurrentIndex = i; + smartSoundDataAdd.CurrentIndex = index; smartSoundDataAdd.LoadAllRoomListView(); }); } -- Gitblit v1.8.0