From 08a8afe782cd499550f94f3da0ba5788e1e12971 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 02 三月 2021 17:45:45 +0800 Subject: [PATCH] 2021-3-2-1 --- HDL-ON_Android/Assets/Language.ini | 6 HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs | 4 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs | 155 +++++++++++ HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs | 65 ++++ HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs | 248 +++++++++++++++++ HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs | 97 ++---- HDL_ON/DAL/Server/NewAPI.cs | 4 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs | 2 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs | 36 + HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs | 70 +--- HDL_ON/Common/R.cs | 8 HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs | 35 -- .vs/HDL_APP_Project/xs/UserPrefs.xml | 38 -- HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs | 69 ++++ 14 files changed, 620 insertions(+), 217 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index a8dc786..e04f6a4 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,49 +1,17 @@ 锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS automaticSigning="False" PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.00008020-001674E61438002E" /> - <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs"> - <Files> - <File FileName="HDL-ON_Android/Assets/Language.ini" Line="1227" Column="1" /> - <File FileName="HDL_ON/Common/R.cs" Line="729" Column="47" /> - <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs" Line="114" Column="47" /> - <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs" Line="167" Column="67" /> - <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs" /> - <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" Line="101" Column="27" /> - <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" Line="545" Column="6" /> - <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs" Line="148" Column="49" /> - <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="14" Column="21" /> - <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs" Line="226" Column="1" /> - <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" Line="146" Column="1" /> - <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/Buttons.cs" Line="38" Column="62" /> - </Files> + <MonoDevelop.Ide.Workbench> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="HDL_APP_Project" expanded="True"> <Node name="HDL_ON" expanded="True"> - <Node name="Common" expanded="True" /> - <Node name="DAL" expanded="True"> - <Node name="DriverLayer" expanded="True" /> - <Node name="Mqtt" expanded="True" /> - </Node> - <Node name="Entity" expanded="True"> - <Node name="Function" expanded="True" /> - <Node name="ResponseEntity" expanded="True" /> - </Node> <Node name="UI" expanded="True"> - <Node name="UI0-Public" expanded="True" /> <Node name="UI2" expanded="True"> - <Node name="3-Intelligence" expanded="True"> - <Node name="Automation" expanded="True" /> - </Node> <Node name="4-PersonalCenter" expanded="True"> <Node name="PirDevice" expanded="True"> - <Node name="View" expanded="True" /> - <Node name="BrandList.cs" selected="True" /> + <Node name="AddControlComplete.cs" selected="True" /> </Node> - </Node> - <Node name="FuntionControlView" expanded="True"> - <Node name="AC" expanded="True" /> - <Node name="Light" expanded="True" /> </Node> </Node> </Node> @@ -68,7 +36,7 @@ <String>Shared.IOS/Shared.IOS.csproj</String> </DisabledProjects> <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" /> - <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.4b65c4650918" /> + <MonoDevelop.Ide.ItemProperties.HDL-ON__Android PreferredExecutionTarget="Android.Android_Accelerated_Oreo" /> <MonoDevelop.Ide.DebuggingService.Breakpoints> <BreakpointStore /> </MonoDevelop.Ide.DebuggingService.Breakpoints> diff --git a/HDL-ON_Android/Assets/Language.ini b/HDL-ON_Android/Assets/Language.ini index 6eff531..d1edc30 100644 --- a/HDL-ON_Android/Assets/Language.ini +++ b/HDL-ON_Android/Assets/Language.ini @@ -1229,8 +1229,10 @@ 6063=纭璁惧鏄惁鏈夊搷搴� 6064=鎺у埗澶辫触 6065=鎺у埗鎴愬姛 - - +6066=鐢垫簮寮� +6067=妯″紡鍒跺喎 +6068=椋庨�熶腑椋� +6069=娓╁害26鈩� 7000=鏂板缓鑷姩鍖� diff --git a/HDL_ON/Common/R.cs b/HDL_ON/Common/R.cs index 7fcd492..a5faaa6 100644 --- a/HDL_ON/Common/R.cs +++ b/HDL_ON/Common/R.cs @@ -733,9 +733,11 @@ public const int shifouyouxiangying = 6063; public const int kongzhishibai = 6064; public const int kongzhichenggong = 6065; - - - + public const int kaiguankai = 6066; + public const int moshizhileng = 6067; + public const int fengsuzhongfeng = 6068; + public const int wendu26 = 6069; + diff --git a/HDL_ON/DAL/Server/NewAPI.cs b/HDL_ON/DAL/Server/NewAPI.cs index 61bb77c..fbc9263 100644 --- a/HDL_ON/DAL/Server/NewAPI.cs +++ b/HDL_ON/DAL/Server/NewAPI.cs @@ -494,6 +494,10 @@ /// 閬ユ帶鍣ㄨ嚜瀛︽寜閿垹闄� /// </summary> public const string API_POST_Ir_CodeRemove = "/home-wisdom/app/device/ir/codeRemove"; + /// <summary> + /// 閬ユ帶鍣ㄥ垹闄� + /// </summary> + public const string API_POST_Ir_DeviceRemove = "/home-wisdom/program/device/delete"; #endregion diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs index 190ce80..214e0fc 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/InpOrOutLogicMethod.cs @@ -244,7 +244,7 @@ { string value = dic["value"]; - if (value == "true") + if (value == "open") { inputView.btnState.Text = Language.StringByID(StringId.kaiqi); @@ -1278,7 +1278,7 @@ foreach (var dic in dicList) { string value = dic["value"]; - if (value == "true") + if (value == "open") { button1.Text = Language.StringByID(StringId.kaiqi); } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs index 97af281..0d28f9d 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs @@ -154,7 +154,7 @@ //MainPage.BasePageView.RemoveViewByTag("Pir"); AddControlComplete addControlComplete = new AddControlComplete(); MainPage.BasePageView.AddChidren(addControlComplete); - addControlComplete.Show(control); + addControlComplete.Show(control,false); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; #endregion diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs index 5a50897..3ed637c 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs @@ -4,13 +4,14 @@ using Shared; namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice { - public class AddControlComplete:FrameLayout + public class AddControlComplete : FrameLayout { public AddControlComplete() { Tag = "Pir"; } - public void Show(Control control) { + public void Show(Control control, bool bool_library) + { #region 鐣岄潰甯冨眬 this.BackgroundColor = CSS.CSS_Color.viewMiddle; PirDevice.View.TopView topView = new View.TopView(); @@ -18,16 +19,16 @@ this.AddChidren(topView.FLayoutView()); topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; - FrameLayout fLayout = new FrameLayout + FrameLayout fLayout = new FrameLayout { - Y =Application.GetRealHeight(64), + Y = Application.GetRealHeight(64), BackgroundColor = CSS.CSS_Color.textWhiteColor, Height = Application.GetRealHeight(224), Width = Application.GetRealWidth(375), }; this.AddChidren(fLayout); // - Button iconBtn = new Button + Button iconBtn = new Button { Y = Application.GetRealHeight(28), X = Application.GetRealWidth(137), @@ -40,7 +41,7 @@ //娣诲姞鎴愬姛 Button text1Btn = new Button { - Width = Application.GetRealWidth(375-32), + Width = Application.GetRealWidth(375 - 32), Height = Application.GetRealHeight(22), Y = Application.GetRealHeight(158), X = Application.GetRealWidth(16), @@ -65,7 +66,7 @@ fLayout.AddChidren(text2Btn); //鎵�灞炲垎绫� View.PatchView fenlei = new View.PatchView(); - fenlei.frameLayout.Y = fLayout.Bottom+ Application.GetRealHeight(8); + fenlei.frameLayout.Y = fLayout.Bottom + Application.GetRealHeight(8); this.AddChidren(fenlei.FLayoutView(false)); fenlei.btnText1.TextID = StringId.suoshufenlei; fenlei.btnText2.TextID = StringId.dianqi; @@ -87,7 +88,7 @@ { Y = quyuPatchView.frameLayout.Bottom + Application.GetRealHeight(125), X = Application.GetRealWidth(16), - Width = Application.GetRealWidth(375-32), + Width = Application.GetRealWidth(375 - 32), Height = Application.GetRealHeight(20), TextID = StringId.jixutianjia, TextSize = TextSize.text14, @@ -102,16 +103,25 @@ #endregion #region 鐣岄潰鐐瑰嚮浜嬩欢 //閬ユ帶鍣ㄥ悕绉扮偣鍑讳簨浠� - namePatchView.btnClick.MouseUpEventHandler += (sender,e) => { }; + namePatchView.btnClick.MouseUpEventHandler += (sender, e) => { }; //鎵�灞炲尯鍩熺偣鍑讳簨浠� quyuPatchView.btnClick.MouseUpEventHandler += (sender, e) => { }; //缁х画娣诲姞鐐瑰嚮浜嬩欢 - addBtn.MouseUpEventHandler += (sender, e) => { - Method method = new Method(); - method.AddControl(); + addBtn.MouseUpEventHandler += (sender, e) => + { + if (bool_library) + { + this.RemoveFromParent(); + } + else + { + Method method = new Method(); + method.AddControl(this); + } }; //瀹屾垚鐐瑰嚮浜嬩欢 - saveView.btnClick.MouseUpEventHandler += (sender, e) => { + saveView.btnClick.MouseUpEventHandler += (sender, e) => + { MainPage.BasePageView.RemoveViewByTag("AddControl"); MainPage.BasePageView.RemoveViewByTag("Pir"); }; diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs index d2c643c..0f62f69 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/BrandList.cs @@ -16,8 +16,7 @@ /// /// </summary> /// <param name="list">琛ㄧず璇ュ垪琛ㄥ厓绱燗-Z瀛楁瘝绛涢�夋樉绀哄嚭鏉�</param> - /// <param name="list6">琛ㄧず璇ュ垪琛ㄥ厓绱犳樉绀哄湪list鍓嶉潰(璇ュ垪琛ㄥ厓绱犱笉鍋欰-Z瀛楁瘝绛涢��),娌℃湁鍙互涓簂ist6=null</param> - public void Show(List<Brand>brandList,List<string> list, List<string> list6) + public void Show(List<Brand>brandList,List<string> list,string spk) { var frameLayout = new FrameLayout @@ -89,12 +88,7 @@ { list = new List<string>(); } - if (list6 == null) - { - list6 = new List<string>(); - } var list1 = GetDateList(list); - list1.InsertRange(0, list6); var vv = new VerticalScrolViewLayout(); fram.AddChidren(vv); @@ -111,7 +105,7 @@ listStr.Add(s); } } - RefreshLayout(vv, brandList, listStr); + RefreshLayout(vv, brandList, listStr,spk); }; #region A-Z @@ -168,7 +162,7 @@ } #endregion - RefreshLayout(vv, brandList, list1); + RefreshLayout(vv, brandList, list1,spk); } /// <summary> @@ -176,7 +170,7 @@ /// </summary> /// <param name="vv">鐖舵帶浠�</param> /// <param name="list">鏄剧ず鍒楄〃</param> - private void RefreshLayout(VerticalScrolViewLayout vv, List<Brand> brandList, List<string> list) + private void RefreshLayout(VerticalScrolViewLayout vv, List<Brand> brandList, List<string> list,string spk) { vv.RemoveAll(); foreach (var str in list) @@ -225,7 +219,7 @@ { Matching matching = new Matching(); MainPage.BasePageView.AddChidren(matching); - matching.Show(); + matching.Show(libraryList, spk); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }); @@ -256,7 +250,7 @@ var library = Newtonsoft.Json.JsonConvert.DeserializeObject<Library>(str); if (library != null) { - if (null == libraryList.Find((c) => c.brandId == library.brandId)) + if (libraryList.Count<20) { libraryList.Add(library); } @@ -470,21 +464,6 @@ } } - public class Library - { - /// <summary> - /// 绾㈠鐮� - /// </summary> - public string irCode = string.Empty; - /// <summary> - /// 鍝佺墝涓婚敭Id - /// </summary> - public string brandId = string.Empty; - /// <summary> - /// 绾㈠鐮佺储寮曞簭鍙� - /// </summary> - public string irIndex = string.Empty; - - } + } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs index a50b719..b6bdd3b 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs @@ -1,4 +1,6 @@ 锘縰sing System; +using System.Collections.Generic; +using HDL_ON.Entity; using HDL_ON.UI.UI2.Intelligence.Automation.LogicView; using Shared; namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice @@ -7,8 +9,9 @@ { public Matching() { + Tag = "PirView"; } - public void Show() + public void Show(List<Library> libraryList,string spk) { #region 鐣岄潰甯冨眬 this.BackgroundColor = CSS.CSS_Color.viewMiddle; @@ -79,7 +82,7 @@ X = Application.GetRealWidth(136), Width = Application.GetRealWidth(104), Height = Application.GetRealHeight(44), - Text = "鐢垫簮", + TextID=StringId.dianyuan, TextSize = TextSize.text16, TextColor = CSS.CSS_Color.textColor, TextAlignment = TextAlignment.Center, @@ -96,7 +99,7 @@ X = Application.GetRealWidth(170), Width = Application.GetRealWidth(36), Height = Application.GetRealHeight(17), - Text = "(" + "1" + "/20)", + Text = "(1/20)", TextSize = TextSize.text12, TextColor = CSS.CSS_Color.textCancelColor, }; @@ -137,15 +140,252 @@ fLayout.AddChidren(succeedBtn); #endregion #region 鐐瑰嚮浜嬩欢 - int value = 1; + //琛ㄧず搴撳垪琛ㄧ储寮曞�� + int index= 1; + //琛ㄧず娴嬭瘯鐮佺储寮曞�� + int code = 1; + //宸� leftIconBtn.MouseUpEventHandler += (sender, e) => { + if (index>1) { + index--; + sumBtn.Text = "(" + index.ToString() + "/20)"; + } + code = 1; + GetBtnText(testBtn, code, spk); }; + //鍙� rightIconBtn.MouseUpEventHandler += (sender, e) => { + if (index < 20) + { + index++; + sumBtn.Text = "(" + index.ToString() + "/20)"; + } + code = 1; + GetBtnText(testBtn, code, spk); + }; + //娴嬭瘯Text + testBtn.MouseUpEventHandler += (sender, e) => + { + var library = libraryList[index]; + var control = GetControl(spk, testBtn.TextID, library); + CodeTest(control); + }; + //鎺у埗澶辫触 + failedBtn.MouseUpEventHandler += (sender, e) => + { + if (index < 20) + { + index++; + sumBtn.Text = "(" + index.ToString() + "/20)"; + } + code = 1; + GetBtnText(testBtn, code, spk); + }; + //鎺у埗鎴愬姛 + succeedBtn.MouseUpEventHandler += (sender, e) => + { + if (code < 3) + { + code++; + } + GetBtnText(testBtn, code, spk); + if (code == 3) + { + var library = libraryList[index]; + var control = GetControl(spk, testBtn.TextID, library); + Method method = new Method(); + method.ThreadAddControl(control, this, true); + } }; #endregion } + + /// <summary> + /// 鑾峰彇Control瀵硅薄锛堝瓨鍌ㄥ彂閫佹暟鎹殑瀵硅薄锛� + /// </summary> + /// <param name="spk"></param> + /// <param name="textInt"></param> + /// <param name="library"></param> + /// <returns></returns> + private Control GetControl(string spk, int textInt, Library library) { + + string key = ""; + string value = ""; + switch (spk) + { + case SPK.AcStandard: + { + switch (textInt) + { + case StringId.dianshi: + { + key = "on_off"; + value = "on"; + } + break; + case StringId.moshizhileng: + { + key = "mode"; + value = "cool"; + } + break; + case StringId.fengsuzhongfeng: + { + key = "fan"; + value = "medium"; + } + break; + } + } + break; + case SPK.ElectricTV: + { + switch (textInt) + { + case StringId.dianshi: + { + key = "on_off"; + value = "on"; + } + break; + case StringId.yinliangjia: + { + key = "on_off"; + value = "on"; + } + break; + case StringId.jingyin: + { + key = "mute"; + value = "0"; + } + break; + } + } + break; + } + ButtonObj buttonObj = new ButtonObj(); + buttonObj.Key = key; + buttonObj.value = value; + + Control control = new Control(); + control.spk = spk; + control.name = spk; + control.group_id = library.irIndex; + control.type = "library"; + control.status.Add(buttonObj); + string[] strings = library.irCode.Split(','); + for (int array = 0; array < strings.Length; array++) + { + //var intValue = Convert.ToInt32(strings[array],16); + control.library.Add(strings[array]); + } + + return control; + } + + /// <summary> + /// 鍙戦�佸簱鐮佹祴璇曞懡浠� + /// </summary> + /// <param name="control"></param> + private void CodeTest(Control control) + { + + //鍔犺浇log + Loading loading = new Loading(); + this.AddChidren(loading); + HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; + loading.Start(); + new System.Threading.Thread(() => + { + try + { + //鍙戦�佹寜閿垹闄わ紱 + responsePackNew = PirSend.CodeTest(control); + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + loading.Hide(); + if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") + { + + } + else + { + Method method = new Method(); + method.ErrorShow(responsePackNew); + } + + }); + } + + }) + { IsBackground = true }.Start(); + } + + /// <summary> + /// 鏄剧ず娴嬭瘯鏂囨湰 + /// </summary> + /// <param name="testBtn">鏄剧ず鎺т欢</param> + /// <param name="code">娴嬭瘯鐮佹枃鏈储寮曞��</param> + /// <param name="spk">浜戦泙涓婂畾涔塻pk</param> + private void GetBtnText(Button testBtn,int code,string spk) { + + int textValue = 0; + switch (spk) + { + case SPK.AcStandard: + { + switch (code) + { + case 1: + { + textValue = StringId.dianyuan; + } + break; + case 2: + { + textValue = StringId.moshizhileng; + } + break; + case 3: + { + textValue = StringId.fengsuzhongfeng; + } + break; + } + } + break; + case SPK.ElectricTV: + { + switch (code) + { + case 1: + { + textValue = StringId.dianyuan; + } + break; + case 2: + { + textValue = StringId.yinliangjia; + } + break; + case 3: + { + textValue = StringId.jingyin; + } + break; + } + } + break; + } + testBtn.TextID = textValue; + } } } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs index ce82452..f462d97 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs @@ -11,20 +11,20 @@ /// <summary> /// 娣诲姞閬ユ帶鍣ㄧ殑鏂规硶 /// </summary> - public void AddControl() + public void AddControl(FrameLayout frameLayout) { View.TipView tipView = new View.TipView(); - tipView.InputBox("", (s, dialog) => + tipView.InputBox(frameLayout,"", (name, frame) => { ///娓呴櫎涔嬪墠鍒楄〃鏁版嵁 Pir.BuottonList.Clear(); - if (!string.IsNullOrEmpty(s)) + if (!string.IsNullOrEmpty(name)) { Control control = new Control(); - control.name = s; + control.name = name; control.type = "learn"; - ThreadAddControl(control, dialog); + ThreadAddControl(control, frame,false); @@ -36,18 +36,18 @@ /// 鍙戦�侀仴鎺у櫒鍛戒护鏂规硶 /// </summary> /// <param name="control"></param> - /// <param name="dialog"></param> - public void ThreadAddControl(Control control, Dialog dialog) { + /// <param name="frame"></param> + public void ThreadAddControl(Control control, FrameLayout frame,bool bool_library) { DAL.Server.ResponsePackNew responsePackNew = null; Loading loading = new Loading(); - dialog.AddChidren(loading); + frame.AddChidren(loading); loading.Start(); new System.Threading.Thread(() => { try { - responsePackNew = PirSend.Add(control); + responsePackNew = PirSend.Add(control, bool_library); } catch { } finally @@ -59,11 +59,23 @@ //{ if (!string.IsNullOrEmpty(Sid("sid"))) { } ///杩欓噷锛氱洃鍚琈TTP鎺ㄩ�佷笅鏉ヤ富棰橈紝鎵嶇煡閬撴槸鍚︽坊鍔犳垚鍔� - dialog.Close();//娣诲姞鎴愬姛鍏抽棴寮圭獥 - AddButton addButton = new AddButton(); - MainPage.BasePageView.AddChidren(addButton); - addButton.Show(control); - MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + frame.RemoveFromParent();//娣诲姞鎴愬姛鍏抽棴寮圭獥 + if (bool_library) { + MainPage.BasePageView.RemoveViewByTag("PirView"); + AddControlComplete addControlComplete = new AddControlComplete(); + MainPage.BasePageView.AddChidren(addControlComplete); + addControlComplete.Show(control, bool_library); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + else + { + + + AddButton addButton = new AddButton(); + MainPage.BasePageView.AddChidren(addButton); + addButton.Show(control); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } //鐩戝惉Mqtt鎺ㄩ�佷笅鏉ョ姸鎬佺爜鍋氭彁绀� //View.FailView failView = new View.FailView(); @@ -82,32 +94,7 @@ { IsBackground = true }.Start(); } - - public List<DD> GetLsit(FrameLayout frameLayout, Action<ResponsePackNew> action, string id, string if_str) - { - List<DD> list = new List<DD>(); - ResponsePackNew responsePackNew = null; - PirSend.GetDeviceTypesList(frameLayout, action, id, if_str); - - if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") - { - var jArray = JArray.Parse(responsePackNew.Data.ToString()); - for (int a = 0; a < jArray.Count; a++) - { - var jay = jArray[a]; - var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); - list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<DD>>(str); - - - } - } - else - { - Method method = new Method(); - method.ErrorShow(responsePackNew); - } - return list; - } + /// <summary> /// MQTT涓婚鎺ㄩ�佷笅鏉ョ殑鏁版嵁(閬ユ帶鍣ㄦ坊鍔�) /// </summary> @@ -148,33 +135,7 @@ } } - [Serializable] - public class DD - { - /// <summary> - /// 璁惧绫诲瀷涓婚敭Id - /// </summary> - public string id=string.Empty; - /// <summary> - /// 璁惧绫诲瀷(鎶曞奖浠�,椋庢墖,鏈洪《鐩�...) - /// </summary> - public string deviceType = string.Empty; - /// <summary> - ///鍝佺墝鍚嶇О - /// </summary> - public string brandName = string.Empty; - /// <summary> - /// 绾㈠鐮� - /// </summary> - public string irCode = string.Empty; - /// <summary> - /// 鍝佺墝涓婚敭Id - /// </summary> - public string brandId = string.Empty; - /// <summary> - /// 绾㈠鐮佺储寮曞簭鍙� - /// </summary> - public string irIndex = string.Empty; - } + } + } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs index 23d3c91..078249c 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Pir.cs @@ -10,14 +10,6 @@ public static List<ButtonObj> BuottonList = new List<ButtonObj>(); } - public class ButtonObj - { - public string Key = string.Empty; - /// <summary> - /// #app 鏄剧ず鐨勬枃瀛� - /// </summary> - public string value = string.Empty; - } public class Control { /// <summary> @@ -44,5 +36,62 @@ /// 绾㈠鐮� /// </summary> public List<string> library = new List<string>(); + /// <summary> + /// 绾㈠鐮� + /// </summary> + public List<ButtonObj> status = new List<ButtonObj>(); } + public class ButtonObj + { + public string Key = string.Empty; + /// <summary> + /// #app 鏄剧ず鐨勬枃瀛� + /// </summary> + public string value = string.Empty; + } + public class DeviceType + { + /// <summary> + /// 璁惧绫诲瀷涓婚敭Id + /// </summary> + public string id = string.Empty; + /// <summary> + /// 璁惧绫诲瀷(鎶曞奖浠�,椋庢墖,鏈洪《鐩�...) + /// </summary> + public string deviceType = string.Empty; + } + public class Brand + { + /// <summary> + /// 鍝佺墝涓婚敭Id + /// </summary> + public string id = string.Empty; + /// <summary> + /// 璁惧绫诲瀷涓婚敭Id + /// </summary> + public string deviceTypeId = string.Empty; + /// <summary> + /// 鍝佺墝鍚嶇О + /// </summary> + public string brandName = string.Empty; + + } + + public class Library + { + /// <summary> + /// 绾㈠鐮� + /// </summary> + public string irCode = string.Empty; + /// <summary> + /// 鍝佺墝涓婚敭Id + /// </summary> + public string brandId = string.Empty; + /// <summary> + /// 绾㈠鐮佺储寮曞簭鍙� + /// </summary> + public string irIndex = string.Empty; + + } + } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs index 501c526..8f427de 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs @@ -1,5 +1,6 @@ 锘縰sing System; using System.Collections.Generic; +using HDL_ON.Entity; using HDL_ON.UI.UI2.Intelligence.Automation.LogicView; using Shared; namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice @@ -8,7 +9,7 @@ { public PirMain() { - Tag = "PirView"; + Tag = "PirMain"; } /// <summary> /// 涓存椂鍌ㄥ瓨璁惧绫诲瀷鍒楄〃 @@ -240,18 +241,19 @@ { //1=绌鸿皟;2=鐢佃;3=椋庢墖;4=鏈洪《鐩�;5=DVD/EVD/VCD;6=鎶曞奖浠�;7=鑷畾涔�; int if_value = int.Parse(clickBtn.Tag.ToString()); - var jobDeviceType = DeviceTypeList.Find((c) => c.deviceType == GetTypeString(if_value)); - if (jobDeviceType == null) - { - return; - } if (if_value == 7) { Method method = new Method(); - method.AddControl(); + method.AddControl(this); } else { + var strings = GetTypeString(if_value).Split('-'); + var jobDeviceType = DeviceTypeList.Find((c) => c.deviceType == strings[0]); + if (jobDeviceType == null) + { + return; + } GetBrandList(jobDeviceType.id, (brandList) => { var brandSupportStrList= GetBrandSupport(if_value); @@ -269,7 +271,7 @@ Application.RunOnMainThread(()=> { BrandList brandObj = new BrandList(); MainPage.BasePageView.AddChidren(brandObj); - brandObj.Show(brandList, strList, null); + brandObj.Show(brandList, strList, strings[1]); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }); @@ -347,39 +349,41 @@ { case 1: { - type = "ac"; + //绌鸿皟 + type = "ac-"+SPK.AcStandard; } break; case 2: { - type = "tv"; + //鐢佃 + type = "tv-"+SPK.ElectricTV; } break; case 3: { - type = "fan"; + //椋庢墖 + type = "fan-" + SPK.ElectricFan; } break; case 4: { - type = "set_top_box"; + //鏈洪《鐩� + // type = "set_top_box-" + SPK.ElectricTV; } break; case 5: { - type = "dvd"; + //褰辩鏈� + // type = "dvd-" + SPK.ElectricTV; } break; case 6: { - type = "projector"; + //鎶曞奖浠� + // type = "projector-" + SPK.ElectricTV; } break; - case 7: - { - type = "PirIcon/custom.png"; - } - break; + } return type; @@ -516,31 +520,5 @@ } } - class DeviceType - { - /// <summary> - /// 璁惧绫诲瀷涓婚敭Id - /// </summary> - public string id = string.Empty; - /// <summary> - /// 璁惧绫诲瀷(鎶曞奖浠�,椋庢墖,鏈洪《鐩�...) - /// </summary> - public string deviceType = string.Empty; - } - public class Brand - { - /// <summary> - /// 鍝佺墝涓婚敭Id - /// </summary> - public string id = string.Empty; - /// <summary> - /// 璁惧绫诲瀷涓婚敭Id - /// </summary> - public string deviceTypeId = string.Empty; - /// <summary> - /// 鍝佺墝鍚嶇О - /// </summary> - public string brandName = string.Empty; - - } + } diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs index 8d2b7d3..a325237 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs @@ -32,10 +32,22 @@ } } /// <summary> + /// 鑾峰彇閬ユ帶鍣ㄥ垪琛� + /// </summary> + public static ResponsePackNew GetList() + { + var jObject = new JObject { { "homeId", HomeId }, { "deviceId", "0" }}; + var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_List); + return responsePackNew; + } + /// <summary> /// 閬ユ帶鍣ㄦ坊鍔� /// </summary> /// <returns></returns> - public static ResponsePackNew Add(Control control) + /// <param name="control"></param> + /// <param name="bool_library">(true=鐮佸簱锛宖alse=鑷鐨�)</param> + /// <returns></returns> + public static ResponsePackNew Add(Control control,bool bool_library) { var jObject = new JObject { }; jObject.Add("homeId", HomeId); @@ -43,9 +55,9 @@ jObject.Add("name", control.name); jObject.Add("spk", "ir.module"); jObject.Add("type", control.type); - if (control.type == "library") + if (bool_library) { - //jObject.Add("group_id", "123"); + jObject.Add("group_id", "123"); var libraryjay = new JArray { }; for (int i = 0; i < control.library.Count; i++) { @@ -53,9 +65,43 @@ } jObject.Add("library", libraryjay); } + var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_Add); return responsePackNew; } + /// <summary> + ///绾㈠鐮佸簱璇曠爜 + /// </summary> + /// <returns></returns> + public static ResponsePackNew CodeTest(Control control) + { + var jObject = new JObject { }; + jObject.Add("homeId", HomeId); + jObject.Add("deviceId", HomeId); + jObject.Add("spk", control.spk); + if (control.spk== Entity.SPK.AcStandard) { + jObject.Add("group_id", control.group_id); + } + var libraryJay = new JArray { }; + for (int i = 0; i < control.library.Count; i++) + { + libraryJay.Add(control.library[i]); + } + var statusJay = new JArray { }; + for (int i = 0; i < control.status.Count; i++) + { + var statusJob = new JObject { }; + var job = control.status[i]; + statusJob.Add("key", job.Key); + statusJob.Add("value", job.value); + statusJay.Add(statusJob); + } + jObject.Add("library", libraryJay); + jObject.Add("status", statusJay); + var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeTest); + return responsePackNew; + } + /// <summary> /// <summary> /// 绾㈠鐮佸涔� /// </summary> @@ -117,7 +163,20 @@ var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_CodeRemove); return responsePackNew; } - + /// <summary> + /// 閬ユ帶鍣ㄥ垹闄� + /// </summary> + /// <returns></returns> + public static ResponsePackNew DeleteRemove(string deviceId) + { + var job = new JObject { }; + job.Add("deviceId", deviceId); + var jArray = new JArray { }; + jArray.Add(job); + var jObject = new JObject { { "homeId", HomeId }, { "deviceId", "0" }, { "devices", jArray } }; + var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Ir_DeviceRemove); + return responsePackNew; + } /// <summary> /// 鏌ヨ绾㈠璁惧绫诲瀷鍒楄〃/鍝佺墝鍒楄〃/鍝佺墝绾㈠鐮佸簱鍒楄〃 /// </summary> @@ -165,8 +224,6 @@ { IsBackground = true }.Start(); } - - /// <summary> ///璇锋眰鏈嶅姟鍣紙涓庝綇瀹呮湁鍏�:渚嬪锛沨omeId锛� diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs index 5d70028..b86395d 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TipView.cs @@ -171,8 +171,161 @@ } + /// <summary> + /// 杈撳叆妗� + /// </summary> + /// <param name="confirmAction">鍥炶皟鍑芥暟</param> + public void InputBox(FrameLayout frameLayout,string tnputEditTxet, Action<string, FrameLayout> confirmAction, bool if_bool = true) + { + FrameLayout frame = new FrameLayout() + { + BackgroundColor = MusicColor.PopupBackgroundColor, + }; + frameLayout.AddChidren(frame); + FrameLayout whiteView = new FrameLayout() + { + //Gravity = Gravity.Center, + X = Application.GetRealWidth(53), + Y = Application.GetRealHeight(264), + Width = Application.GetRealWidth(270), + Height = Application.GetRealHeight(201), + BackgroundColor = MusicColor.WhiteColor, + BorderColor = 0x00000000, + BorderWidth = 0, + Radius = (uint)Application.GetRealHeight(RradiusFrameLayout), + }; + frame.AddChidren(whiteView); - + Button btnTitle = new Button() + { + Y = Application.GetRealHeight(20), + X = Application.GetRealWidth(35), + Height = Application.GetRealHeight(22), + Width = Application.GetRealWidth(200), + TextColor = MusicColor.SelectedColor, + TextSize = TextSize.Text16, + TextAlignment = TextAlignment.Center, + TextID = StringId.shuruyaokongqimingcheng, + + }; + whiteView.AddChidren(btnTitle); + + FrameLayout editBjView = new FrameLayout() + { + // Gravity = Gravity.CenterHorizontal, + Y = btnTitle.Bottom + Application.GetRealHeight(16), + X = Application.GetRealWidth(24), + Width = Application.GetRealWidth(222), + Height = Application.GetRealHeight(40), + BackgroundColor = MusicColor.ViewColor, + BorderColor = 0x00000000, + BorderWidth = 0, + Radius = (uint)Application.GetMinRealAverage(radiusEditFrameLayout), + }; + whiteView.AddChidren(editBjView); + + EditText editText = new EditText() + { + X = Application.GetRealWidth(12), + Y = Application.GetRealHeight(10), + Width = Application.GetRealWidth(160), + Height = Application.GetRealHeight(20), + Text = tnputEditTxet, + TextColor = MusicColor.TextColor, + TextSize = TextSize.Text14, + TextAlignment = TextAlignment.CenterLeft, + }; + editBjView.AddChidren(editText); + + Button clearIconBtn = new Button + { + X = Application.GetRealWidth(194), + Y = Application.GetRealHeight(8), + Width = Application.GetRealWidth(24), + Height = Application.GetRealWidth(24), + UnSelectedImagePath = "MusicIcon/clear.png", + }; + editBjView.AddChidren(clearIconBtn); + clearIconBtn.MouseUpEventHandler += (sender, e) => + { + editText.Text = ""; + }; + + + Button btnTipText = new Button + { + X = Application.GetRealWidth(24), + Y = editBjView.Bottom + Application.GetRealHeight(12), + Width = Application.GetRealWidth(211), + Height = Application.GetRealHeight(35), + Text = Language.StringByID(StringId.fengleichazhao).Replace("{\\r\\n}", "\r\n"), + IsMoreLines = true, + TextColor = MusicColor.MusicNoTxetColor, + TextSize = TextSize.Text12, + TextAlignment = TextAlignment.CenterLeft, + }; + whiteView.AddChidren(btnTipText); + + Button btnLine = new Button() + { + Y = whiteView.Height - Application.GetRealHeight(44 + 1), + Height = Application.GetRealHeight(1), + BackgroundColor = MusicColor.LineColor, + }; + whiteView.AddChidren(btnLine); + + Button btnCancel = new Button() + { + Y = btnLine.Bottom, + Width = Application.GetRealWidth(135), + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextColor = MusicColor.TextCancelColor, + TextSize = TextSize.Text16, + TextID = StringId.cancelMusic, + Gravity = Gravity.BottomLeft, + }; + whiteView.AddChidren(btnCancel); + btnCancel.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomLeft); + + Button btnConfirm = new Button() + { + X = btnCancel.Right, + Y = btnLine.Bottom, + Width = Application.GetRealWidth(135), + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextColor = MusicColor.WhiteColor, + IsBold = true, + TextSize = TextSize.Text16, + TextID = StringId.confirmMusic, + BackgroundColor = MusicColor.SelectedColor, + Gravity = Gravity.BottomRight, + }; + whiteView.AddChidren(btnConfirm); + btnConfirm.SetCornerWithSameRadius(Application.GetRealHeight(RradiusFrameLayout), HDLUtils.RectCornerBottomRight); + btnCancel.MouseUpEventHandler += (sender, e) => + { + frame.RemoveFromParent(); + }; + + + + btnConfirm.MouseUpEventHandler += (sender, e) => + { + if (string.IsNullOrEmpty(editText.Text.Trim())) + { + return; + } + confirmAction(editText.Text.Trim(), frame); + if (if_bool) + { + frame.RemoveFromParent(); + } + }; + + } + } -- Gitblit v1.8.0