From f37f3a667bd81f78736e381717b82f632cb1fdeb Mon Sep 17 00:00:00 2001 From: lss <316519258@qq.com> Date: 星期三, 10 六月 2020 15:52:57 +0800 Subject: [PATCH] test --- ZigbeeApp/Shared/Phone/UserCenter/SmartSound/Forms/SmartSoundContentForDeviceChange.cs | 129 ++++++++++++++++++++++++++++-------------- 1 files changed, 85 insertions(+), 44 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/SmartSound/Forms/SmartSoundContentForDeviceChange.cs b/ZigbeeApp/Shared/Phone/UserCenter/SmartSound/Forms/SmartSoundContentForDeviceChange.cs index 3dde6f1..e9168d3 100644 --- a/ZigbeeApp/Shared/Phone/UserCenter/SmartSound/Forms/SmartSoundContentForDeviceChange.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/SmartSound/Forms/SmartSoundContentForDeviceChange.cs @@ -1,11 +1,14 @@ 锘縰sing System; using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using Shared.Phone.UserCenter.SmartSound.Util; namespace Shared.Phone.UserCenter.SmartSound.Forms { public class SmartSoundContentForDeviceChange : EditorCommonForm { - + /// <summary> /// 褰撳墠閫変腑鐨勬埧闂� /// </summary> @@ -27,10 +30,9 @@ /// </summary> private FrameLayout TipLayout = null; - private List<string> TabList = new List<string>() { "鐏厜", "绐楀笜" }; + private List<string> TabList = new List<string>() { Language.StringByID(R.MyInternationalizationString.uLight), Language.StringByID(R.MyInternationalizationString.uDeviceBelongId100) }; private int CurrentSelectIndex = 0; - private int imageWith = 683; private int imageHeight = 392; @@ -63,8 +65,7 @@ switchContr.Gravity = Gravity.CenterVertical; switchContr.Width = Application.GetRealWidth(650); switchContr.Y = Application.GetRealHeight(40); - - + ContentLayout = new FrameLayout(); this.bodyFrameLayout.AddChidren(ContentLayout); ContentLayout.Height = this.bodyFrameLayout.Height - switchContr.Height - Application.GetRealHeight(40); @@ -92,7 +93,8 @@ }; //寮�濮嬪垵濮嬪寲 - switchContr.InitControl(listTitle); + switchContr.InitControl(listTitle); + } /// <summary> @@ -123,6 +125,13 @@ roomRowLayout.InitControl(); } + if (SceneListView.ChildrenCount > 5) + { + TextView textView = new TextView(); + textView.Height = Application.GetRealHeight(127 * 3); + SceneListView.AddChidren(textView); + } + if (SceneListView.ChildrenCount == 0) { tipLayout.Visible = true; @@ -142,8 +151,7 @@ { try { - //2.鍔熻兘绫诲瀷閫夋嫨锛堢伅鍏夈�侀伄闃炽�佺┖璋冿級 - //3.璁惧鍒楄〃 ListView + ContentLayout.RemoveAll(); FrameLayout tab_layout = new FrameLayout(); @@ -245,6 +253,13 @@ break; } + if (DeviceListView.ChildrenCount > 5) + { + TextView textView = new TextView(); + textView.Height = Application.GetRealHeight(127 * 3); + DeviceListView.AddChidren(textView); + } + if (DeviceListView.ChildrenCount == 0) { TipLayout.Visible = true; @@ -260,6 +275,11 @@ } } + /// <summary> + /// 淇敼鍦烘櫙鏄电О + /// </summary> + /// <param name="scene"></param> + /// <param name="sceneRowLayout"></param> private void ShowSetNicknameDialog(SmartSound.Scene scene, SceneRowLayout sceneRowLayout) { //鐢熸垚涓�涓脊绐楃敾闈� @@ -271,7 +291,7 @@ dialogForm.Text = scene.NicksName; //鎸変笅纭鎸夐挳 - dialogForm.ComfirmClickEvent += ((textValue) => + dialogForm.ComfirmClickEvent += (async (textValue) => { scene.NicksName = textValue; string remark = scene.SceneName; @@ -280,11 +300,17 @@ remark += "(" + scene.NicksName + ")"; } sceneRowLayout.btnCaption.Text = remark; + string json = await postBatchEdit(); //鐢婚潰鍏抽棴 - dialogForm.CloseDialog(); + dialogForm.CloseDialog(); }); } + /// <summary> + /// 淇敼璁惧鏄电О + /// </summary> + /// <param name="device"></param> + /// <param name="deviceRowLayout"></param> private void ShowSetNicknameDialog(SmartSound.Device device, DeviceRowLayout deviceRowLayout) { //鐢熸垚涓�涓脊绐楃敾闈� @@ -296,61 +322,65 @@ dialogForm.Text = device.NicksName; //鎸変笅纭鎸夐挳 - dialogForm.ComfirmClickEvent += ((textValue) => - { - device.NicksName = textValue; - string remark = device.DeviceName; - if (device.NicksName.Trim() != string.Empty) - { - remark += "(" + device.NicksName + ")"; - } - deviceRowLayout.btnCaption.Text = remark; - //鐢婚潰鍏抽棴 - dialogForm.CloseDialog(); - }); + dialogForm.ComfirmClickEvent += (async (textValue) => + { + device.NicksName = textValue; + string remark = device.DeviceName; + if (device.NicksName.Trim() != string.Empty) + { + remark += "(" + device.NicksName + ")"; + } + deviceRowLayout.btnCaption.Text = remark; + + string json = await postBatchEdit(); + + //鐢婚潰鍏抽棴 + dialogForm.CloseDialog(); + }); } /// <summary> - /// 瑙i櫎缁戝畾寮圭獥 + /// 鍦烘櫙鍒犻櫎 /// </summary> private void ShowSceneDelectDialog(SmartSound.Scene scene) { - this.ShowMassage(ShowMsgType.Confirm, "纭鍒犻櫎璇ユ帶鍒跺唴瀹癸紵", () => + this.ShowMassage(ShowMsgType.Confirm, "纭鍒犻櫎璇ユ帶鍒跺唴瀹癸紵", async () => { try { CurrentRoom.SceneList.Remove(scene); LoadSceneView(); - //SceneListView.RemoveAt(index); - + string json = await postBatchEdit(); } catch (Exception e) { string sss = e.Message; } - - }, "纭"); + + }, Language.StringByID(R.MyInternationalizationString.OkMsg)); } /// <summary> - /// 瑙i櫎缁戝畾寮圭獥 + /// 璁惧鍒犻櫎 /// </summary> private void ShowDeviceDelectDialog(SmartSound.Device device) { - this.ShowMassage(ShowMsgType.Confirm, "纭鍒犻櫎璇ユ帶鍒跺唴瀹癸紵", () => - { - try - { + this.ShowMassage(ShowMsgType.Confirm, "纭鍒犻櫎璇ユ帶鍒跺唴瀹癸紵", async () => + { + try + { //DeviceListView.RemoveAt(index); CurrentRoom.DeviceList.Remove(device); - RefreshFunctionListView(); - } - catch (Exception e) - { - string sss = e.Message; - } + RefreshFunctionListView(); - }, "纭"); + string json = await postBatchEdit(); + } + catch (Exception e) + { + string sss = e.Message; + } + + }, Language.StringByID(R.MyInternationalizationString.OkMsg)); } /// <summary> @@ -411,6 +441,15 @@ } } + private async Task<string> postBatchEdit() + { + // 鎻愪氦鏁版嵁鑷虫湇鍔″櫒 + string url = "https://developer.hdlcontrol.com/zigbeespeakerservice/BatchEdit"; + string json = Newtonsoft.Json.JsonConvert.SerializeObject(SmartSound.getInstantiate()); + string response_str = await MyHttpWebResponse.PostWebRequest(url, json, Encoding.UTF8); + return response_str; + } + #region 鈻� 鑷畾涔夊満鏅�夋嫨鎺т欢_____________________ /// <summary> @@ -428,7 +467,7 @@ public NormalViewControl btnCaption = null; private int Index = 0; - public SceneRowLayout(SmartSoundContentForDeviceChange _smartSoundContentForDeviceChange, SmartSound.Scene _scene,int _index) + public SceneRowLayout(SmartSoundContentForDeviceChange _smartSoundContentForDeviceChange, SmartSound.Scene _scene, int _index) { smartSoundContentForDeviceChange = _smartSoundContentForDeviceChange; scene = _scene; @@ -451,12 +490,13 @@ var nicknameIcon = frameTable.AddRightArrow();//58 nicknameIcon.TextSize = 17; - + nicknameIcon.SelectedImagePath = "SmartSound/Nickname.png"; nicknameIcon.UnSelectedImagePath = "SmartSound/Nickname.png"; nicknameIcon.AddTag("obj", scene); nicknameIcon.ButtonClickEvent += (sender, e) => { + // 娣诲姞鏄电О var btn = sender as IconViewControl; SmartSound.Scene tmpScene = (SmartSound.Scene)btn.GetTagByKey("obj"); smartSoundContentForDeviceChange.ShowSetNicknameDialog(tmpScene, this); @@ -464,11 +504,12 @@ //搴曠嚎 frameTable.AddBottomLine(); - + btnDelect = base.AddDeleteControl(); - btnDelect.Text = "鍒犻櫎"; + btnDelect.Text = Language.StringByID(R.MyInternationalizationString.Delete); btnDelect.ButtonClickEvent += (sender, e) => { + //鍒犻櫎鍦烘櫙 smartSoundContentForDeviceChange.ShowSceneDelectDialog(scene); }; } -- Gitblit v1.8.0