.vs/HDL_APP_Project/xs/UserPrefs.xml
@@ -1,47 +1,53 @@ <Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs"> <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs"> <Files> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" Line="175" Column="59" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" /> <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Matching.cs" Line="234" Column="1" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs" Line="39" Column="19" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/PirView.cs" Line="105" Column="30" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs" Line="1" Column="1" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs" Line="10" Column="23" /> <File FileName="HDL_ON/DAL/Mqtt/MqttClient.cs" Line="325" Column="55" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs" Line="177" Column="22" /> <File FileName="HDL_ON/Common/R.cs" Line="873" Column="1" /> <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/TipPopView.cs" Line="578" Column="21" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/DeviceListPage.cs" Line="140" Column="94" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs" Line="16" Column="29" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs" Line="166" Column="30" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControl.cs" Line="166" Column="84" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs" Line="68" Column="56" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs" Line="12" Column="52" /> <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs" Line="113" Column="62" /> </Files> <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="Mqtt" expanded="True" /> </Node> <Node name="Entity" expanded="True" /> <Node name="Entity" expanded="True"> <Node name="Function" expanded="True" /> </Node> <Node name="UI" expanded="True"> <Node name="UI2" expanded="True"> <Node name="4-PersonalCenter" expanded="True"> <Node name="PirDevice" expanded="True"> <Node name="View" expanded="True" /> <Node name="PirSend.cs" selected="True" /> <Node name="3-Intelligence" expanded="True"> <Node name="Automation" expanded="True"> <Node name="LogicView" expanded="True" /> </Node> </Node> <Node name="4-PersonalCenter" expanded="True"> <Node name="AddDevice" expanded="True"> <Node name="AddMiniRemoteControlDirection4Page.cs" selected="True" /> </Node> <Node name="AddFunction" expanded="True" /> <Node name="PirDevice" expanded="True" /> </Node> </Node> </Node> </Node> <Node name="HDL-ON_Android" expanded="True"> <Node name="Assets" expanded="True"> <Node name="Phone" expanded="True"> <Node name="PirIcon" expanded="True" /> </Node> </Node> <Node name="Assets" expanded="True" /> </Node> <Node name="HDL-ON_iOS" expanded="True"> <Node name="Resources" expanded="True"> <Node name="Phone" expanded="True" /> </Node> <Node name="Resources" expanded="True" /> </Node> </Node> </State> HDL-ON_Android/Assets/Language.ini
@@ -1388,6 +1388,7 @@ 6074=遥控器不能超过10个? 6075=遥控器所属区域: 6076=编辑信息 6077=版本升级 6015=在线 HDL-ON_Android/Assets/Phone/.DS_StoreBinary files differ
HDL-ON_Android/Assets/Phone/PirIcon/add.png
HDL-ON_Android/HDL-ON_Android.csproj
@@ -939,6 +939,7 @@ <AndroidAsset Include="Assets\Phone\PirIcon\4.png" /> <AndroidAsset Include="Assets\Phone\PirIcon\left.png" /> <AndroidAsset Include="Assets\Phone\PirIcon\right.png" /> <AndroidAsset Include="Assets\Phone\PirIcon\add.png" /> </ItemGroup> <ItemGroup> <AndroidNativeLibrary Include="libs\armeabi-v7a\libelianjni.so" /> HDL-ON_iOS/HDL-ON_iOS.csproj
@@ -1167,6 +1167,7 @@ <BundleResource Include="Resources\Phone\VideoIcon\phone.png" /> <BundleResource Include="Resources\Phone\VideoIcon\menjin.png" /> <BundleResource Include="Resources\Phone\VideoIcon\answer.png" /> <BundleResource Include="Resources\Phone\PirIcon\add.png" /> </ItemGroup> <ItemGroup> <ITunesArtwork Include="iTunesArtwork" /> HDL-ON_iOS/Resources/Language.ini
@@ -1388,7 +1388,7 @@ 6074=遥控器不能超过10个? 6075=遥控器所属区域: 6076=编辑信息 6077=版本升级 6015=在线 6016=离线 HDL-ON_iOS/Resources/Phone/PirIcon/add.png
HDL_ON/Common/R.cs
@@ -866,6 +866,7 @@ public const int bunengchaoguo10 = 6074; public const int yaokongqiquyu = 6075; public const int bianjixinxi = 6076; public const int banbenshengji = 6077; HDL_ON/HDL_ON.projitems
@@ -343,7 +343,6 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\TopView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\BrandList.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\BrandListView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\DeviceSet.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\TipView.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\AddButton.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\View\SaveView.cs" /> @@ -383,6 +382,7 @@ <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\View\FrameLayout50.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\View\FrameLayout60.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\FuntionControlView\Video\View\ShowDialog.cs" /> <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\PirDevice\SetPir.cs" /> </ItemGroup> <ItemGroup> <Folder Include="$(MSBuildThisFileDirectory)DAL\" /> HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs
@@ -234,16 +234,7 @@ //代表这并不是由温总的界面调用的,则关闭掉全部的界面 HdlFormLogic.Current.CloseAllOpenForm(); //然后再把温总的界面new起来 HDL_ON.UI.UI2.PersonalCenter.PirDevice.Method.GetPirDeviceList(this, () => { Application.RunOnMainThread(() => { var page = new UI2.PersonalCenter.PirDevice.PirMain(); MainPage.BasePageView.AddChidren(page); page.Show(null); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }); }); new UI2.PersonalCenter.PirDevice.Method().MainView(this, newDevice,()=> { }); } }; } HDL_ON/UI/UI2/4-PersonalCenter/AddFunction/DeviceListPage.cs
@@ -137,16 +137,7 @@ switch (device.spk) { case SPK.IrModule: UI2.PersonalCenter.PirDevice.Method.GetPirDeviceList(this, () => { Application.RunOnMainThread(() => { var page = new UI2.PersonalCenter.PirDevice.PirMain(); MainPage.BasePageView.AddChidren(page); page.Show(device); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }); }); new UI2.PersonalCenter.PirDevice.Method().MainView(this, device,()=> { }); break; } }; HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddButton.cs
@@ -159,7 +159,7 @@ var view = MainPage.BasePageView.GetChildren(i); if (view.GetType() == typeof(AddControl)) { new Intelligence.Automation.LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai)); new TipPopView().FlashingBox(Language.StringByID(StringId.tianjiashibai)); view.RemoveFromParent(); } HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/AddControlComplete.cs
@@ -118,53 +118,24 @@ #endregion #region 界面点击事件 //遥控器名称点击事件 namePatchView.btnClick.MouseUpEventHandler += (sender, e) => { namePatchView.btnClick.MouseUpEventHandler += (sender, e) => { List<string> list = new List<string>(); for (int i = 0; i < PirDevice.Pir.currPir.FunctioList.Count; i++) for (int i = 0; i < Pir.currPir.FunctioList.Count; i++) { list.Add(PirDevice.Pir.currPir.FunctioList[i].name); list.Add(Pir.currPir.FunctioList[i].name); } Method method = new Method(); method.EditControlName(StringId.editName, list, control.name, (name, view) => method.EditControlName(StringId.editName, list, control.name, (name, dialog) => { //加载log Loading loading = new Loading(); view.AddChidren(loading); HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; loading.Start(); new System.Threading.Thread(() => Method.ThreadSend(new Control { deviceId = control.deviceId, name = name }, (responsePackNew) => { try { responsePackNew = PirSend.DeviceRename(control.deviceId, control.name); } catch { } finally { Application.RunOnMainThread(() => { loading.Hide(); if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") { view.Close(); namePatchView.btnText2.Text = name; function.name = name; } else { Method methodError = new Method(); methodError.ErrorShow(responsePackNew, ""); } dialog.Close(); namePatchView.btnText2.Text = name; function.name = name; }); } }) { IsBackground = true }.Start(); }, "修改名称", "dialog", null, dialog); }, () => { }); }; //所属区域点击事件 @@ -198,12 +169,16 @@ //完成点击事件 saveView.btnClick.MouseUpEventHandler += (sender, e) => { //前面界面 // this.RemoveFromParent(); //移除所有界面 MainPage.BasePageView.RemoveViewByTag("PirView"); //主界面 //MainPage.BasePageView.RemoveViewByTag("PirMain"); //移除红外宝根界面 MainPage.BasePageView.RemoveViewByTag("PirMain"); //重新加载界面 var page = new PirMain(); MainPage.BasePageView.AddChidren(page); page.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; #endregion } HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/DeviceSet.cs
File was deleted HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/EditControl.cs
@@ -10,10 +10,9 @@ public EditControl() { } public void Show(Entity.Function control, Pir pir, Action<Entity.Function> action) public void Show(Entity.Function control,Action<Entity.Function> action) { #region 界面布局 this.BackgroundColor = CSS.CSS_Color.viewMiddle; PirDevice.View.TopView topView = new View.TopView(); topView.topNameBtn.TextID = StringId.pipeiyaokongqi; @@ -32,7 +31,7 @@ BackgroundColor = CSS.CSS_Color.viewMiddle, }; this.AddChidren(viewLayout); //遥控器名称: FrameLayout50 editNameFLayout = new FrameLayout50(); editNameFLayout.btnText.Text = Language.StringByID(StringId.yaokongqimingcheng) + ":"; editNameFLayout.btnEditText.Text = control.name; @@ -40,62 +39,37 @@ editNameFLayout.btnNextIcon.Width = Application.GetRealWidth(28); editNameFLayout.btnNextIcon.UnSelectedImagePath = "LogicIcon/editname.png"; viewLayout.AddChidren(editNameFLayout.FLayoutView()); //遥控器所属区域: FrameLayout50 areaFLayout = new FrameLayout50(); areaFLayout.btnText.Text = Language.StringByID(StringId.yaokongqiquyu); areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control); areaFLayout.frameLayout.Y = editNameFLayout.frameLayout.Bottom; viewLayout.AddChidren(areaFLayout.FLayoutView()); #endregion #region //修改名称点击事件 editNameFLayout.btnClick.MouseUpEventHandler += (sender, e) => { List<string> list = new List<string>(); for (int i = 0; i < pir.FunctioList.Count; i++) for (int i = 0; i < Pir.currPir.FunctioList.Count; i++) { list.Add(pir.FunctioList[i].name); list.Add(Pir.currPir.FunctioList[i].name); } Method method = new Method(); method.EditControlName(StringId.editName,list, control.name, (name,view) => method.EditControlName(StringId.editName,list, control.name, (name, dialog) => { //加载log Loading loading = new Loading(); view.AddChidren(loading); HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null; loading.Start(); new System.Threading.Thread(() => Method.ThreadSend(new Control { deviceId = control.deviceId, name = name }, (responsePackNew) => { try { responsePackNew = PirSend.DeviceRename(control.deviceId, control.name); } catch { } finally { Application.RunOnMainThread(() => { loading.Hide(); if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") { view.Close(); editNameFLayout.btnEditText.Text = name; control.name = name; } else { Method methodError = new Method(); methodError.ErrorShow(responsePackNew,""); } dialog.Close(); editNameFLayout.btnEditText.Text = name; control.name = name; }); } }) { IsBackground = true }.Start(); }, "修改名称", "dialog", null, dialog); },()=> { }); }; //遥控器所属区域选中事件 areaFLayout.btnClick.MouseUpEventHandler += (sender, e) => { Method method = new Method(); @@ -105,6 +79,7 @@ areaFLayout.btnEditText.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control); }); }; #endregion } } } HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/Method.cs
@@ -8,6 +8,36 @@ { public class Method { /// <summary> /// 程序主入口 /// </summary> /// <param name="frame"></param> /// <param name="function"></param> public void MainView(FrameLayout frame, Entity.Function function,Action action) { Pir pirDevice = new Pir(); if (function != null) {//数据转换 pirDevice.name = function.name; pirDevice.deviceId = function.deviceId; pirDevice.sid = function.sid; pirDevice.online = function.online; } Pir.currPir = pirDevice; GetControlList(frame, () => { Application.RunOnMainThread(() => { var page = new PirMain(); MainPage.BasePageView.AddChidren(page); page.Show(); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; page.BackAction += () => { action?.Invoke(); }; }); }, Pir.currPir); } /// <summary> /// 管理位置 @@ -241,7 +271,7 @@ } /// <summary> /// 获取遥控器列表 /// 获取所有红外宝遥控器列表 /// </summary> /// <param name="action">回调函数</param> public static void GetControlList(Action action) @@ -296,6 +326,64 @@ { IsBackground = true }.Start(); } /// <summary> /// 获取单个红外宝遥控器列表 /// </summary> /// <param name="action">回调函数</param> public static void GetControlList(FrameLayout frame ,Action action, Pir pirDevice) { Loading loading = new Loading(); frame.AddChidren(loading); loading.Start(); new System.Threading.Thread(() => { try { try { var responsePackNew = PirSend.ControlList(pirDevice); 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]; //数据返序列化为Logic对象 var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay); var pirJosn = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.Function>(str); if (pirJosn != null) { if (null == pirDevice.FunctioList.Find((c) => c.sid == pirJosn.sid)) { pirDevice.FunctioList.Add(pirJosn); } } } } } catch { } } catch { } finally { Application.RunOnMainThread(() => { loading.Hide(); action(); }); } }) { IsBackground = true }.Start(); } /// <summary> /// 获取设备详情通过(spk,sid) /// </summary> @@ -334,20 +422,29 @@ }) { IsBackground = true }.Start(); } /// <summary> /// 发送命令线程 /// </summary> /// <param name="control">发送数据对象</param> /// <param name="action">回调函数</param> /// <param name="str">判断字符</param> /// <param name="view">判断log父控件</param> /// <param name="frame">log父控件</param> public void ThreadSend(Control control, Action<ResponsePackNew> action, string str, FrameLayout frame) /// <param name="dialog">log父控件</param> public static void ThreadSend(Control control, Action<ResponsePackNew> action, string str,string view, FrameLayout frame, Dialog dialog) { //加载log Loading loading = new Loading(); frame.AddChidren(loading); if (view == "dialog") { dialog.AddChidren(loading); } else { frame.AddChidren(loading); } loading.Start(); ResponsePackNew responsePackNew = null; new System.Threading.Thread(() => @@ -364,64 +461,6 @@ responsePackNew = PirSend.DeviceRename(control.deviceId, control.name); } else if (str == "删除按键") { // responsePackNew = PirSend.CodeRemove(control.deviceId, control.name); } } catch { } finally { Application.RunOnMainThread(() => { loading.Hide(); if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "") { action(responsePackNew); } else { Method method = new Method(); method.ErrorShow(responsePackNew, ""); } }); } }) { IsBackground = true }.Start(); } /// <summary> /// 发送命令线程 /// </summary> /// <param name="control">发送数据对象</param> /// <param name="action">回调函数</param> /// <param name="str">判断字符</param> /// <param name="dialog">log父控件</param> public void ThreadSend(Control control, Action<ResponsePackNew> action, string str,Dialog dialog) { //加载log Loading loading = new Loading(); dialog.AddChidren(loading); ResponsePackNew responsePackNew = null; loading.Start(); new System.Threading.Thread(() => { try { if (str == "删除") { responsePackNew = PirSend.DeleteDevice(control.deviceId); } else if (str == "修改名称") { responsePackNew = PirSend.DeviceRename(control.deviceId, control.name); } else if (str == "删除按键") { // responsePackNew = PirSend.CodeRemove(control.deviceId, control.name); } } HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirMain.cs
@@ -12,206 +12,288 @@ Tag = "PirMain"; } /// <summary> /// 回调 /// </summary> public Action BackAction; /// <summary> /// 临时储存设备类型列表 /// </summary> List<DeviceType> DeviceTypeList = new List<DeviceType>(); public void Show(Entity.Function function) public void Show() { #region 界面布局 this.BackgroundColor = CSS.CSS_Color.viewMiddle; PirDevice.View.TopView topView = new View.TopView(); topView.topNameBtn.TextID = StringId.hongwaiyaokong; topView.topIconBtn.Visible = true; this.AddChidren(topView.FLayoutView()); topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { this.RemoveFromParent(); }; topView.clickBackBtn.MouseUpEventHandler += (sender, e) => { BackAction(); this.RemoveFromParent(); }; FrameLayout middFLayout = new FrameLayout(); middFLayout.Y = Application.GetRealHeight(64); middFLayout.Height = Application.GetRealHeight(667 - 64); this.AddChidren(middFLayout); View.MainView mainView = new View.MainView(); mainView.Show(middFLayout); FrameLayout deviceListFLayout = new FrameLayout(); deviceListFLayout.Y = mainView.pirDeviceFLayout.Bottom + Application.GetRealHeight(12); deviceListFLayout.X = Application.GetRealWidth(16); deviceListFLayout.Width = Application.GetRealWidth(343); deviceListFLayout.Height = Application.GetRealHeight(328); deviceListFLayout.BackgroundColor = CSS.CSS_Color.view; deviceListFLayout.Radius = (uint)Application.GetRealHeight(12); middFLayout.AddChidren(deviceListFLayout); ///添加遥控器 Button text3Btn = new Button { Y = Application.GetRealHeight(11), X = Application.GetRealWidth(16), Width = Application.GetRealWidth(100), Height = Application.GetRealHeight(20), TextSize = TextSize.text14, TextColor = CSS.CSS_Color.textConfirmColor, TextAlignment = TextAlignment.CenterLeft, TextID = StringId.tianjiayaokongqi, IsBold = true, }; deviceListFLayout.AddChidren(text3Btn); ///红外宝名称 Button deviceNameBtn = new Button { Y = Application.GetRealHeight(13), X = Application.GetRealWidth(161), Width = Application.GetRealWidth(150), Height = Application.GetRealHeight(17), TextSize = TextSize.text12, TextColor = CSS.CSS_Color.textColor, TextAlignment = TextAlignment.CenterRight, Text = "mini智能遥控器", }; deviceListFLayout.AddChidren(deviceNameBtn); //下拉图标 var dropdownIconBtn = new Button VerticalRefreshLayout vv = new VerticalRefreshLayout(); middFLayout.AddChidren(vv); //加号图标 Button addDevice = new Button { Y = Application.GetRealHeight(13), X = Application.GetRealWidth(343 - 8 - 16), Width = Application.GetRealWidth(16), Height = Application.GetRealWidth(16), UnSelectedImagePath = "PirIcon/dropdown.png", Y = Application.GetRealHeight(480), X = Application.GetRealWidth(293), Width = Application.GetRealWidth(82), Height = Application.GetRealWidth(84), UnSelectedImagePath = "PirIcon/add.png", }; deviceListFLayout.AddChidren(dropdownIconBtn); #endregion if (Pir.pirDeviceList.Count != 0) if (Pir.currPir.FunctioList.Count < 10) { //if (function != null) //{ // Pir pir = new Pir(); // pir.name = function.name; // pir.deviceId = function.deviceId; // pir.sid = function.sid; // Pir.currPir = pir; //} //else //{ // Pir.currPir = Pir.pirDeviceList[0]; //} //默认第一个红外宝 Pir.currPir = Pir.pirDeviceList[0]; int sum = 0; for (int i = 0; i < Pir.pirDeviceList.Count; i++) { //查找 sum += Pir.pirDeviceList[i].FunctioList.Count; } deviceNameBtn.Text = Pir.pirDeviceList[0].name; mainView.numberDeviceBtn.Text = Pir.pirDeviceList.Count.ToString() + Language.StringByID(StringId.ge); mainView.currDeviceNumberControlBtn.Text = sum.ToString() + Language.StringByID(StringId.ge); //10个遥控器就会隐藏添加图标 middFLayout.AddChidren(addDevice); } ///设备管理的点击事件 mainView.clickBtn.MouseUpEventHandler += (sender, e) => vv.BeginHeaderRefreshingAction += () => { ////关闭刷新View; vv.EndHeaderRefreshing(); Method.GetControlList(this, () => { Application.RunOnMainThread(() => { //刷新界面 UIView(vv); }); }, Pir.currPir); }; UIView(vv); topView.clickSetBtn.MouseUpEventHandler += (sender, e) => { DeviceSet deviceSet = new DeviceSet(); MainPage.BasePageView.AddChidren(deviceSet); deviceSet.Show(() => SetPir setPir = new SetPir(); MainPage.BasePageView.AddChidren(setPir); setPir.Show(() => { if (Pir.currPir != null) { deviceNameBtn.Text = Pir.currPir.name; mainView.numberDeviceBtn.Text = Pir.pirDeviceList.Count.ToString() + Language.StringByID(StringId.ge); } int sum = 0; for (int i = 0; i < Pir.pirDeviceList.Count; i++) { sum += Pir.pirDeviceList[i].FunctioList.Count; } mainView.currDeviceNumberControlBtn.Text = sum.ToString() + Language.StringByID(StringId.ge); BackAction(); ////刷新界面 UIView(vv); }); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; ///红外名称的点击事件 deviceNameBtn.MouseUpEventHandler += (sender, e) => addDevice.MouseUpEventHandler += (sender, e) => { View.HeigthChangeView heigthChangeView = new View.HeigthChangeView(); heigthChangeView.Show(this, Pir.pirDeviceList, (pirJson) => FrameLayout frame = new FrameLayout { deviceNameBtn.Text = pirJson.name; Pir.currPir = pirJson; }); }; int line = 0; for (int i = 1, j = 0; i <= 7; i++, j++) { var currpirdeviceFLayout = new FrameLayout { Width = Application.GetRealWidth(80), Height = Application.GetRealWidth(80), X = Application.GetRealWidth(26 + (80 + 25) * j), Y = Application.GetRealHeight(52 + (80 + 12) * line), BackgroundColor = CSS.CSS_Color.viewTrans60lucence, }; deviceListFLayout.AddChidren(currpirdeviceFLayout); var deviceIconBtn = new Button this.AddChidren(frame); FrameLayout controlFl = new FrameLayout(); controlFl.Y = Application.GetRealHeight(319); controlFl.X = Application.GetRealWidth(16); controlFl.Width = Application.GetRealWidth(343); controlFl.Height = Application.GetRealHeight(328); controlFl.BackgroundColor = CSS.CSS_Color.view; controlFl.Radius = (uint)Application.GetRealHeight(12); frame.AddChidren(controlFl); ///添加遥控器 Button text3Btn = new Button { Y = Application.GetRealHeight(8), X = Application.GetRealWidth(20), Width = Application.GetRealWidth(40), Height = Application.GetRealWidth(40), UnSelectedImagePath = "PirIcon/Infraredtreasure.png", }; currpirdeviceFLayout.AddChidren(deviceIconBtn); var iconNameBtn = new Button { Y = deviceIconBtn.Bottom + Application.GetRealHeight(8), Width = Application.GetRealWidth(80), Height = Application.GetRealHeight(17), TextSize = TextSize.text12, TextColor = CSS.CSS_Color.TextualColor, Y = Application.GetRealHeight(12), X = Application.GetRealWidth(16), Width = Application.GetRealWidth(343 - 16 * 2), Height = Application.GetRealHeight(20), TextSize = TextSize.text14, TextColor = CSS.CSS_Color.textConfirmColor, TextAlignment = TextAlignment.Center, TextID = StringId.tianjiayaokongqi, IsBold = true, }; currpirdeviceFLayout.AddChidren(iconNameBtn); var clickBtn = new Button { Tag = i }; currpirdeviceFLayout.AddChidren(clickBtn); if (i % 3 == 0) { //满一行重置j=0值; j = -1; line += 1; } GetIconAndText(i, deviceIconBtn, iconNameBtn); clickBtn.MouseUpEventHandler += (sender, e) => controlFl.AddChidren(text3Btn); frame.MouseUpEventHandler += (sender1, e1) => { //1=空调;2=电视;3=风扇;4=机顶盒;5=DVD/EVD/VCD;6=投影仪;7=自定义; int if_value = int.Parse(clickBtn.Tag.ToString()); if (if_value == 7) frame.RemoveFromParent(); }; int line = 0; for (int i = 1, j = 0; i <= 7; i++, j++) { var currpirdeviceFLayout = new FrameLayout { Method method = new Method(); method.AddControl(this, (control) => { AddButton addButton = new AddButton(); MainPage.BasePageView.AddChidren(addButton); addButton.Show(control); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }); Width = Application.GetRealWidth(80), Height = Application.GetRealWidth(80), X = Application.GetRealWidth(26 + (80 + 25) * j), Y = Application.GetRealHeight(52 + (80 + 12) * line), }; controlFl.AddChidren(currpirdeviceFLayout); var deviceIconBtn = new Button { Y = Application.GetRealHeight(8), X = Application.GetRealWidth(20), Width = Application.GetRealWidth(40), Height = Application.GetRealWidth(40), UnSelectedImagePath = "PirIcon/Infraredtreasure.png", }; currpirdeviceFLayout.AddChidren(deviceIconBtn); var iconNameBtn = new Button { Y = deviceIconBtn.Bottom + Application.GetRealHeight(8), Width = Application.GetRealWidth(80), Height = Application.GetRealHeight(17), TextSize = TextSize.text12, TextColor = CSS.CSS_Color.TextualColor, TextAlignment = TextAlignment.Center, }; currpirdeviceFLayout.AddChidren(iconNameBtn); var clickBtn = new Button { Tag = i }; currpirdeviceFLayout.AddChidren(clickBtn); if (i % 3 == 0) { //满一行重置j=0值; j = -1; line += 1; } else GetIconAndText(i, deviceIconBtn, iconNameBtn); clickBtn.MouseUpEventHandler += (sender2, e2) => { if (DeviceTypeList.Count == 0) //1=空调;2=电视;3=风扇;4=机顶盒;5=DVD/EVD/VCD;6=投影仪;7=自定义; int if_value = int.Parse(clickBtn.Tag.ToString()); if (if_value == 7) { GetDeviceTypeList(true, () => { DeviceTypeViewClick(if_value); }); Method method = new Method(); method.AddControl(this, (control) => { //成功后移除; frame.RemoveFromParent(); AddButton addButton = new AddButton(); MainPage.BasePageView.AddChidren(addButton); addButton.Show(control); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }); } else { DeviceTypeViewClick(if_value); //进来都要移除; frame.RemoveFromParent(); if (DeviceTypeList.Count == 0) { GetDeviceTypeList(true, () => { DeviceTypeViewClick(if_value); }); } else { DeviceTypeViewClick(if_value); } } } }; } }; } /// <summary> /// 加载UI界面 /// </summary> /// <param name="vv">上下滑控件</param> private void UIView(VerticalRefreshLayout vv) { vv.RemoveAll(); #region 红外宝图标 版本号 名称 状态 FrameLayout fLayout = new FrameLayout { Width = Application.GetRealWidth(375), Height = Application.GetRealHeight(12 + 92 + (50 * Pir.currPir.FunctioList.Count)), }; vv.AddChidren(fLayout); View.PirView pirView = new View.PirView(); //红外宝名称 pirView.deviceNameBtn.Text = Pir.currPir.name; //红外宝当前有多少个遥控器 pirView.geBtn.Text = Pir.currPir.FunctioList.Count.ToString(); //红外宝是否在线-离线 if (Pir.currPir.online) { pirView.stateIconBtn.IsSelected = true; pirView.stateTextBtn.IsSelected = true; pirView.stateTextBtn.TextID = StringId.zaixian; } else { pirView.stateIconBtn.IsSelected = false; pirView.stateTextBtn.IsSelected = false; pirView.stateTextBtn.TextID = StringId.lixian; } //标记红外宝 pirView.clickBtn.Tag = Pir.currPir; //加载界面 pirView.Show(Pir.currPir.FunctioList.Count, fLayout); //最后一个后面增加间隔背景 vv.AddChidren(new FrameLayout { Height = Application.GetRealHeight(20) }); #endregion for (int j = 0; j < Pir.currPir.FunctioList.Count; j++) { var control = Pir.currPir.FunctioList[j]; View.ControlView controlView = new View.ControlView(); controlView.Show(pirView.devfLayout, j); //遥控器名称 controlView.nameBtn.Text = control.name; //遥控器存放区域 controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(control); //标记遥控器 controlView.delBtn.Tag = control; //删除点击事件 controlView.delBtn.MouseUpEventHandler += (sender, e) => { var Function = controlView.delBtn.Tag as Entity.Function; string text = Language.StringByID(StringId.shanchushebei) + Function.name + "?"; TipPopView tipPopView = new TipPopView(); tipPopView.TipBox(StringId.tip, text, (dialog) => { Method.ThreadSend(new Control { deviceId=control.deviceId}, (responsePackNew) => { dialog.Close(); var function = Pir.currPir.FunctioList.Find((c) => c.sid == Function.sid); if (function != null) { Pir.currPir.FunctioList.Remove(Function); } UIView(vv); }, "删除", "dialog", null, dialog); }, () => { }, false); }; //view点击事件 controlView.clickBtn.MouseUpEventHandler += (sender, e) => { EditControl editControl = new EditControl(); MainPage.BasePageView.AddChidren(editControl); editControl.Show(control,(device) => { //回调更新名字/区域 controlView.nameBtn.Text = device.name; controlView.areaBtn.Text = Intelligence.Automation.LogicMethod.GetGetRoomName(device); }); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; if (j == Pir.currPir.FunctioList.Count - 1) { //最后改变一个线的颜色 controlView.line1Btn.BackgroundColor = CSS.CSS_Color.viewTranslucence; controlView.funControlRow.LineColor = CSS.CSS_Color.viewTranslucence; } } } /// <summary> @@ -237,7 +319,6 @@ }); } /// <summary> /// 获取设备类型str /// </summary> @@ -423,6 +504,8 @@ } }, id, "品牌列表"); } } } HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/PirSend.cs
@@ -152,13 +152,6 @@ /// <returns></returns> public static void CodeStudy(Control control,AttributesStatus buttonObj,Action<ResponsePackNew> action) { //var whichDayJson = jay["whichDay"].ToString(); //var whichDayAry = Newtonsoft.Json.Linq.JArray.Parse(whichDayJson); //for (int b = 0; b < whichDayAry.Count; b++) //{ // var days = whichDayAry[b].ToString(); // timer.whichDay.Add(int.Parse(days)); //} var job = new JObject { }; job.Add("key", buttonObj.key); job.Add("data_type", "string"); HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/SetPir.cs
New file @@ -0,0 +1,134 @@ using System; using System.Collections.Generic; using HDL_ON.UI.UI2.Intelligence.Automation.LogicView; using HDL_ON.UI.UI2.PersonalCenter.PirDevice.View; using Shared; namespace HDL_ON.UI.UI2.PersonalCenter.PirDevice { public class SetPir : FrameLayout { public SetPir() { Tag = "PirMain"; } public void Show(Action action) { #region 界面布局 this.BackgroundColor = CSS.CSS_Color.viewMiddle; Intelligence.Automation.LogicView.TopView topView = new Intelligence.Automation.LogicView.TopView(); this.AddChidren(topView.FLayoutView()); topView.clickBackBtn.MouseUpEventHandler += (e, sen) => { action(); RemoveFromParent(); }; topView.topNameBtn.TextID = StringId.setlogic; FrameLayout viewLayout = new FrameLayout { Y = Application.GetRealHeight(64), Width = Application.GetRealWidth(Intelligence.Automation.LogicView.TextSize.view375), Height = Application.GetRealHeight(Intelligence.Automation.LogicView.TextSize.view667 - 64 - 76), BackgroundColor = CSS.CSS_Color.viewMiddle, }; this.AddChidren(viewLayout); ///名称 FrameLayout50 editNameFLayout = new FrameLayout50(); editNameFLayout.btnText.Text = Language.StringByID(StringId.yaokongqimingcheng) + ":"; editNameFLayout.btnEditText.Text = Pir.currPir.name; editNameFLayout.btnNextIcon.Height = Application.GetRealWidth(28); editNameFLayout.btnNextIcon.Width = Application.GetRealWidth(28); editNameFLayout.btnNextIcon.UnSelectedImagePath = "LogicIcon/editname.png"; viewLayout.AddChidren(editNameFLayout.FLayoutView()); ///版本升级 FrameLayout50 banbenshengjiFL = new FrameLayout50(); banbenshengjiFL.btnText.Text = Language.StringByID(StringId.banbenshengji); banbenshengjiFL.frameLayout.Y = editNameFLayout.frameLayout.Bottom; viewLayout.AddChidren(banbenshengjiFL.FLayoutView()); ///版本号:v1.3.5 FrameLayout50 banbenhaoFLayout = new FrameLayout50(); banbenhaoFLayout.btnNextIcon.Visible = false; banbenhaoFLayout.btnText.Text = Language.StringByID(StringId.banbenhao) + ":v1.3.5"; banbenhaoFLayout.frameLayout.Y = banbenshengjiFL.frameLayout.Bottom; viewLayout.AddChidren(banbenhaoFLayout.FLayoutView()); //删除 FrameLayout frameLayout = new FrameLayout { Y = Application.GetRealHeight(Intelligence.Automation.LogicView.TextSize.view667 - 50), Height = Application.GetRealHeight(50), BackgroundColor = CSS.CSS_Color.view, Gravity = Gravity.BottomCenter,//置底的属性 }; this.AddChidren(frameLayout); Button btnDel = new Button { TextSize = Intelligence.Automation.LogicView.TextSize.text16, Width = Application.GetRealWidth(50), Height = Application.GetRealHeight(22), TextColor = CSS.CSS_Color.textRedColor, Gravity = Gravity.Center, TextID = StringId.Del, }; frameLayout.AddChidren(btnDel); #endregion #region 界面点击事件 //修改名称的点击事件 editNameFLayout.btnClick.MouseUpEventHandler += (sender, e) => { List<string> list = new List<string>(); Method method = new Method(); method.EditControlName(StringId.editName, list, Pir.currPir.name, (name, dialog) => { Method.ThreadSend(new Control { deviceId = Pir.currPir.deviceId, name = name }, (responsePackNew) => { dialog.Close(); editNameFLayout.btnEditText.Text = name; Pir.currPir.name = name; }, "修改名称", "dialog", null, dialog); }, () => { }); }; //删除红外宝的点击事件 EventHandler<MouseEventArgs> delClick = (sender, e) => { string text = Language.StringByID(StringId.shanchushebei) + Pir.currPir.name + "?"; TipPopView tipPopView = new TipPopView(); tipPopView.TipBox(StringId.tip, text, (dialog) => { Method.ThreadSend(new Control { deviceId = Pir.currPir.deviceId }, (responsePackNew) => { var pir = Pir.pirDeviceList.Find((c) => c.deviceId == Pir.currPir.deviceId); if (pir != null) { Pir.pirDeviceList.Remove(Pir.currPir); } dialog.Close(); action(); this.RemoveFromParent(); for (int i = MainPage.BasePageView.ChildrenCount - 1; 0 <= i; i--) { var view = MainPage.BasePageView.GetChildren(i); if (view.GetType() == typeof(PirMain)) { view.RemoveFromParent(); } } }, "删除", "dialog", null, dialog); }, () => { }, false); }; btnDel.MouseUpEventHandler += delClick; frameLayout.MouseUpEventHandler += delClick; #endregion } } } HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/FrameLayout50.cs
@@ -20,7 +20,7 @@ public Button btnText = new Button { TextSize = TextSize.Text16, Width = Application.GetRealWidth(200), Width = Application.GetRealWidth(150), Height = Application.GetRealHeight(22), TextColor = CSS.CSS_Color.textColor, X = Application.GetRealWidth(16), @@ -31,11 +31,11 @@ /// </summary> public Button btnEditText = new Button { Width = Application.GetRealWidth(357 - 52 - 200 - 16), Width = Application.GetRealWidth(357 - 52 - 150 - 16), Height = Application.GetRealHeight(20), TextSize = TextSize.Text14, TextColor = CSS.CSS_Color.textCancelColor, X = Application.GetRealWidth(200 + 16), X = Application.GetRealWidth(150 + 16), TextAlignment = TextAlignment.CenterRight, }; HDL_ON/UI/UI2/4-PersonalCenter/PirDevice/View/TopView.cs
@@ -48,7 +48,7 @@ X = Application.GetRealWidth(337), Width = Application.GetRealWidth(28), Height = Application.GetRealWidth(28), UnSelectedImagePath = "PirIcon/adddevice.png", UnSelectedImagePath = "LogicIcon/set.png", Visible = false, }; /// <summary>