From f71e74b5f0d2716fbf05da016cdaa18d64e09f80 Mon Sep 17 00:00:00 2001 From: xm <1271024303@qq.com> Date: 星期四, 31 十二月 2020 17:01:18 +0800 Subject: [PATCH] 又换完成最新门锁。空气质量传感器完成数据和基本配置功能。开发图表和自动化的同事可下载此代码 --- ZigbeeApp/Shared/Phone/Device/Logic/Illumination.cs | 228 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 228 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Illumination.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Illumination.cs new file mode 100755 index 0000000..3990419 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/Device/Logic/Illumination.cs @@ -0,0 +1,228 @@ +锘縰sing System; +using System.Collections.Generic; +using Shared.Common; +using Shared.R; + +namespace Shared.Phone.Device.Logic +{ + public class Illumination : FrameLayout + { + public Illumination() + { + Tag = "Logic"; + } + + public void Show(ZigBee.Device.CommonDevice common,string name,int progresValue,bool _bool) + { + this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; + TopView view = new TopView(); + this.AddChidren(view.TopRowView()); + view.toptitleNameBtn.Text = name; + view.clickBtn.MouseDownEventHandler += (sender, e) => + { + RemoveFromParent(); + }; + FrameLayout middle= new FrameLayout + { + Y = view.topRowLayout.Bottom, + Height = Application.GetRealHeight(Method.H - 184), + BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, + }; + this.AddChidren(middle); + //鐧借壊蹇埗鎺т欢 + FrameLayout blankFraLayout = new FrameLayout + { + Height = Application.GetRealHeight(616), + BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor, + }; + middle.AddChidren(blankFraLayout); + //鐓у害鍊兼帶浠� + Button illuminationBtn = new Button + { + X = Application.GetRealWidth(58), + Y = Application.GetRealHeight(259 - 184), + Height = Application.GetRealHeight(50), + Width = Application.GetRealWidth(300), + Text =Language.StringByID(MyInternationalizationString.illuminanceValue)+ progresValue+"lux", + //TextID = MyInternationalizationString.Save, + TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + TextSize = 12, + TextAlignment=TextAlignment.CenterLeft, + }; + blankFraLayout.AddChidren(illuminationBtn); + //-鍥炬爣鎺т欢 + Button lessBtn = new Button + { + X = Application.GetRealWidth(847), + Y = Application.GetRealHeight(46), + Height = Application.GetMinRealAverage(104), + Width = Application.GetMinRealAverage(104), + UnSelectedImagePath = "ZigeeLogic/lesLuminositys.png", + }; + blankFraLayout.AddChidren(lessBtn); + //+鍥炬爣鎺т欢 + Button addBtn = new Button + { + X = lessBtn.Right, + Y = Application.GetRealHeight(46), + Height = Application.GetMinRealAverage(104), + Width = Application.GetMinRealAverage(104), + UnSelectedImagePath = "ZigeeLogic/addLuminosity.png", + }; + blankFraLayout.AddChidren(addBtn); + //杩涘害鏉℃帶浠� + var horizontalSeekBarVol = new DiyImageSeekBar + { + Y = Application.GetRealHeight(173),//杩涘害鏉$埗鎺т欢Y鍧愭爣 + X = Application.GetRealWidth(104-20),//杩涘害鏉鍧愭爣 + Width = Application.GetRealWidth(873+40),//杩涘害鏉$殑闀垮害 + Height = Application.GetRealHeight(56),//杩涘害鏉$埗鎺т欢楂樺害 + IsProgressTextShow = false,//鏄剧ず鐧惧垎姣� + IsClickable = true,//杩涘害鏉℃槸鍚︽粦鍔� + ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected,//閫変腑杩涘害鏉¢鑹� + SeekBarBackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,//杩涘害鏉¢鑹� + ThumbImagePath = "ZigeeLogic/progressbtn2.png",//杩涘害鏉℃寜閽浘鏍� + ThumbImageHeight = Application.GetRealHeight(56),//杩涘害鏉℃寜閽浘鏍囩殑楂樺害锛堥粯璁ゆ鏂瑰舰锛氬鍜岄珮涓�鏍凤級 + ProgressTextColor = ZigbeeColor.Current.LogicBtnCancelColor, + //ProgressTextSize = 9,//鏄剧ず鐧惧垎姣斿瓧浣撳ぇ灏�12 + SeekBarViewHeight = Application.GetRealHeight(7),//杩涘害鏉$殑楂樺害10 + MaxValue = 100, + MinValue = 0, + Progress = progresValue, + }; + blankFraLayout.AddChidren(horizontalSeekBarVol); + lessBtn.MouseUpEventHandler += (sender, e) => + { + horizontalSeekBarVol.Progress = horizontalSeekBarVol.Progress - 1; + illuminationBtn.Text = Language.StringByID(MyInternationalizationString.illuminanceValue) + horizontalSeekBarVol.Progress.ToString() + "lux"; + }; + addBtn.MouseUpEventHandler += (sender, e) => + { + horizontalSeekBarVol.Progress = horizontalSeekBarVol.Progress + 1; + illuminationBtn.Text = Language.StringByID(MyInternationalizationString.illuminanceValue) + horizontalSeekBarVol.Progress.ToString() + "lux"; + }; + EventHandler<int> progressclick = (sender, e) => + { + illuminationBtn.Text = Language.StringByID(MyInternationalizationString.illuminanceValue) + horizontalSeekBarVol.Progress.ToString() + "lux"; + }; + horizontalSeekBarVol.OnProgressChangedEvent += progressclick; + horizontalSeekBarVol.OnStopTrackingTouchEvent += progressclick; + + Button text1Btn = new Button() + { + X = Application.GetRealWidth(95), + Y = Application.GetRealHeight(426 - 184), + Height = Application.GetRealHeight(50), + Width = Application.GetRealWidth(100), + Text = Language.StringByID(MyInternationalizationString.dark), + TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, + TextSize = 12, + TextAlignment = TextAlignment.CenterLeft, + }; + blankFraLayout.AddChidren(text1Btn); + + Button text0Btn = new Button() + { + X = Application.GetRealWidth(81), + Y = text1Btn.Bottom, + Height = Application.GetRealHeight(50), + Width = Application.GetRealWidth(100), + Text = "0lux", + TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, + TextSize = 12, + TextAlignment = TextAlignment.CenterLeft, + }; + blankFraLayout.AddChidren(text0Btn); + + Button text2Btn = new Button() + { + X = Application.GetRealWidth(950), + Y = Application.GetRealHeight(426 - 184), + Height = Application.GetRealHeight(50), + Width = Application.GetRealWidth(100), + Text = Language.StringByID(MyInternationalizationString.bright), + TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, + TextSize = 12, + TextAlignment = TextAlignment.CenterLeft, + + }; + blankFraLayout.AddChidren(text2Btn); + + Button text100Btn = new Button() + { + X = Application.GetRealWidth(913), + Y = text2Btn.Bottom, + Height = Application.GetRealHeight(50), + Width = Application.GetRealWidth(109+17), + Text = "100lux", + TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, + TextSize = 12, + TextAlignment = TextAlignment.CenterLeft, + }; + blankFraLayout.AddChidren(text100Btn); + + //鎻愮ず鍥炬爣 + Button tipIconBtn = new Button + { + X = Application.GetRealWidth(109), + Y = Application.GetRealHeight(616 - 184), + Height = Application.GetMinRealAverage(58), + Width = Application.GetMinRealAverage(58), + UnSelectedImagePath = "ZigeeLogic/tipIcon.png", + }; + blankFraLayout.AddChidren(tipIconBtn); + + //鎻愮ず鏂囧瓧 + Button tipTextBtn = new Button() + { + X = Application.GetRealWidth(173), + Y = Application.GetRealHeight(616 - 184), + Height = Application.GetRealHeight(138), + Width = Application.GetRealWidth(818), + Text = Language.StringByID(MyInternationalizationString.tipIlluminanceValue).Replace("{\\r\\n}", "\r\n"), + TextColor = ZigbeeColor.Current.LogicBtnCancelColor, + TextSize = 12, + TextAlignment = TextAlignment.Center, + IsMoreLines = true, + + }; + blankFraLayout.AddChidren(tipTextBtn); + + //淇濆瓨鎺т欢 + LogicView.SaveView saveView = new LogicView.SaveView(); + saveView.frameLayout.Y = middle.Height - Application.GetRealHeight(260); + middle.AddChidren(saveView.Show()); + saveView.clickviewBtn.MouseUpEventHandler += (sender, e) => + { + var deviceConditionsInfo = new Dictionary<string, string>(); + deviceConditionsInfo.Add("Type", "1"); + deviceConditionsInfo.Add("IsValid", "1"); + deviceConditionsInfo.Add("MacAddr", common.DeviceAddr); + deviceConditionsInfo.Add("Epoint", common.DeviceEpoint.ToString()); + deviceConditionsInfo.Add("Cluster_ID", "1024"); + deviceConditionsInfo.Add("AttriButeId", "0"); + deviceConditionsInfo.Add("AttriButeData1", horizontalSeekBarVol.Progress.ToString()); + deviceConditionsInfo.Add("AttriButeData2", "0"); + deviceConditionsInfo.Add("Range", "7"); + if (_bool && progresValue != horizontalSeekBarVol.Progress) + { + + LogicIfon.AddDeviceconditions(common, deviceConditionsInfo); + } + if (!_bool) + { + //涓嶆槸缂栬緫杩涙潵鐨�; + LogicIfon.AddDeviceconditions(common, deviceConditionsInfo); + } + var logicCommunalPage = new LogicCommunalPage(); + UserView.HomePage.Instance.AddChidren(logicCommunalPage); + UserView.HomePage.Instance.PageIndex += 1; + logicCommunalPage.Show(() => { }); + }; + + + } + + + } +} -- Gitblit v1.8.0