using System; using Shared; using Shared.Common; using Shared.R; using ZigBee.Device; namespace Shared.Phone.Device.Logic { public class Nightlight : FrameLayout { public Nightlight() { Tag = "Logic"; } public void Show() { this.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor; TopView view = new TopView(); this.AddChidren(view.TopRowView()); view.toptitleNameBtn.Text = Name; view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); }; var middle = new FrameLayout { Y = view.topRowLayout.Bottom, Height = Application.GetRealHeight(Method.H - 184), BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor, }; this.AddChidren(middle); LogicView.LightView openView = new LogicView.LightView(); openView.titleBtn.Text = "夜灯开关"; middle.AddChidren(openView.Show()); openView.clickviewBtn.MouseUpEventHandler += (sender, e) => { CurrentDeviceView("夜灯开关",new CommonDevice { },true, ""); }; LogicView.LightView brightnessView = new LogicView.LightView(); brightnessView.frameLayout.Y = openView.frameLayout.Bottom; brightnessView.titleBtn.Text = "亮度"; middle.AddChidren(brightnessView.Show()); brightnessView.clickviewBtn.MouseUpEventHandler += (sender, e) => { CurrentDeviceView("亮度", new CommonDevice { }, true, ""); }; LogicView.LightView colorTemperatureView = new LogicView.LightView(); colorTemperatureView.frameLayout.Y = brightnessView.frameLayout.Bottom; colorTemperatureView.titleBtn.Text = "色温"; middle.AddChidren(colorTemperatureView.Show()); colorTemperatureView.clickviewBtn.MouseUpEventHandler += (sender, e) => { CurrentDeviceView("色温", new CommonDevice { }, true, ""); }; LogicView.LightView buzzView = new LogicView.LightView(); buzzView.frameLayout.Y = colorTemperatureView.frameLayout.Bottom; buzzView.titleBtn.Text = "蜂鸣器"; middle.AddChidren(buzzView.Show()); buzzView.clickviewBtn.MouseUpEventHandler += (sender, e) => { CurrentDeviceView("蜂鸣器", new CommonDevice { }, true, ""); }; } public void CurrentDeviceView(string if_str, CommonDevice common, bool edit, string str) { var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor }; this.AddChidren(flMain); UserView.HomePage.Instance.ScrollEnabled = false;//不让当前界面滑动 CompleteView completeView = new CompleteView(); flMain.AddChidren(completeView.Show(2)); completeView.Btntitle.Text = LocalDevice.Current.GetDeviceEpointName(common); EventHandler clickcancel = (sender, e) => { UserView.HomePage.Instance.ScrollEnabled = true; flMain.RemoveFromParent(); }; flMain.MouseUpEventHandler += clickcancel; completeView.Btncancel.MouseUpEventHandler += clickcancel; switch (if_str) { case "夜灯开关": { mFunView openView = new mFunView(); openView.frameLayout.Y = Application.GetRealHeight(140 + 20); openView.titleBtn.TextID = MyInternationalizationString.open; completeView.Show(2).AddChidren(openView.Show()); mFunView closeView = new mFunView(); closeView.frameLayout.Y = Application.GetRealHeight(140 + 20 + 160); closeView.titleBtn.TextID = MyInternationalizationString.close; completeView.Show(2).AddChidren(closeView.Show()); closeView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; ///点击确认事件 openView.clickviewBtn.MouseUpEventHandler += (sender, e) => { openView.selectedIconBtn.Visible = true; closeView.selectedIconBtn.Visible = false; openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; }; ///点击取消事件 closeView.clickviewBtn.MouseUpEventHandler += (sender, e) => { openView.selectedIconBtn.Visible = false; closeView.selectedIconBtn.Visible = true; openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; }; } break; case "亮度": { var horizontalSeekBarVol = new DiyImageSeekBar { Y = Application.GetRealHeight(140), X = Application.GetRealWidth(78), Width = Application.GetRealWidth(918), Height = Application.GetRealHeight(320),//滑动条父控件高度 IsProgressTextShow = true,//显示百分比 IsClickable = true,//进度条是否滑动 ProgressBarColor = ZigbeeColor.Current.LogicProgressColorSelected,//选中进度条颜色 ThumbImagePath = "ZigeeLogic/progressbtn2.png",//进度条按钮图标 ThumbImageHeight = Application.GetRealHeight(89),//进度条按钮图标的高度(默认正方形:宽和高一样) ProgressTextColor = ZigbeeColor.Current.LogicBtnCancelColor, ProgressTextSize = 9,//显示百分比字体大小12 SeekBarViewHeight = Application.GetRealHeight(6),//进度条的高度10 }; completeView.Show(2).AddChidren(horizontalSeekBarVol); } break; case "色温": { Button titleBtn = new Button { Y = Application.GetRealHeight(140+154), X = Application.GetRealWidth(78), Height = Application.GetRealHeight(12), Width = Application.GetRealWidth(918), //TextID = MyInternationalizationString.logicathomegarrison, TextAlignment = TextAlignment.CenterLeft, TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor, TextSize = 14, UnSelectedImagePath= "ZigeeLogic/seek.png", }; completeView.Show(2).AddChidren(titleBtn); var horizontalSeekBarVol = new DiyImageSeekBar { Y = Application.GetRealHeight(140), X = Application.GetRealWidth(78), Width = Application.GetRealWidth(918), Height = Application.GetRealHeight(320),//滑动条父控件高度 IsProgressTextShow = true,//显示百分比 IsClickable = true,//进度条是否滑动 ProgressBarColor = 0x00000000,// ZigbeeColor.Current.LogicProgressColorSelected,//选中进度条颜色 SeekBarBackgroundColor= 0x00000000, ThumbImagePath = "ZigeeLogic/progressbtn2.png",//进度条按钮图标 ThumbImageHeight = Application.GetRealHeight(89),//进度条按钮图标的高度(默认正方形:宽和高一样) ProgressTextColor = ZigbeeColor.Current.LogicBtnCancelColor, ProgressTextSize = 9,//显示百分比字体大小12 SeekBarViewHeight = Application.GetRealHeight(12),//进度条的高度10 }; completeView.Show(2).AddChidren(horizontalSeekBarVol); } break; case "蜂鸣器": { mFunView openView = new mFunView(); openView.frameLayout.Y = Application.GetRealHeight(140 + 20); openView.titleBtn.TextID = MyInternationalizationString.open; completeView.Show(2).AddChidren(openView.Show()); mFunView closeView = new mFunView(); closeView.frameLayout.Y = Application.GetRealHeight(140 + 20 + 160); closeView.titleBtn.TextID = MyInternationalizationString.close; completeView.Show(2).AddChidren(closeView.Show()); closeView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor; ///点击确认事件 openView.clickviewBtn.MouseUpEventHandler += (sender, e) => { openView.selectedIconBtn.Visible = true; closeView.selectedIconBtn.Visible = false; openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; }; ///点击取消事件 closeView.clickviewBtn.MouseUpEventHandler += (sender, e) => { openView.selectedIconBtn.Visible = false; closeView.selectedIconBtn.Visible = true; openView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor; closeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor; }; } break; } } } }