//using System; //using System.Collections.Generic; //namespace Shared.SimpleControl.Phone //{ // public class UserSensorAutomationDeviceSetPage : FrameLayout // { // byte [] curSetBytes; // SensorAutomation sensorAutomation; // Action action; // public UserSensorAutomationDeviceSetPage (SensorAutomation sa, Action ac) // { // curSetBytes = new byte [10]; // sensorAutomation = sa; // action = ac; // } // /// // /// 加载手机上的设备列表,配置自动化界面 // /// // public void ShowPage (string slelctedType) // { // FrameLayout bodyView = new FrameLayout () { // BackgroundColor = SkinStyle.Current.ViewColor, // }; // AddChidren (bodyView); // #region 标题 // var topView = new FrameLayout () { // Y = Application.GetRealHeight (36), // Height = Application.GetRealHeight (90), // BackgroundColor = SkinStyle.Current.MainColor // }; // bodyView.AddChidren (topView); // var title = new Button () { // TextAlignment = TextAlignment.Center, // TextID = R.MyInternationalizationString.TargetSetting, // TextColor = SkinStyle.Current.TextColor1, // TextSize = 19, // }; // topView.AddChidren (title); // var logo = new Button () { // Width = Application.GetRealWidth (154), // Height = Application.GetRealHeight (90), // X = Application.GetRealWidth (486), // UnSelectedImagePath = MainPage.LogoString, // }; // topView.AddChidren (logo); // var back = new Button () { // Height = Application.GetRealHeight (90), // Width = Application.GetRealWidth (85), // UnSelectedImagePath = "Item/Back.png", // SelectedImagePath = "Item/BackSelected.png", // }; // topView.AddChidren (back); // back.MouseUpEventHandler += (sender, e) => { // (Parent as PageLayout).PageIndex -= 1; // }; // #endregion // Button btnTipChooseType = new Button () { // X = Application.GetRealWidth(60), // Y = topView.Bottom, // BackgroundColor = SkinStyle.Current.ViewColor, // TextAlignment = TextAlignment.CenterLeft, // Height =Application.GetRealHeight(100), // TextID = R.MyInternationalizationString.PlsSelectDevice, // TextSize = 16, // TextColor = SkinStyle.Current.TextColor1, // }; // bodyView.AddChidren (btnTipChooseType); // var deviceScrolView = new VerticalScrolViewLayout () { // Y = btnTipChooseType.Bottom, // Height = Application.GetRealHeight (Application.DesignHeight - 126 - 100), // BackgroundColor = SkinStyle.Current.MainColor, // }; // bodyView.AddChidren (deviceScrolView); // InitDevcies (slelctedType, deviceScrolView); // } // void SaveAutomationData() // { // sensorAutomation.TargetBytesList.Add (curSetBytes); // action (sensorAutomation); // (Parent as PageLayout).PageIndex -= 2; // } // void InitDevcieSetView (Button btn, Common device ) // { // var controlBLL = new ScenePhoneMethod (); // if (device.Type == DeviceType.LightSwitch || device.Type == DeviceType.LightMixSwitch || device.Type == DeviceType.LightEnergySwitch || device.Type == DeviceType.LightMixDimming || device.Type == DeviceType.CurtainModel) { // device.obj1 = 89; // if (device.Type == DeviceType.CurtainModel) { // device.obj1 = 92; // } // btn.MouseUpEventHandler += (ddd, fff) => { // Dialog setTargetDialog = new Dialog (); // FrameLayout setTargetView = new FrameLayout () { // Gravity = Gravity.Center, // Width = Application.GetRealWidth (500), // Height = Application.GetRealHeight (300), // BackgroundColor = SkinStyle.Current.DialogColor, // BorderColor = SkinStyle.Current.Transparent, // BorderWidth = 0, // Radius = 1, // }; // setTargetDialog.AddChidren (setTargetView); // Button btnSetClose = new Button () { // X = Application.GetRealWidth (50), // Y = Application.GetRealHeight (50), // Width = Application.GetRealHeight (200), // Height = Application.GetRealHeight (110), // TextID = R.MyInternationalizationString.Close, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.SelectedColor, // TextAlignment = TextAlignment.Center, // BackgroundColor = SkinStyle.Current.ButtonColor, // BorderColor = SkinStyle.Current.BorderColor, // BorderWidth = 1, // Radius = 1, // }; // setTargetView.AddChidren (btnSetClose); // Button btnSetOpen = new Button () { // X = btnSetClose.Right, // Y = btnSetClose.Y, // Width = btnSetClose.Width, // Height = btnSetClose.Height, // TextID = R.MyInternationalizationString.Open, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.SelectedColor, // TextAlignment = TextAlignment.Center, // BackgroundColor = SkinStyle.Current.ButtonColor, // BorderColor = SkinStyle.Current.BorderColor, // BorderWidth = 1, // Radius = 1, // }; // setTargetView.AddChidren (btnSetOpen); // if (curSetBytes [4] == device.SubnetID && curSetBytes [5] == device.DeviceID && curSetBytes [6] == device.LoopID) { // if (curSetBytes [7] == 0) { // btnSetClose.IsSelected = true; // btnSetClose.BorderColor = SkinStyle.Current.SelectedColor; // } // } else { // btnSetClose.IsSelected = true; // btnSetClose.BorderColor = SkinStyle.Current.SelectedColor; // } // btnSetClose.MouseUpEventHandler += (asdf, fda) => { // btnSetClose.IsSelected = true; // btnSetClose.BorderColor = SkinStyle.Current.SelectedColor; // btnSetOpen.IsSelected = false; // btnSetOpen.BorderColor = SkinStyle.Current.BorderColor; // MainPage.Loading.Start (""); // System.Threading.Tasks.Task.Run (() => { // device.obj2 = device.LoopID; // device.obj3 = 0; // device.obj4 = 0; // device.obj5 = 0; // controlBLL.ControlBusSceneDevice (device); // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // }); // }; // btnSetOpen.MouseUpEventHandler += (asdf, fda) => { // btnSetOpen.IsSelected = true; // btnSetOpen.BorderColor = SkinStyle.Current.SelectedColor; // btnSetClose.IsSelected = false; // btnSetClose.BorderColor = SkinStyle.Current.BorderColor; // System.Threading.Tasks.Task.Run (() => { // device.obj2 = device.LoopID; // device.obj3 = 100; // if (device.Type == DeviceType.CurtainModel) { // device.obj3 = 1; // } // device.obj4 = 0; // device.obj5 = 0; // controlBLL.ControlBusSceneDevice (device); // Application.RunOnMainThread (() => { // MainPage.Loading.Hide (); // }); // }); // }; // Button btnCloseThis = new Button () { // Width = Application.GetRealWidth (250), // Height = Application.GetRealHeight (100), // Y = Application.GetRealHeight (202), // BackgroundColor = SkinStyle.Current.DialogTitle, // TextID = R.MyInternationalizationString.cancel, // TextAlignment = TextAlignment.Center, // }; // setTargetView.AddChidren (btnCloseThis); // btnCloseThis.MouseUpEventHandler += (kkk, lll) => { // setTargetDialog.Close (); // }; // Button btnSaveThis = new Button () { // X = btnCloseThis.Right + 1, // Y = btnCloseThis.Y, // Width = Application.GetRealWidth (250), // Height = Application.GetRealHeight (100), // BackgroundColor = SkinStyle.Current.DialogTitle, // TextID = R.MyInternationalizationString.Confrim, // TextAlignment = TextAlignment.Center, // }; // setTargetView.AddChidren (btnSaveThis); // btnSaveThis.MouseUpEventHandler += (sss, dddd) => { // curSetBytes [3] = 89; // curSetBytes [4] = device.SubnetID; // curSetBytes [5] = device.DeviceID; // curSetBytes [6] = device.LoopID; // curSetBytes [7] = device.obj3; // curSetBytes [8] = 0; // curSetBytes [9] = 0; // setTargetDialog.Close (); // SaveAutomationData (); // }; // setTargetDialog.Show (); // }; // } // if (device.Type == DeviceType.HVAC || device.Type == DeviceType.ACPanel || device.Type == DeviceType.ACInfrared) { // device.obj1 = 95; // btn.MouseUpEventHandler += (lkj, jkl) => { // var acBLL = new ACMethod (); // device.obj1 = 95; // Dialog setTargetDialog = new Dialog (); // FrameLayout setTargetView = new FrameLayout () { // Gravity = Gravity.Center, // Width = Application.GetRealWidth (500), // Height = Application.GetRealHeight (600), // BackgroundColor = SkinStyle.Current.DialogColor, // }; // setTargetDialog.AddChidren (setTargetView); // Button btnTitle = new Button () { // Height = Application.GetRealHeight (90), // BackgroundColor = SkinStyle.Current.DialogTitle, // TextColor = SkinStyle.Current.DialogTextColor, // TextAlignment = TextAlignment.Center, // TextID = R.MyInternationalizationString.Setting, // }; // setTargetView.AddChidren (btnTitle); // var horizontalScrolView = new HorizontalScrolViewLayout () { // Y = btnTitle.Bottom, // Height = Application.GetRealWidth (100), // ScrollEnabled = false, // }; // setTargetView.AddChidren (horizontalScrolView); // Button btnChoosePower = new Button () { // Width = Application.GetRealWidth (125), // TextAlignment = TextAlignment.Center, // TextID = R.MyInternationalizationString.Power, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.TextColor1, // BackgroundColor = SkinStyle.Current.SysTitleView, // SelectedBackgroundColor = SkinStyle.Current.SelectedColor, // BorderColor = SkinStyle.Current.DialogTitle, // BorderWidth = 1, // Radius = 1, // }; // horizontalScrolView.AddChidren (btnChoosePower); // Button btnChooseModule = new Button () { // Width = Application.GetRealWidth (125), // TextAlignment = TextAlignment.Center, // TextID = R.MyInternationalizationString.Mode, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.TextColor1, // BackgroundColor = SkinStyle.Current.SysTitleView, // SelectedBackgroundColor = SkinStyle.Current.SelectedColor, // BorderColor = SkinStyle.Current.SelectedColor, // BorderWidth = 1, // Radius = 1, // IsSelected = true // }; // horizontalScrolView.AddChidren (btnChooseModule); // Button btnChooseTemp = new Button () { // Width = Application.GetRealWidth (125), // TextAlignment = TextAlignment.Center, // TextID = R.MyInternationalizationString.Temp, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.TextColor1, // BackgroundColor = SkinStyle.Current.SysTitleView, // SelectedBackgroundColor = SkinStyle.Current.SelectedColor, // BorderColor = SkinStyle.Current.DialogTitle, // BorderWidth = 1, // Radius = 1, // }; // horizontalScrolView.AddChidren (btnChooseTemp); // Button btnChooseWind = new Button () { // Width = Application.GetRealWidth (125), // TextAlignment = TextAlignment.Center, // TextID = R.MyInternationalizationString.WindSpeed, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.TextColor1, // BackgroundColor = SkinStyle.Current.SysTitleView, // SelectedBackgroundColor = SkinStyle.Current.SelectedColor, // BorderColor = SkinStyle.Current.DialogTitle, // BorderWidth = 1, // Radius = 1, // }; // horizontalScrolView.AddChidren (btnChooseWind); // SelectType (btnChoosePower, btnChooseTemp, btnChooseWind, btnChoosePower, btnChooseModule); // FrameLayout functionView = new FrameLayout () { // Y = horizontalScrolView.Bottom, // Height = Application.GetRealHeight(400), // BackgroundColor = SkinStyle.Current.White20Transparent, // }; // setTargetView.AddChidren (functionView); // InitPowerFunctionView (functionView, device); // #region 功能按键点击方法 // #region 开关 // btnChoosePower.MouseUpEventHandler += (kkd, jjk) => { // SelectType (btnChoosePower, btnChooseTemp, btnChooseWind, btnChoosePower, btnChooseModule); // InitPowerFunctionView (functionView, device); // }; // #endregion // #region mode // btnChooseModule.MouseUpEventHandler += (kkd, jjk) => { // functionView.RemoveAll (); // SelectType (btnChooseModule, btnChooseTemp, btnChooseWind, btnChoosePower, btnChooseModule); // var btnModeText = new Button () { // Width = Application.GetRealWidth (200), // Height = Application.GetRealHeight (90), // TextID = R.MyInternationalizationString.Cool, // Y = Application.GetRealHeight(70), // Gravity = Gravity.CenterHorizontal, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.SelectedColor, // TextAlignment = TextAlignment.Center, // BackgroundColor = SkinStyle.Current.ButtonColor, // BorderColor = SkinStyle.Current.BorderColor, // BorderWidth = 1, // Radius = 1, // }; // functionView.AddChidren (btnModeText); // btnModeText.MouseUpEventHandler += (sender, e) => { // device.obj2 = 6; // device.obj3++; // if (device.obj3 > 4) // device.obj3 = 0; // acBLL.UpdataACHostModeIcon (device.obj3, null, btnModeText); // }; // }; // #endregion // #region temp // btnChooseTemp.MouseUpEventHandler += (kkd, jjk) => { // functionView.RemoveAll (); // device.obj2 = 4; // device.obj3 = 16; // int tempType = 0; // SelectType (btnChooseTemp, btnChooseTemp, btnChooseWind, btnChoosePower, btnChooseModule); // var btnSetTempText = new Button () { // Width = Application.GetRealWidth (200), // Height = Application.GetRealHeight (90), // TextID = R.MyInternationalizationString.Cool, // X = Application.GetRealWidth (50), // Y = Application.GetRealHeight (30), // TextColor = SkinStyle.Current.TextColor, // SelectedTextColor = SkinStyle.Current.SelectedColor, // TextAlignment = TextAlignment.CenterLeft, // Text = Language.StringByID (R.MyInternationalizationString.SetTemperature).Replace ("--", "16"), // }; // functionView.AddChidren (btnSetTempText); // var btnModeText = new Button () { // Width = Application.GetRealWidth (200), // Height = Application.GetRealHeight (90), // TextID = R.MyInternationalizationString.Cool, // Y = Application.GetRealHeight (30), // X = btnSetTempText.Right, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.SelectedColor, // TextAlignment = TextAlignment.Center, // BackgroundColor = SkinStyle.Current.ButtonColor, // BorderColor = SkinStyle.Current.BorderColor, // BorderWidth = 1, // Radius = 1, // }; // functionView.AddChidren (btnModeText); // var horizontalSeekBar = new HorizontalSeekBar () { // Width = Application.GetRealWidth (400), // Height = Application.GetRealHeight (80), // X = Application.GetRealWidth (50), // Y = btnSetTempText.Bottom + Application.GetRealHeight (30), // Tag = DateTime.MinValue, // ThumbColor = SkinStyle.Current.SelectedColor, // Max = 20 // }; // functionView.AddChidren (horizontalSeekBar); // horizontalSeekBar.ProgressChanged += (sender2, e4) => { // btnSetTempText.Text = Language.StringByID (R.MyInternationalizationString.SetTemperature).Replace ("--", (e4 + 16).ToString ()); // device.obj3 = (byte)(e4+16); // }; // btnModeText.MouseUpEventHandler += (sender, e) => { // tempType++; // if (tempType > 4) { // tempType = 0; // } // if (tempType == 2) { // tempType = 3; // } // switch (tempType) { // case 0: // device.obj2 = 4; // break; // case 1: // device.obj2 = 7; // break; // case 3: // device.obj2 = 8; // break; // case 4: // device.obj2 = 19; // break; // } // acBLL.UpdataACHostModeIcon ((byte)tempType, null, btnModeText); // }; // }; // #endregion // #region wind // btnChooseWind.MouseUpEventHandler += (kkd, jjk) => { // device.obj2 = 5; // functionView.RemoveAll (); // SelectType (btnChooseWind, btnChooseTemp, btnChooseWind, btnChoosePower, btnChooseModule); // var btnModeText = new Button () { // Width = Application.GetRealWidth (200), // Height = Application.GetRealHeight (90), // TextID = R.MyInternationalizationString.Auto, // Y = Application.GetRealHeight (70), // Gravity = Gravity.CenterHorizontal, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.SelectedColor, // TextAlignment = TextAlignment.Center, // BackgroundColor = SkinStyle.Current.ButtonColor, // BorderColor = SkinStyle.Current.BorderColor, // BorderWidth = 1, // Radius = 1, // }; // functionView.AddChidren (btnModeText); // btnModeText.MouseUpEventHandler += (sender, e) => { // device.obj3++; // if (device.obj3 > 3) // device.obj3 = 0; // acBLL.UpdataACHostWindIcon (device.obj3, null, btnModeText); // }; // }; // #endregion // #endregion // Button btnCloseThis = new Button () { // Width = Application.GetRealWidth (250), // Height = Application.GetRealHeight (100), // Y = Application.GetRealHeight (502), // BackgroundColor = SkinStyle.Current.DialogTitle, // TextID = R.MyInternationalizationString.cancel, // TextAlignment = TextAlignment.Center, // }; // setTargetView.AddChidren (btnCloseThis); // btnCloseThis.MouseUpEventHandler += (kkk, lll) => { // setTargetDialog.Close (); // }; // Button btnSaveThis = new Button () { // X = btnCloseThis.Right + 1, // Y = btnCloseThis.Y, // Width = Application.GetRealWidth (250), // Height = Application.GetRealHeight (100), // BackgroundColor = SkinStyle.Current.DialogTitle, // TextID = R.MyInternationalizationString.Confrim, // TextAlignment = TextAlignment.Center, // }; // setTargetView.AddChidren (btnSaveThis); // btnSaveThis.MouseUpEventHandler += (sss, dddd) => { // curSetBytes [3] = device.obj1; // curSetBytes [4] = device.SubnetID; // curSetBytes [5] = device.DeviceID; // curSetBytes [6] = device.obj2; // curSetBytes [7] = device.obj3; // curSetBytes [8] = device.LoopID; // curSetBytes [9] = 0; // setTargetDialog.Close (); // SaveAutomationData (); // }; // setTargetDialog.Show (); // }; // } // if (device.Type == DeviceType.FoolHeat || device.Type == DeviceType.FoolHeatPanel) { // device.obj1 = 95; // btn.MouseUpEventHandler += (lkj, jkl) => { // var acBLL = new ACMethod (); // device.obj1 = 95; // Dialog setTargetDialog = new Dialog (); // FrameLayout setTargetView = new FrameLayout () { // Gravity = Gravity.Center, // Width = Application.GetRealWidth (500), // Height = Application.GetRealHeight (600), // BackgroundColor = SkinStyle.Current.DialogColor, // }; // setTargetDialog.AddChidren (setTargetView); // Button btnTitle = new Button () { // Height = Application.GetRealHeight (90), // BackgroundColor = SkinStyle.Current.DialogTitle, // TextColor = SkinStyle.Current.DialogTextColor, // TextAlignment = TextAlignment.Center, // TextID = R.MyInternationalizationString.Setting, // }; // setTargetView.AddChidren (btnTitle); // var horizontalScrolView = new HorizontalScrolViewLayout () { // Y = btnTitle.Bottom, // Height = Application.GetRealWidth (110), // ScrollEnabled = false, // }; // setTargetView.AddChidren (horizontalScrolView); // Button btnChoosePower = new Button () { // Width = Application.GetRealWidth (166), // TextAlignment = TextAlignment.Center, // TextID = R.MyInternationalizationString.Power, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.TextColor1, // BackgroundColor = SkinStyle.Current.SysTitleView, // BorderColor = SkinStyle.Current.DialogTitle, // SelectedBackgroundColor = SkinStyle.Current.SelectedColor, // BorderWidth = 1, // Radius = 1, // }; // horizontalScrolView.AddChidren (btnChoosePower); // Button btnChooseModule = new Button () { // Width = Application.GetRealWidth (167), // TextAlignment = TextAlignment.Center, // TextID = R.MyInternationalizationString.Mode, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.TextColor1, // BackgroundColor = SkinStyle.Current.SysTitleView, // BorderColor = SkinStyle.Current.SelectedColor, // SelectedBackgroundColor = SkinStyle.Current.SelectedColor, // BorderWidth = 1, // Radius = 1, // IsSelected = true // }; // horizontalScrolView.AddChidren (btnChooseModule); // Button btnChooseTemp = new Button () { // Width = Application.GetRealWidth (169), // TextAlignment = TextAlignment.Center, // TextID = R.MyInternationalizationString.Temp, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.TextColor1, // BackgroundColor = SkinStyle.Current.SysTitleView, // BorderColor = SkinStyle.Current.DialogTitle, // SelectedBackgroundColor = SkinStyle.Current.SelectedColor, // BorderWidth = 1, // Radius = 1, // }; // horizontalScrolView.AddChidren (btnChooseTemp); // SelectType (btnChoosePower, btnChooseTemp, new Button(), btnChoosePower, btnChooseModule); // FrameLayout functionView = new FrameLayout () { // Y = horizontalScrolView.Bottom, // Height = Application.GetRealHeight (400), // BackgroundColor = SkinStyle.Current.White20Transparent, // }; // setTargetView.AddChidren (functionView); // InitPowerFunctionView (functionView, device); // #region 功能按键点击方法 // #region 开关 // btnChoosePower.MouseUpEventHandler += (kkd, jjk) => { // SelectType (btnChoosePower, btnChooseTemp, new Button (), btnChoosePower, btnChooseModule); // InitPowerFunctionView (functionView, device); // }; // #endregion // #region mode // btnChooseModule.MouseUpEventHandler += (kkd, jjk) => { //device.obj2 = 21; // functionView.RemoveAll (); // SelectType (btnChooseModule, btnChooseTemp, new Button (), btnChoosePower, btnChooseModule); // var btnModeText = new Button () { // Width = Application.GetRealWidth (200), // Height = Application.GetRealHeight (90), // TextID = R.MyInternationalizationString.Cool, // Y = Application.GetRealHeight (70), // Gravity = Gravity.CenterHorizontal, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.SelectedColor, // TextAlignment = TextAlignment.Center, // BackgroundColor = SkinStyle.Current.ButtonColor, // BorderColor = SkinStyle.Current.BorderColor, // BorderWidth = 1, // Radius = 1, // }; // functionView.AddChidren (btnModeText); // btnModeText.MouseUpEventHandler += (sender, e) => { // //1 = 正常模式, 2 = 白天模式 , 3 = 夜间模式, 4 = 离开模式, 5 = 自 // device.obj3++; // if (device.obj3 > 5) // device.obj3 = 1; // switch(device.obj3){ // case 1: // btnModeText.TextID = R.MyInternationalizationString.Normal; // break; // case 2: // btnModeText.TextID = R.MyInternationalizationString.Day; // break; // case 3: // btnModeText.TextID = R.MyInternationalizationString.AtNight; // break; // case 4: // btnModeText.TextID = R.MyInternationalizationString.GoAway; // break; // case 5: // btnModeText.TextID = R.MyInternationalizationString.Auto; // break; // } // }; // }; // #endregion // #region temp // btnChooseTemp.MouseUpEventHandler += (kkd, jjk) => { // functionView.RemoveAll (); // device.obj2 = 25; // device.obj3 = 16; // SelectType (btnChooseTemp, btnChooseTemp, new Button (), btnChoosePower, btnChooseModule); // var btnSetTempText = new Button () { // Width = Application.GetRealWidth (200), // Height = Application.GetRealHeight (90), // TextID = R.MyInternationalizationString.Cool, // X = Application.GetRealWidth (50), // Y = Application.GetRealHeight (30), // TextColor = SkinStyle.Current.TextColor, // SelectedTextColor = SkinStyle.Current.SelectedColor, // TextAlignment = TextAlignment.CenterLeft, // Text = Language.StringByID (R.MyInternationalizationString.SetTemperature).Replace ("--", "16"), // }; // functionView.AddChidren (btnSetTempText); // var btnModeText = new Button () { // Width = Application.GetRealWidth (200), // Height = Application.GetRealHeight (90), // TextID = R.MyInternationalizationString.Cool, // Y = Application.GetRealHeight (30), // X = btnSetTempText.Right, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.SelectedColor, // TextAlignment = TextAlignment.Center, // BackgroundColor = SkinStyle.Current.ButtonColor, // BorderColor = SkinStyle.Current.BorderColor, // BorderWidth = 1, // Radius = 1, // }; // functionView.AddChidren (btnModeText); // var horizontalSeekBar = new HorizontalSeekBar () { // Width = Application.GetRealWidth (400), // Height = Application.GetRealHeight (80), // X = Application.GetRealWidth (50), // Y = btnSetTempText.Bottom + Application.GetRealHeight (30), // Tag = DateTime.MinValue, // ThumbColor = SkinStyle.Current.SelectedColor, // Max = 20 // }; // functionView.AddChidren (horizontalSeekBar); // horizontalSeekBar.ProgressChanged += (sender2, e4) => { // btnSetTempText.Text = Language.StringByID (R.MyInternationalizationString.SetTemperature).Replace ("--", (e4 + 16).ToString ()); // device.obj3 = (byte)(e4 + 16); // }; // btnModeText.MouseUpEventHandler += (sender, e) => { // device.obj2++; // if (device.obj2 > 28) { // device.obj2 = 25; // } // switch (device.obj3) { // case 25: // btnModeText.TextID = R.MyInternationalizationString.Normal; // break; // case 26: // btnModeText.TextID = R.MyInternationalizationString.Day; // break; // case 27: // btnModeText.TextID = R.MyInternationalizationString.AtNight; // break; // case 28: // btnModeText.TextID = R.MyInternationalizationString.GoAway; // break; // } // }; // }; // #endregion // #endregion // Button btnCloseThis = new Button () { // Width = Application.GetRealWidth (250), // Height = Application.GetRealHeight (100), // Y = Application.GetRealHeight (502), // BackgroundColor = SkinStyle.Current.DialogTitle, // TextID = R.MyInternationalizationString.cancel, // TextAlignment = TextAlignment.Center, // }; // setTargetView.AddChidren (btnCloseThis); // btnCloseThis.MouseUpEventHandler += (kkk, lll) => { // setTargetDialog.Close (); // }; // Button btnSaveThis = new Button () { // X = btnCloseThis.Right + 1, // Y = btnCloseThis.Y, // Width = Application.GetRealWidth (250), // Height = Application.GetRealHeight (100), // BackgroundColor = SkinStyle.Current.DialogTitle, // TextID = R.MyInternationalizationString.Confrim, // TextAlignment = TextAlignment.Center, // }; // setTargetView.AddChidren (btnSaveThis); // btnSaveThis.MouseUpEventHandler += (sss, dddd) => { // curSetBytes [3] = device.obj1; // curSetBytes [4] = device.SubnetID; // curSetBytes [5] = device.DeviceID; // curSetBytes [6] = device.obj2; // curSetBytes [7] = device.obj3; // curSetBytes [8] = device.LoopID; // curSetBytes [9] = 0; // setTargetDialog.Close (); // SaveAutomationData (); // }; // setTargetDialog.Show (); // }; // } // if (device.Type == DeviceType.LightDALI || device.Type == DeviceType.LightDimming || device.Type == DeviceType.LightRGB || device.Type == DeviceType.CurtainTrietex || device.Type == DeviceType.CurtainRoller) { // device.obj1 = 89; // if (device.Type == DeviceType.CurtainModel) { // device.obj1 = 92; // } // btn.MouseUpEventHandler += (ddd, fff) => { // Dialog setTargetDialog = new Dialog (); // FrameLayout setTargetView = new FrameLayout () { // Gravity = Gravity.Center, // Width = Application.GetRealWidth (500), // Height = Application.GetRealHeight (300), // BackgroundColor = SkinStyle.Current.DialogColor, // BorderColor = SkinStyle.Current.Transparent, // BorderWidth = 0, // Radius = 1, // }; // setTargetDialog.AddChidren (setTargetView); // var horizontalSeekBar = new HorizontalSeekBar () { // Width = Application.GetRealWidth (500 - 120), // Height = Application.GetRealHeight (80), // X = Application.GetRealWidth (30), // Y = Application.GetRealHeight (70), // Tag = DateTime.MinValue, // ThumbColor = SkinStyle.Current.SelectedColor, // }; // setTargetView.AddChidren (horizontalSeekBar); // Button btnMaxBrightness = new Button () { // Width = Application.GetRealWidth (90), // Height = Application.GetRealHeight (80), // X = horizontalSeekBar.Right + Application.GetRealWidth (10), // Y = Application.GetRealHeight (70), // Text = "0%", // TextAlignment = TextAlignment.CenterLeft, // TextColor = SkinStyle.Current.TextColor // }; // setTargetView.AddChidren (btnMaxBrightness); // horizontalSeekBar.ProgressChanged += (sender2, e4) => { // //Console.WriteLine (DateTime.Now.ToString ()); // btnMaxBrightness.Text = horizontalSeekBar.Progress + "%"; // System.Threading.Tasks.Task.Run (() => { // if ((DateTime.Now - (DateTime)(horizontalSeekBar.Tag)).TotalMilliseconds < 100) { // return; // } // horizontalSeekBar.Tag = DateTime.Now; // device.obj2 = device.LoopID; // device.obj3 = (byte)horizontalSeekBar.Progress; // device.obj4 = 0; // device.obj5 = 0; // if (device.obj1 == 89) //0x59 单路调节 Single Channel Lighting Control 0031 // { // Control.ControlBytesSend (Command.SetSingleLight, device.SubnetID, device.DeviceID, new byte [] { device.obj2, device.obj3, device.obj4, device.obj5 }); // var lightLigicBytes = Control.ControlBytesSendHasReturn (Command.ReadLogicLoopColor, device.SubnetID, device.DeviceID, new byte [] { device.LoopID }); // lightLigicBytes [1] = (byte)e4; // Control.ControlBytesSend (Command.SetLogicLoopColor, device.SubnetID, device.DeviceID, lightLigicBytes, SendCount.Zero); // } // else if (device.obj1 == 92)//0x5c 窗帘开关 Curtain Switch e3e0 // { // device.obj2 = (byte)(device.LoopID + 16); // Control.ControlBytesSend (Command.UpdataCurtainModelStutas, device.SubnetID, device.DeviceID, new byte [] { device.obj2, device.obj3, device.obj4, device.obj5 }); // } // }); // }; // horizontalSeekBar.MouseUpEventHandler += (sender2, e4) => { // horizontalSeekBar.Tag = DateTime.Now; // btnMaxBrightness.Text = horizontalSeekBar.Progress + "%"; // device.obj2 = device.LoopID; // device.obj3 = (byte)horizontalSeekBar.Progress; // device.obj4 = 0; // device.obj5 = 0; // if (device.obj1 == 89) //0x59 单路调节 Single Channel Lighting Control 0031 // Control.ControlBytesSend (Command.SetSingleLight, device.SubnetID, device.DeviceID, new byte [] { device.obj2, device.obj3, device.obj4, device.obj5 }); // else if (device.obj1 == 92)//0x5c 窗帘开关 Curtain Switch e3e0 // Control.ControlBytesSend (Command.UpdataCurtainModelStutas, device.SubnetID, device.DeviceID, new byte [] { device.obj2, device.obj3, device.obj4, device.obj5 }); // }; // Button btnCloseThis = new Button () { // Width = Application.GetRealWidth (250), // Height = Application.GetRealHeight (100), // Y = Application.GetRealHeight (202), // BackgroundColor = SkinStyle.Current.DialogTitle, // TextID = R.MyInternationalizationString.cancel, // TextAlignment = TextAlignment.Center, // }; // setTargetView.AddChidren (btnCloseThis); // btnCloseThis.MouseUpEventHandler += (kkk, lll) => { // setTargetDialog.Close (); // }; // Button btnSaveThis = new Button () { // X = btnCloseThis.Right + 1, // Y = btnCloseThis.Y, // Width = Application.GetRealWidth (250), // Height = Application.GetRealHeight (100), // BackgroundColor = SkinStyle.Current.DialogTitle, // TextID = R.MyInternationalizationString.Confrim, // TextAlignment = TextAlignment.Center, // }; // setTargetView.AddChidren (btnSaveThis); // btnSaveThis.MouseUpEventHandler += (sss, dddd) => { // curSetBytes [3] = 89; // curSetBytes [4] = device.SubnetID; // curSetBytes [5] = device.DeviceID; // curSetBytes [6] = device.LoopID; // curSetBytes [7] = device.obj3; // curSetBytes [8] = 0; // curSetBytes [9] = 0; // setTargetDialog.Close (); // SaveAutomationData (); // }; // setTargetDialog.Show (); // }; // } // } // void InitPowerFunctionView (FrameLayout functionView,Common device) // { // functionView.RemoveAll (); // Button btnSetClose = new Button () { // X = Application.GetRealWidth (50), // Y = Application.GetRealHeight (50), // Width = Application.GetRealHeight (200), // Height = Application.GetRealHeight (110), // TextID = R.MyInternationalizationString.OFF, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.SelectedColor, // TextAlignment = TextAlignment.Center, // BackgroundColor = SkinStyle.Current.ButtonColor, // BorderColor = SkinStyle.Current.BorderColor, // BorderWidth = 1, // Radius = 1, // }; // functionView.AddChidren (btnSetClose); // Button btnSetOpen = new Button () { // X = btnSetClose.Right, // Y = btnSetClose.Y, // Width = btnSetClose.Width, // Height = btnSetClose.Height, // TextID = R.MyInternationalizationString.ON, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.SelectedColor, // TextAlignment = TextAlignment.Center, // BackgroundColor = SkinStyle.Current.ButtonColor, // BorderColor = SkinStyle.Current.BorderColor, // BorderWidth = 1, // Radius = 1, // }; // functionView.AddChidren (btnSetOpen); // btnSetClose.MouseUpEventHandler += (asdf, fda) => { // btnSetClose.IsSelected = true; // btnSetClose.BorderColor = SkinStyle.Current.SelectedColor; // btnSetOpen.IsSelected = false; // btnSetOpen.BorderColor = SkinStyle.Current.BorderColor; // //MainPage.Loading.Start (""); // //System.Threading.Tasks.Task.Run (() => { // device.obj2 = 3; // device.obj3 = 0; // device.obj4 = 0; // device.obj5 = 0; // // controlBLL.ControlBusSceneDevice (device); // // Application.RunOnMainThread (() => { // // MainPage.Loading.Hide (); // // }); // //}); // if (!device.Type.ToString ().Contains ("AC")) { // device.obj2 = 20; // } // }; // btnSetOpen.MouseUpEventHandler += (asdf, fda) => { // btnSetOpen.IsSelected = true; // btnSetOpen.BorderColor = SkinStyle.Current.SelectedColor; // btnSetClose.IsSelected = false; // btnSetClose.BorderColor = SkinStyle.Current.BorderColor; // //System.Threading.Tasks.Task.Run (() => { // device.obj2 = 3; // device.obj3 = 1; // device.obj4 = 0; // device.obj5 = 0; // if (!device.Type.ToString ().Contains ("AC")) { // device.obj2 = 20; // } // // controlBLL.ControlBusSceneDevice (device); // // Application.RunOnMainThread (() => { // // MainPage.Loading.Hide (); // // }); // //}); // }; // } // /// // /// 配置目标界面加载选中类型的目标 // /// // void InitDevcies (string slelctedType, VerticalScrolViewLayout deviceScrolView) // { // deviceScrolView.RemoveAll (); // var listDevice = new List (); // foreach (var room in Room.Lists) { // if (!string.IsNullOrEmpty (room.Name)) { // listDevice.AddRange (room.DeviceList.FindAll ((obj) => obj.Type.ToString ().Contains (slelctedType))); // } // } // foreach (var device in listDevice) { // Button targetButton = null; // Button btn = new Button () { // Height = Application.GetRealHeight (100) - 1, // TextAlignment = TextAlignment.CenterLeft, // TextColor = SkinStyle.Current.TextColor1, // SelectedTextColor = SkinStyle.Current.SelectedColor, // Text = device.Name, // Padding = new Padding (0, 30, 0, 0), // }; // deviceScrolView.AddChidren (btn); // Button btnNullLine = new Button () { // Height = 1, // BackgroundColor = SkinStyle.Current.BorderColor, // }; // deviceScrolView.AddChidren (btnNullLine); // if (curSetBytes [4] == device.SubnetID && curSetBytes [5] == device.DeviceID && curSetBytes [6] == device.LoopID) { // targetButton = btn; // btn.IsSelected = true; // btn.BorderColor = SkinStyle.Current.SelectedColor; // } // InitDevcieSetView (btn, device); // } // } // void SelectType (Button selectedButton, Button btn1, Button btn2, Button btn3, Button btn4) // { // btn1.BorderColor = btn2.BorderColor = btn3.BorderColor = btn4.BorderColor = SkinStyle.Current.BorderColor; // btn1.IsSelected = btn2.IsSelected = btn3.IsSelected = btn4.IsSelected = false; // selectedButton.BorderColor = SkinStyle.Current.SelectedColor; // selectedButton.IsSelected = true; // } // } //}