| | |
| | | <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> |
| | |
| | | <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> |
| | |
| | | 6063=确认设备是否有响应 |
| | | 6064=控制失败 |
| | | 6065=控制成功 |
| | | |
| | | |
| | | 6066=电源开 |
| | | 6067=模式制冷 |
| | | 6068=风速中风 |
| | | 6069=温度26℃ |
| | | |
| | | |
| | | 7000=新建自动化 |
| | |
| | | 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; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | /// 遥控器自学按键删除 |
| | | /// </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 |
| | | |
| | |
| | | { |
| | | |
| | | string value = dic["value"]; |
| | | if (value == "true") |
| | | if (value == "open") |
| | | { |
| | | inputView.btnState.Text = Language.StringByID(StringId.kaiqi); |
| | | |
| | |
| | | foreach (var dic in dicList) |
| | | { |
| | | string value = dic["value"]; |
| | | if (value == "true") |
| | | if (value == "open") |
| | | { |
| | | button1.Text = Language.StringByID(StringId.kaiqi); |
| | | } |
| | |
| | | //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 |
| | |
| | | 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(); |
| | |
| | | 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), |
| | |
| | | //添加成功 |
| | | 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), |
| | |
| | | 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; |
| | |
| | | { |
| | | 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, |
| | |
| | | #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"); |
| | | }; |
| | |
| | | /// |
| | | /// </summary> |
| | | /// <param name="list">表示该列表元素A-Z字母筛选显示出来</param> |
| | | /// <param name="list6">表示该列表元素显示在list前面(该列表元素不做A-Z字母筛选),没有可以为list6=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 |
| | |
| | | { |
| | | 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); |
| | |
| | | listStr.Add(s); |
| | | } |
| | | } |
| | | RefreshLayout(vv, brandList, listStr); |
| | | RefreshLayout(vv, brandList, listStr,spk); |
| | | |
| | | }; |
| | | #region A-Z |
| | |
| | | } |
| | | #endregion |
| | | |
| | | RefreshLayout(vv, brandList, list1); |
| | | RefreshLayout(vv, brandList, list1,spk); |
| | | |
| | | } |
| | | /// <summary> |
| | |
| | | /// </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) |
| | |
| | | { |
| | | Matching matching = new Matching(); |
| | | MainPage.BasePageView.AddChidren(matching); |
| | | matching.Show(); |
| | | matching.Show(libraryList, spk); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }); |
| | | |
| | |
| | | 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); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | 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; |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | using 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 |
| | |
| | | { |
| | | public Matching() |
| | | { |
| | | Tag = "PirView"; |
| | | } |
| | | public void Show() |
| | | public void Show(List<Library> libraryList,string spk) |
| | | { |
| | | #region 界面布局 |
| | | this.BackgroundColor = CSS.CSS_Color.viewMiddle; |
| | |
| | | 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, |
| | |
| | | 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, |
| | | }; |
| | |
| | | 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">云雀上定义spk</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; |
| | | } |
| | | } |
| | | } |
| | |
| | | /// <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); |
| | | |
| | | |
| | | |
| | |
| | | /// 发送遥控器命令方法 |
| | | /// </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 |
| | |
| | | //{ |
| | | if (!string.IsNullOrEmpty(Sid("sid"))) { } |
| | | ///这里:监听MTTP推送下来主题,才知道是否添加成功 |
| | | 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(); |
| | |
| | | { 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> |
| | |
| | | |
| | | } |
| | | } |
| | | [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; |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | 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> |
| | |
| | | /// 红外码 |
| | | /// </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; |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | using 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 |
| | |
| | | { |
| | | public PirMain() |
| | | { |
| | | Tag = "PirView"; |
| | | Tag = "PirMain"; |
| | | } |
| | | /// <summary> |
| | | /// 临时储存设备类型列表 |
| | |
| | | { |
| | | //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); |
| | |
| | | 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; |
| | | }); |
| | | |
| | |
| | | { |
| | | 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; |
| | |
| | | } |
| | | |
| | | } |
| | | 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; |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | } |
| | | /// <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=码库,false=自学的)</param> |
| | | /// <returns></returns> |
| | | public static ResponsePackNew Add(Control control,bool bool_library) |
| | | { |
| | | var jObject = new JObject { }; |
| | | jObject.Add("homeId", HomeId); |
| | |
| | | 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++) |
| | | { |
| | |
| | | } |
| | | 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> |
| | |
| | | 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> |
| | |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | ///请求服务器(与住宅有关:例如;homeId) |
| | |
| | | |
| | | } |
| | | |
| | | /// <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(); |
| | | } |
| | | }; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |