New file |
| | |
| | | using 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),//进度条X坐标 |
| | | 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(() => { }); |
| | | }; |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | } |