| | |
| | | public PirMain() |
| | | { |
| | | Tag = "PirMain"; |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 临时储存设备类型列表 |
| | |
| | | middFLayout.Y = Application.GetRealHeight(64); |
| | | middFLayout.Height = Application.GetRealHeight(667 - 64); |
| | | this.AddChidren(middFLayout); |
| | | |
| | | FrameLayout pirDeviceFLayout = new FrameLayout(); |
| | | pirDeviceFLayout.Y = Application.GetRealHeight(12); |
| | | pirDeviceFLayout.X = Application.GetRealWidth(16); |
| | | pirDeviceFLayout.Width = Application.GetRealWidth(343); |
| | | pirDeviceFLayout.Height = Application.GetRealHeight(187); |
| | | pirDeviceFLayout.BackgroundColor = CSS.CSS_Color.view; |
| | | pirDeviceFLayout.Radius = (uint)Application.GetRealHeight(12); |
| | | middFLayout.AddChidren(pirDeviceFLayout); |
| | | |
| | | //设备管理 |
| | | Button text1Btn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(11), |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(120), |
| | | Height = Application.GetRealHeight(20), |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textConfirmColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextID = StringId.shebeigaunli, |
| | | IsBold = true, |
| | | }; |
| | | pirDeviceFLayout.AddChidren(text1Btn); |
| | | |
| | | |
| | | Button pirIcon = new Button |
| | | { |
| | | Y = Application.GetRealHeight(47), |
| | | X = Application.GetRealWidth(28), |
| | | Width = Application.GetRealWidth(66), |
| | | Height = Application.GetRealWidth(66), |
| | | UnSelectedImagePath = "PirIcon/Infraredtreasure.png", |
| | | }; |
| | | pirDeviceFLayout.AddChidren(pirIcon); |
| | | |
| | | //mini智能遥控器 |
| | | Button text2Btn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(70), |
| | | X = Application.GetRealWidth(112), |
| | | Width = Application.GetRealWidth(120), |
| | | Height = Application.GetRealHeight(20), |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textTipColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = "mini智能遥控器", |
| | | }; |
| | | pirDeviceFLayout.AddChidren(text2Btn); |
| | | |
| | | //红外宝数量 |
| | | Button numberDeviceBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(137), |
| | | X = Application.GetRealWidth(32), |
| | | Width = Application.GetRealWidth(100), |
| | | Height = Application.GetRealHeight(20), |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = "1" + Language.StringByID(StringId.ge), |
| | | IsBold = true, |
| | | }; |
| | | pirDeviceFLayout.AddChidren(numberDeviceBtn); |
| | | //当前红外遥控设备 |
| | | Button numberDeviceTextBtn = new Button |
| | | { |
| | | Y = numberDeviceBtn.Bottom + Application.GetRealHeight(4), |
| | | X = Application.GetRealWidth(32), |
| | | Width = Application.GetRealWidth(100), |
| | | Height = Application.GetRealHeight(14), |
| | | TextSize = TextSize.text10, |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextID = StringId.dangqianhongwaishebei, |
| | | }; |
| | | pirDeviceFLayout.AddChidren(numberDeviceTextBtn); |
| | | //所有红外宝的遥控器数量 |
| | | Button currDeviceNumberControlBtn = new Button |
| | | { |
| | | Y = Application.GetRealHeight(137), |
| | | X = Application.GetRealWidth(198), |
| | | Width = Application.GetRealWidth(80), |
| | | Height = Application.GetRealHeight(20), |
| | | TextSize = TextSize.text14, |
| | | TextColor = CSS.CSS_Color.textColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = "1" + Language.StringByID(StringId.ge), |
| | | IsBold = true, |
| | | }; |
| | | pirDeviceFLayout.AddChidren(currDeviceNumberControlBtn); |
| | | //已添加遥控器 |
| | | Button currDeviceNumberControlTextBtn = new Button |
| | | { |
| | | Y = currDeviceNumberControlBtn.Bottom + Application.GetRealHeight(4), |
| | | X = Application.GetRealWidth(198), |
| | | Width = Application.GetRealWidth(80), |
| | | Height = Application.GetRealHeight(14), |
| | | TextSize = TextSize.text10, |
| | | TextColor = CSS.CSS_Color.textCancelColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextID = StringId.yitianjiayaokongqi, |
| | | }; |
| | | pirDeviceFLayout.AddChidren(currDeviceNumberControlTextBtn); |
| | | ///红外宝点击事件 |
| | | FrameLayout clickFLayout = new FrameLayout(); |
| | | pirDeviceFLayout.AddChidren(clickFLayout); |
| | | |
| | | |
| | | View.MainView mainView = new View.MainView(); |
| | | mainView.Show(middFLayout); |
| | | FrameLayout deviceListFLayout = new FrameLayout(); |
| | | deviceListFLayout.Y = pirDeviceFLayout.Bottom + Application.GetRealHeight(12); |
| | | deviceListFLayout.Y = mainView.pirDeviceFLayout.Bottom + Application.GetRealHeight(12); |
| | | deviceListFLayout.X = Application.GetRealWidth(16); |
| | | deviceListFLayout.Width = Application.GetRealWidth(343); |
| | | deviceListFLayout.Height = Application.GetRealHeight(328); |
| | |
| | | Text = "mini智能遥控器", |
| | | }; |
| | | deviceListFLayout.AddChidren(deviceNameBtn); |
| | | if (Pir.pirDeviceList.Count != 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; |
| | | numberDeviceBtn.Text = Pir.pirDeviceList.Count.ToString() + Language.StringByID(StringId.ge); |
| | | currDeviceNumberControlBtn.Text = sum.ToString() + Language.StringByID(StringId.ge); |
| | | } |
| | | |
| | | //下拉图标 |
| | | var dropdownIconBtn = new Button |
| | |
| | | UnSelectedImagePath = "PirIcon/dropdown.png", |
| | | }; |
| | | deviceListFLayout.AddChidren(dropdownIconBtn); |
| | | #endregion |
| | | |
| | | deviceNameBtn.MouseUpEventHandler += (sender, e) => |
| | | if (Pir.pirDeviceList.Count != 0) |
| | | { |
| | | |
| | | #region 区域弹框界面 |
| | | FrameLayout fLayout = new FrameLayout |
| | | { |
| | | BackgroundColor = CSS.CSS_Color.viewTrans60lucence, |
| | | }; |
| | | this.AddChidren(fLayout); |
| | | fLayout.MouseUpEventHandler += (sender1, e1) => |
| | | { |
| | | fLayout.RemoveFromParent(); |
| | | }; |
| | | |
| | | FrameLayout iconFLyout = new FrameLayout |
| | | { |
| | | X = Application.GetRealWidth(205), |
| | | Y = Application.GetRealHeight(314), |
| | | Width = Application.GetRealWidth(160), |
| | | Height = Application.GetRealHeight(21 + 44), |
| | | //BackgroundImagePath = "LogicIcon/bjicon.png", |
| | | }; |
| | | fLayout.AddChidren(iconFLyout); |
| | | |
| | | FrameLayout textFLyout = new FrameLayout |
| | | { |
| | | X = Application.GetRealWidth(8), |
| | | Y = Application.GetRealHeight(14), |
| | | Width = Application.GetRealWidth(144), |
| | | Height = Application.GetRealHeight(44), |
| | | }; |
| | | VerticalScrolViewLayout vv = new VerticalScrolViewLayout |
| | | { |
| | | X = Application.GetRealWidth(8), |
| | | Y = Application.GetRealHeight(14), |
| | | Width = Application.GetRealWidth(144), |
| | | Height = Application.GetRealHeight(44 * 4), |
| | | }; |
| | | |
| | | if (Pir.pirDeviceList.Count > 4) |
| | | { |
| | | iconFLyout.Height = Application.GetRealHeight(21 + 44 * 4); |
| | | iconFLyout.AddChidren(vv); |
| | | iconFLyout.BackgroundImagePath = "PirIcon/4.png"; |
| | | } |
| | | else |
| | | { |
| | | |
| | | iconFLyout.AddChidren(textFLyout); |
| | | iconFLyout.Height = Application.GetRealHeight(21 + 44 * Pir.pirDeviceList.Count); |
| | | textFLyout.Height = Application.GetRealHeight(44 * Pir.pirDeviceList.Count); |
| | | iconFLyout.BackgroundImagePath = $"PirIcon/{Pir.pirDeviceList.Count}.png"; |
| | | } |
| | | #endregion |
| | | |
| | | //默认第一个红外宝 |
| | | Pir.currPir = Pir.pirDeviceList[0]; |
| | | int sum = 0; |
| | | for (int i = 0; i < Pir.pirDeviceList.Count; i++) |
| | | { |
| | | var pirJson = Pir.pirDeviceList[i]; |
| | | View.PirNameView pirNameView = new View.PirNameView(); |
| | | if (Pir.pirDeviceList.Count > 4) |
| | | { |
| | | vv.AddChidren(pirNameView.FLayoutView()); |
| | | } |
| | | else |
| | | { |
| | | pirNameView.frameLayout.Y = Application.GetRealHeight(i * 44); |
| | | textFLyout.AddChidren(pirNameView.FLayoutView()); |
| | | } |
| | | pirNameView.btnName.Text = pirJson.name; |
| | | pirNameView.btnClick.Tag = pirJson; |
| | | pirNameView.btnClick.MouseUpEventHandler += (sender2, e2) => |
| | | { |
| | | fLayout.RemoveFromParent(); |
| | | deviceNameBtn.Text = pirJson.name; |
| | | Pir.currPir = pirJson; |
| | | |
| | | }; |
| | | if (Pir.pirDeviceList.Count - 1 == i) |
| | | { |
| | | ///改变最后那条一个线的颜色,界面显示效果作用; |
| | | pirNameView.btnLine.BackgroundColor = CSS.CSS_Color.view; |
| | | } |
| | | //查找 |
| | | sum += Pir.pirDeviceList[i].FunctioList.Count; |
| | | } |
| | | |
| | | }; |
| | | /// |
| | | clickFLayout.MouseUpEventHandler += (sender, e) => |
| | | 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); |
| | | } |
| | | ///设备管理的点击事件 |
| | | mainView.clickBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | |
| | | DeviceSet deviceSet = new DeviceSet(); |
| | |
| | | if (Pir.currPir != null) |
| | | { |
| | | deviceNameBtn.Text = Pir.currPir.name; |
| | | deviceNameBtn.Text = Pir.pirDeviceList[0].name; |
| | | numberDeviceBtn.Text = Pir.pirDeviceList.Count.ToString() + Language.StringByID(StringId.ge); |
| | | 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; |
| | | } |
| | | currDeviceNumberControlBtn.Text = sum.ToString() + Language.StringByID(StringId.ge); |
| | | mainView.currDeviceNumberControlBtn.Text = sum.ToString() + Language.StringByID(StringId.ge); |
| | | |
| | | |
| | | }); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | #endregion |
| | | ///红外名称的点击事件 |
| | | deviceNameBtn.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | View.HeigthChangeView heigthChangeView = new View.HeigthChangeView(); |
| | | heigthChangeView.Show(this, Pir.pirDeviceList, (pirJson) => |
| | | { |
| | | deviceNameBtn.Text = pirJson.name; |
| | | Pir.currPir = pirJson; |
| | | }); |
| | | }; |
| | | |
| | | int line = 0; |
| | | for (int i = 1, j = 0; i <= 7; i++, j++) |
| | | { |
| | |
| | | { |
| | | if (DeviceTypeList.Count == 0) |
| | | { |
| | | GetDeviceTypeList(true,() => |
| | | { |
| | | DeviceTypeViewClick(if_value); |
| | | GetDeviceTypeList(true, () => |
| | | { |
| | | DeviceTypeViewClick(if_value); |
| | | |
| | | }); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | |
| | | } |
| | | }; |
| | | } |
| | | GetDeviceTypeList(false,() => { }); |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 设备进入下一级方法 |
| | | /// </summary> |
| | | /// <param name="if_value"></param> |
| | | void DeviceTypeViewClick(int if_value) { |
| | | private void DeviceTypeViewClick(int if_value) |
| | | { |
| | | var strings = GetTypeString(if_value).Split('-'); |
| | | var jobDeviceType = DeviceTypeList.Find((c) => c.deviceType == strings[0]); |
| | | if (jobDeviceType == null) |
| | |
| | | /// </summary> |
| | | /// <param name="tag">标识要不要提示(true=提示)</param> |
| | | /// <param name="action">回调函数</param> |
| | | private void GetDeviceTypeList(bool tag,Action action) |
| | | public void GetDeviceTypeList(bool tag, Action action) |
| | | { |
| | | PirSend.GetDeviceTypesList(this, (responsePackNew) => |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | if (tag) { |
| | | if (tag) |
| | | { |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew,""); |
| | | method.ErrorShow(responsePackNew, ""); |
| | | } |
| | | } |
| | | }, "", "设备类型列表"); |
| | |
| | | /// <summary> |
| | | /// 读取红外设备类型的品牌列表 |
| | | /// </summary> |
| | | private void GetBrandList(string id, Action<List<Brand>> actionBrand) |
| | | public void GetBrandList(string id, Action<List<Brand>> actionBrand) |
| | | { |
| | | List<Brand> brandList = new List<Brand>(); |
| | | PirSend.GetDeviceTypesList(this, (responsePackNew) => |
| | |
| | | else |
| | | { |
| | | Method method = new Method(); |
| | | method.ErrorShow(responsePackNew,""); |
| | | method.ErrorShow(responsePackNew, ""); |
| | | } |
| | | }, id, "品牌列表"); |
| | | } |