| | |
| | | /// </summary> |
| | | public int OldIconPathType; |
| | | |
| | | /// <summary> |
| | | /// selectedTimeAction |
| | | /// </summary> |
| | | public Action<SceneTargetDeviceUI> selectedAction; |
| | | |
| | | |
| | | |
| | | #endregion |
| | | |
| | | /// <summary> |
| | |
| | | return; |
| | | } |
| | | |
| | | var deviceView = new SelectDevice(); |
| | | UserView.HomePage.Instance.AddChidren(deviceView); |
| | | UserView.HomePage.Instance.PageIndex += 1; |
| | | deviceView.sceneTargetDevice = targetDevice; |
| | | deviceView.deviceUI = targetDevice.DeviceUI; |
| | | deviceView.Show(); |
| | | deviceView.selectedAction = (selectedDevice) => |
| | | ShowSelectAction(targetDevice.DeviceUI, targetDevice); |
| | | selectedAction = (selectedDevice) => |
| | | { |
| | | var targetDeviceUI = sceneTargetDevicesList.Find((obj) => obj.SceneTargetDeviceUIID == selectedDevice.SceneTargetDeviceUIID); |
| | | if (targetDeviceUI != null) |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (sceneTargetDevicesList.Count > 2) |
| | | |
| | | if (sceneTargetDevicesList.Count > 1) |
| | | { |
| | | var targetRowLayout = new RowLayout() |
| | | { |
| | |
| | | TextID = R.MyInternationalizationString.EditInfo, |
| | | TextColor = ZigbeeColor.Current.GXCTextDeepBlackColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = 14 |
| | | TextSize = 15, |
| | | IsBold=true |
| | | }; |
| | | infoFL.AddChidren(infoEdit); |
| | | |
| | |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextID = R.MyInternationalizationString.AddScentTargetAction, |
| | | Gravity = Gravity.CenterVertical |
| | | Gravity = Gravity.CenterVertical, |
| | | TextSize=15 |
| | | }; |
| | | addTargetFL.AddChidren(target); |
| | | |
| | |
| | | targetFL.AddChidren(TargetListScrolView); |
| | | |
| | | confirmBtn = new CommonForm.CompleteButton(1656, 907, 127); |
| | | confirmBtn.TextID = R.MyInternationalizationString.Next; |
| | | AddChidren(confirmBtn); |
| | | |
| | | if(isModify) |
| | | if (isModify) |
| | | { |
| | | IconPathType = modifySceneUI.IconPathType; |
| | | OldIconPathType = modifySceneUI.IconPathType; |
| | |
| | | { |
| | | OldBackgroundImagePath = modifySceneUI.IconPath; |
| | | } |
| | | if (modifySceneUI.IconPathType==0) |
| | | if (modifySceneUI.IconPathType == 0) |
| | | { |
| | | backGround.ImagePath = modifySceneUI.IconPath; |
| | | } |
| | |
| | | backGround.ImagePath = System.IO.Path.Combine(Config.Instance.FullPath, modifySceneUI.IconPath); |
| | | } |
| | | nameRow.SetTitle(modifySceneUI.Name); |
| | | zoneRow.SetTitle($"{Config.Instance.Home.GetFloorNameById(modifyRoom.FloorId)},{modifyRoom.Name}"); |
| | | if (Config.Instance.Home.FloorDics.Count == 0) |
| | | { |
| | | zoneRow.SetTitle($"{modifyRoom.Name}"); |
| | | } |
| | | else |
| | | { |
| | | zoneRow.SetTitle($"{Config.Instance.Home.GetFloorNameById(modifyRoom.FloorId)},{modifyRoom.Name}"); |
| | | } |
| | | curRoom = modifyRoom; |
| | | sceneTargetDevicesList.AddRange(modifySceneTargetDevicesList); |
| | | } |
| | |
| | | Height = Application.GetRealHeight(450), |
| | | Width = Application.GetRealWidth(selectRow_Width), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Radius = (uint)Application.GetRealHeight(17), |
| | | Radius = (uint)Application.GetRealHeight(35), |
| | | BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor |
| | | }; |
| | | selectFL.AddChidren(itemFL); |
| | | itemFL.Animate = Animate.DownToUp; |
| | | //itemFL.Animate = Animate.DownToUp; |
| | | |
| | | var selectLocalPicture = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(selectRow_Height) - 1, |
| | | TextID = R.MyInternationalizationString.LocalPicture, |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4 |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, |
| | | TextSize=17 |
| | | }; |
| | | itemFL.AddChidren(selectLocalPicture); |
| | | var selectLocalLine = new Button() |
| | | { |
| | | Y = selectLocalPicture.Bottom, |
| | | Height = 1, |
| | | BackgroundColor = ZigbeeColor.Current.GXCLineColor |
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2 |
| | | }; |
| | | itemFL.AddChidren(selectLocalLine); |
| | | |
| | |
| | | Y = selectLocalLine.Bottom, |
| | | Height = Application.GetRealHeight(selectRow_Height) - 1, |
| | | TextID = R.MyInternationalizationString.Photograph, |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4 |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, |
| | | TextSize=17 |
| | | }; |
| | | itemFL.AddChidren(selectPhotographBtn); |
| | | var selectPhotographLine = new Button() |
| | | { |
| | | Y = selectPhotographBtn.Bottom, |
| | | Height = 1, |
| | | BackgroundColor = ZigbeeColor.Current.GXCLineColor, |
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2, |
| | | }; |
| | | itemFL.AddChidren(selectPhotographLine); |
| | | |
| | |
| | | Y = selectPhotographLine.Bottom, |
| | | Height = Application.GetRealHeight(selectRow_Height) - 1, |
| | | TextID = R.MyInternationalizationString.MyAblums, |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4 |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, |
| | | TextSize=17 |
| | | }; |
| | | itemFL.AddChidren(selectAblumsBtn); |
| | | |
| | |
| | | TextID = R.MyInternationalizationString.Cancel, |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, |
| | | BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor, |
| | | Radius = (uint)Application.GetRealHeight(17) |
| | | Radius = (uint)Application.GetRealHeight(35), |
| | | TextSize=17 |
| | | }; |
| | | selectFL.AddChidren(cancelBtn); |
| | | |
| | |
| | | //通过相机拍照裁剪 |
| | | CropImage.TakePicture((imagePath) => |
| | | {
|
| | | if (string.IsNullOrEmpty(imagePath) == true)
|
| | | {
|
| | | return;
|
| | | } |
| | | if (isModify) |
| | | { |
| | | if (IconPathType != 0) |
| | |
| | | //从相册选择图片裁剪 |
| | | CropImage.SelectPicture((imagePath) => |
| | | {
|
| | | if (string.IsNullOrEmpty(imagePath) == true)
|
| | | {
|
| | | return;
|
| | | } |
| | | if (isModify) |
| | | { |
| | | if (IconPathType != 0) |
| | |
| | | { |
| | | foreach (var floor in Config.Instance.Home.FloorDics) |
| | | { |
| | | floorIds.Add(floor.Key); |
| | | floorNames.Add(floor.Value); |
| | | if (Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key).Count > 0) |
| | | { |
| | | floorIds.Add(floor.Key); |
| | | floorNames.Add(floor.Value); |
| | | |
| | | roomNames.Add(Common.Room.CurrentRoom.GetRoomNamesByFloorId(floor.Key)); |
| | | rooms.Add(Common.Room.CurrentRoom.GetRoomsByFloorId(floor.Key)); |
| | | } |
| | |
| | | Height = Application.GetRealHeight(450), |
| | | Width = Application.GetRealWidth(selectRow_Width), |
| | | Gravity=Gravity.CenterHorizontal, |
| | | Radius = (uint)Application.GetRealHeight(17), |
| | | Radius = (uint)Application.GetRealHeight(35), |
| | | BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor |
| | | }; |
| | | selectFL.AddChidren(itemFL); |
| | | itemFL.Animate = Animate.DownToUp; |
| | | //itemFL.Animate = Animate.DownToUp; |
| | | |
| | | var selectedFunctionBtn = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(selectRow_Height) - 1, |
| | | TextID = R.MyInternationalizationString.Function, |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4 |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, |
| | | TextSize=17 |
| | | }; |
| | | itemFL.AddChidren(selectedFunctionBtn); |
| | | var selectedFunctionLine = new Button() |
| | | { |
| | | Y = selectedFunctionBtn.Bottom, |
| | | Height = 1, |
| | | BackgroundColor = ZigbeeColor.Current.GXCLineColor |
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2 |
| | | }; |
| | | itemFL.AddChidren(selectedFunctionLine); |
| | | |
| | |
| | | Y = selectedFunctionLine.Bottom, |
| | | Height = Application.GetRealHeight(selectRow_Height) - 1, |
| | | TextID = R.MyInternationalizationString.Scence, |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4 |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, |
| | | TextSize=17 |
| | | }; |
| | | itemFL.AddChidren(selectedSceneBtn); |
| | | var selectedSceneLine = new Button() |
| | | { |
| | | Y = selectedSceneBtn.Bottom, |
| | | Height = 1, |
| | | BackgroundColor = ZigbeeColor.Current.GXCLineColor, |
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2, |
| | | }; |
| | | itemFL.AddChidren(selectedSceneLine); |
| | | |
| | |
| | | Y = selectedSceneLine.Bottom, |
| | | Height = Application.GetRealHeight(selectRow_Height) - 1, |
| | | TextID = R.MyInternationalizationString.Delay, |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4 |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, |
| | | TextSize=17 |
| | | }; |
| | | itemFL.AddChidren(selectedTimerBtn); |
| | | |
| | |
| | | TextID = R.MyInternationalizationString.Cancel, |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor4, |
| | | BackgroundColor = ZigbeeColor.Current.GXCTextWhiteColor, |
| | | Radius = (uint)Application.GetRealHeight(17) |
| | | Radius = (uint)Application.GetRealHeight(35), |
| | | TextSize=17 |
| | | }; |
| | | selectFL.AddChidren(cancelBtn); |
| | | |
| | |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 编辑设备____________________________________ |
| | | |
| | | /// <summary> |
| | | /// ShowSelectAction |
| | | /// </summary> |
| | | /// <param name="device"></param> |
| | | private void ShowSelectAction(DeviceUI device, SceneTargetDeviceUI sceneTarget) |
| | | { |
| | | var dialog = new FrameLayout() |
| | | { |
| | | BackgroundColor = ZigbeeColor.Current.GXCDailogBackGroundColor |
| | | }; |
| | | AddChidren(dialog); |
| | | |
| | | dialog.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | dialog.RemoveFromParent(); |
| | | }; |
| | | |
| | | if (device.CommonDevice.Type == ZigBee.Device.DeviceType.OnOffOutput) |
| | | { |
| | | SelectOnoffOutput(dialog, device, sceneTarget); |
| | | } |
| | | else if (device.CommonDevice.Type == ZigBee.Device.DeviceType.AirSwitch) |
| | | { |
| | | SelectOnoffOutput(dialog, device, sceneTarget); |
| | | } |
| | | else if (device.CommonDevice.Type == ZigBee.Device.DeviceType.DimmableLight) |
| | | { |
| | | SelectDimmableLight(dialog, device, sceneTarget); |
| | | } |
| | | else if (device.CommonDevice.Type == ZigBee.Device.DeviceType.WindowCoveringDevice) |
| | | { |
| | | SelectWindowCoveringDevice(dialog, device, sceneTarget); |
| | | } |
| | | else if (device.CommonDevice.Type == ZigBee.Device.DeviceType.Thermostat) |
| | | { |
| | | SelectThermostat(dialog, device, sceneTarget); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 灯光 |
| | | /// </summary> |
| | | /// <param name="dialog"></param> |
| | | /// <param name="device"></param> |
| | | /// <param name="sceneTarget"></param> |
| | | private void SelectOnoffOutput(FrameLayout dialog, DeviceUI device, SceneTargetDeviceUI sceneTarget) |
| | | { |
| | | var selectFL = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(1391), |
| | | Height = Application.GetRealHeight(530), |
| | | }; |
| | | dialog.AddChidren(selectFL); |
| | | //selectFL.Animate = Animate.DownToUp; |
| | | |
| | | var titleBG = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(138 * 2), |
| | | Radius = (uint)Application.GetRealHeight(58), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | selectFL.AddChidren(titleBG); |
| | | |
| | | var titleFL = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(138), |
| | | }; |
| | | selectFL.AddChidren(titleFL); |
| | | |
| | | var line = new Button |
| | | { |
| | | Y = titleFL.Height - 1, |
| | | Height = 1, |
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2 |
| | | }; |
| | | titleFL.AddChidren(line); |
| | | |
| | | var cancleBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(80), |
| | | Width = Application.GetRealWidth(200), |
| | | TextColor = ZigbeeColor.Current.GXCTextGrayColor, |
| | | TextSize = 14, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextID = R.MyInternationalizationString.Cancel |
| | | }; |
| | | titleFL.AddChidren(cancleBtn); |
| | | |
| | | var deviceName = new Button |
| | | { |
| | | Width = Application.GetRealWidth(600), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextSize = 16, |
| | | Text = device.CommonDevice.DeviceEpointName |
| | | }; |
| | | titleFL.AddChidren(deviceName); |
| | | |
| | | var comfrimBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(800), |
| | | Width = Application.GetRealWidth(200), |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor2, |
| | | TextSize = 14, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextID = R.MyInternationalizationString.Complete |
| | | }; |
| | | titleFL.AddChidren(comfrimBtn); |
| | | |
| | | var itemFL = new FrameLayout |
| | | { |
| | | Y = titleFL.Bottom, |
| | | Height = Application.GetRealHeight(392), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | selectFL.AddChidren(itemFL); |
| | | |
| | | var open = new SelectSceneStatuRow(0, 60); |
| | | itemFL.AddChidren(open); |
| | | open.Init(); |
| | | open.SetTitle(R.MyInternationalizationString.Open); |
| | | open.IsSelected = true; |
| | | |
| | | |
| | | var shut = new SelectSceneStatuRow(0, 60 + 127 + 30); |
| | | itemFL.AddChidren(shut); |
| | | shut.Init(); |
| | | shut.hideLine(true); |
| | | shut.SetTitle(R.MyInternationalizationString.Shut); |
| | | |
| | | open.ClickButton.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | | }; |
| | | |
| | | shut.ClickButton.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | open.IsSelected = false; |
| | | shut.IsSelected = true; |
| | | }; |
| | | |
| | | cancleBtn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.RemoveAll(); |
| | | dialog.RemoveFromParent(); |
| | | }; |
| | | |
| | | if (sceneTarget.TaskList.Count > 0) |
| | | { |
| | | if (sceneTarget.TaskList[0].Data1 == 1) |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | | } |
| | | else |
| | | { |
| | | open.IsSelected = false; |
| | | shut.IsSelected = true; |
| | | } |
| | | } |
| | | |
| | | comfrimBtn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | var taskList = new List<ZigBee.Device.Scene.TaskListInfo> { }; |
| | | int taskType = 1; |
| | | int data1 = 0; |
| | | int data2 = 0; |
| | | |
| | | if (open.IsSelected) |
| | | { |
| | | //开 |
| | | data1 = 1; |
| | | data2 = 0; |
| | | } |
| | | else |
| | | { |
| | | //关 |
| | | data1 = 0; |
| | | data2 = 0; |
| | | } |
| | | var taskInfo = new ZigBee.Device.Scene.TaskListInfo |
| | | { |
| | | TaskType = taskType, |
| | | Data1 = data1, |
| | | Data2 = data2 |
| | | }; |
| | | taskList.Add(taskInfo); |
| | | |
| | | sceneTarget.TaskList = taskList; |
| | | sceneTarget.DeviceUI = device; |
| | | selectedAction?.Invoke(sceneTarget); |
| | | dialog.RemoveFromParent(); |
| | | }; |
| | | } |
| | | /// <summary> |
| | | /// 窗帘 |
| | | /// </summary> |
| | | /// <param name="dialog"></param> |
| | | /// <param name="device"></param> |
| | | /// <param name="sceneTarget"></param> |
| | | private void SelectWindowCoveringDevice(FrameLayout dialog, DeviceUI device, SceneTargetDeviceUI sceneTarget) |
| | | { |
| | | var selectFL = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(1169), |
| | | Height = Application.GetRealHeight(752), |
| | | }; |
| | | dialog.AddChidren(selectFL); |
| | | //selectFL.Animate = Animate.DownToUp; |
| | | |
| | | var titleBG = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(138 * 2), |
| | | Radius = (uint)Application.GetRealHeight(58), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | selectFL.AddChidren(titleBG); |
| | | |
| | | var titleFL = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(138), |
| | | }; |
| | | selectFL.AddChidren(titleFL); |
| | | |
| | | var line = new Button |
| | | { |
| | | Y = titleFL.Height - 1, |
| | | Height = 1, |
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2 |
| | | }; |
| | | titleFL.AddChidren(line); |
| | | |
| | | var cancleBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(80), |
| | | Width = Application.GetRealWidth(200), |
| | | TextColor = ZigbeeColor.Current.GXCTextGrayColor, |
| | | TextSize = 14, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextID = R.MyInternationalizationString.Cancel |
| | | }; |
| | | titleFL.AddChidren(cancleBtn); |
| | | |
| | | var deviceName = new Button |
| | | { |
| | | Width = Application.GetRealWidth(600), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextSize = 16, |
| | | Text = device.CommonDevice.DeviceEpointName |
| | | }; |
| | | titleFL.AddChidren(deviceName); |
| | | |
| | | var comfrimBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(800), |
| | | Width = Application.GetRealWidth(200), |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor2, |
| | | TextSize = 14, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextID = R.MyInternationalizationString.Complete |
| | | }; |
| | | titleFL.AddChidren(comfrimBtn); |
| | | |
| | | var itemFL = new FrameLayout |
| | | { |
| | | Y = titleFL.Bottom, |
| | | Height = Application.GetRealHeight(613), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | selectFL.AddChidren(itemFL); |
| | | |
| | | var open = new SelectDeviceWithSeekBarRow(0, 60); |
| | | itemFL.AddChidren(open); |
| | | open.Init(); |
| | | open.SetTitle(R.MyInternationalizationString.Open); |
| | | open.IsSelected = true; |
| | | |
| | | var shut = new SelectSceneStatuRow(0, 60 + 348 + 30); |
| | | itemFL.AddChidren(shut); |
| | | shut.Init(); |
| | | shut.hideLine(true); |
| | | shut.SetTitle(R.MyInternationalizationString.Shut); |
| | | |
| | | open.ClickButton.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | | }; |
| | | |
| | | shut.ClickButton.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | open.IsSelected = false; |
| | | shut.IsSelected = true; |
| | | }; |
| | | |
| | | cancleBtn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.RemoveAll(); |
| | | dialog.RemoveFromParent(); |
| | | }; |
| | | |
| | | open.SeekBar.ProgressChanged += (sender, e) => |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | | open.SetSeekBarTitle(); |
| | | }; |
| | | |
| | | if (sceneTarget.TaskList.Count > 0) |
| | | { |
| | | if (sceneTarget.TaskList[0].Data1 == 1) |
| | | { |
| | | open.IsSelected = false; |
| | | shut.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | | open.SetProgress(sceneTarget.TaskList[0].Data2); |
| | | } |
| | | } |
| | | |
| | | comfrimBtn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | var taskList = new List<ZigBee.Device.Scene.TaskListInfo> { }; |
| | | |
| | | int taskType = 6; |
| | | int data1 = 0; |
| | | int data2 = 0; |
| | | |
| | | if (shut.IsSelected) |
| | | { |
| | | //关 |
| | | data1 = 1; |
| | | data2 = 0; |
| | | } |
| | | else |
| | | { |
| | | //百分比 |
| | | data1 = 5; |
| | | data2 = open.SeekBar.Progress; |
| | | } |
| | | |
| | | var taskInfo = new ZigBee.Device.Scene.TaskListInfo |
| | | { |
| | | TaskType = taskType, |
| | | Data1 = data1, |
| | | Data2 = data2 |
| | | }; |
| | | taskList.Add(taskInfo); |
| | | |
| | | sceneTarget.TaskList = taskList; |
| | | sceneTarget.DeviceUI = device; |
| | | selectedAction?.Invoke(sceneTarget); |
| | | dialog.RemoveFromParent(); |
| | | }; |
| | | } |
| | | /// <summary> |
| | | /// 调光灯 |
| | | /// </summary> |
| | | /// <param name="dialog"></param> |
| | | /// <param name="device"></param> |
| | | /// <param name="sceneTarget"></param> |
| | | private void SelectDimmableLight(FrameLayout dialog, DeviceUI device, SceneTargetDeviceUI sceneTarget) |
| | | { |
| | | var selectFL = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(1169), |
| | | Height = Application.GetRealHeight(752), |
| | | }; |
| | | dialog.AddChidren(selectFL); |
| | | //selectFL.Animate = Animate.DownToUp; |
| | | |
| | | var titleBG = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(138 * 2), |
| | | Radius = (uint)Application.GetRealHeight(58), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | selectFL.AddChidren(titleBG); |
| | | |
| | | var titleFL = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(138), |
| | | }; |
| | | selectFL.AddChidren(titleFL); |
| | | |
| | | var line = new Button |
| | | { |
| | | Y = titleFL.Height - 1, |
| | | Height = 1, |
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2 |
| | | }; |
| | | titleFL.AddChidren(line); |
| | | |
| | | var cancleBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(80), |
| | | Width = Application.GetRealWidth(200), |
| | | TextColor = ZigbeeColor.Current.GXCTextGrayColor, |
| | | TextSize = 14, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextID = R.MyInternationalizationString.Cancel |
| | | }; |
| | | titleFL.AddChidren(cancleBtn); |
| | | |
| | | var deviceName = new Button |
| | | { |
| | | Width = Application.GetRealWidth(600), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextSize = 16, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = device.CommonDevice.DeviceEpointName |
| | | }; |
| | | titleFL.AddChidren(deviceName); |
| | | |
| | | var comfrimBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(800), |
| | | Width = Application.GetRealWidth(200), |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor2, |
| | | TextSize = 14, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextID = R.MyInternationalizationString.Complete |
| | | }; |
| | | titleFL.AddChidren(comfrimBtn); |
| | | |
| | | var itemFL = new FrameLayout |
| | | { |
| | | Y = titleFL.Bottom, |
| | | Height = Application.GetRealHeight(613), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | selectFL.AddChidren(itemFL); |
| | | |
| | | var open = new SelectDeviceWithSeekBarRow(0, 60); |
| | | itemFL.AddChidren(open); |
| | | open.Init(254); |
| | | open.SetTitle(R.MyInternationalizationString.Open); |
| | | open.IsSelected = true; |
| | | |
| | | var shut = new SelectSceneStatuRow(0, 60 + 348 + 30); |
| | | itemFL.AddChidren(shut); |
| | | shut.Init(); |
| | | shut.hideLine(true); |
| | | shut.SetTitle(R.MyInternationalizationString.Shut); |
| | | |
| | | open.ClickButton.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | | }; |
| | | |
| | | shut.ClickButton.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | open.IsSelected = false; |
| | | shut.IsSelected = true; |
| | | }; |
| | | |
| | | cancleBtn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.RemoveAll(); |
| | | dialog.RemoveFromParent(); |
| | | }; |
| | | |
| | | open.SeekBar.ProgressChanged += (sender, e) => |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | | open.SetSeekBarTitle(); |
| | | }; |
| | | |
| | | if (sceneTarget.TaskList.Count > 0) |
| | | { |
| | | if (sceneTarget.TaskList[0].Data1 == 0) |
| | | { |
| | | open.IsSelected = false; |
| | | shut.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | | open.SetProgress(sceneTarget.TaskList[0].Data1); |
| | | } |
| | | } |
| | | |
| | | comfrimBtn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | var taskList = new List<ZigBee.Device.Scene.TaskListInfo> { }; |
| | | |
| | | int taskType = 3; |
| | | int data1 = 0; |
| | | int data2 = 0; |
| | | |
| | | if (shut.IsSelected) |
| | | { |
| | | //关 |
| | | data1 = 0; |
| | | data2 = 0; |
| | | } |
| | | else |
| | | { |
| | | //百分比 |
| | | data1 = open.SeekBar.Progress; |
| | | data2 = 0; |
| | | } |
| | | |
| | | var taskInfo = new ZigBee.Device.Scene.TaskListInfo |
| | | { |
| | | TaskType = taskType, |
| | | Data1 = data1, |
| | | Data2 = data2 |
| | | }; |
| | | taskList.Add(taskInfo); |
| | | |
| | | sceneTarget.TaskList = taskList; |
| | | sceneTarget.DeviceUI = device; |
| | | selectedAction?.Invoke(sceneTarget); |
| | | dialog.RemoveFromParent(); |
| | | }; |
| | | } |
| | | /// <summary> |
| | | /// 空调 |
| | | /// </summary> |
| | | /// <param name="dialog"></param> |
| | | /// <param name="device"></param> |
| | | /// <param name="sceneTarget"></param> |
| | | private void SelectThermostat(FrameLayout dialog, DeviceUI device, SceneTargetDeviceUI sceneTarget) |
| | | { |
| | | /// 温度 |
| | | int tempId=0; |
| | | /// 模式 |
| | | int modelId=0; |
| | | /// 风速 |
| | | int fanid=0; |
| | | |
| | | var selectFL = new FrameLayout |
| | | { |
| | | Y = Application.GetRealHeight(815), |
| | | Height = Application.GetRealHeight(1106), |
| | | }; |
| | | dialog.AddChidren(selectFL); |
| | | //selectFL.Animate = Animate.DownToUp; |
| | | |
| | | var titleBG = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(138 * 2), |
| | | Radius = (uint)Application.GetRealHeight(58), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | selectFL.AddChidren(titleBG); |
| | | |
| | | var titleFL = new FrameLayout |
| | | { |
| | | Height = Application.GetRealHeight(138), |
| | | }; |
| | | selectFL.AddChidren(titleFL); |
| | | |
| | | var line = new Button |
| | | { |
| | | Y = titleFL.Height - 1, |
| | | Height = 1, |
| | | BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor2 |
| | | }; |
| | | titleFL.AddChidren(line); |
| | | |
| | | var cancleBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(80), |
| | | Width = Application.GetRealWidth(200), |
| | | TextColor = ZigbeeColor.Current.GXCTextGrayColor, |
| | | TextSize = 14, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextID = R.MyInternationalizationString.Cancel |
| | | }; |
| | | titleFL.AddChidren(cancleBtn); |
| | | |
| | | var deviceName = new Button |
| | | { |
| | | Width = Application.GetRealWidth(600), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | TextColor = ZigbeeColor.Current.GXCTextBlackColor, |
| | | TextSize = 16, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = device.CommonDevice.DeviceEpointName |
| | | }; |
| | | titleFL.AddChidren(deviceName); |
| | | |
| | | var comfrimBtn = new Button |
| | | { |
| | | X = Application.GetRealWidth(800), |
| | | Width = Application.GetRealWidth(200), |
| | | TextColor = ZigbeeColor.Current.GXCTextSelectedColor2, |
| | | TextSize = 14, |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextID = R.MyInternationalizationString.Complete |
| | | }; |
| | | titleFL.AddChidren(comfrimBtn); |
| | | |
| | | var itemFL = new FrameLayout |
| | | { |
| | | Y = titleFL.Bottom, |
| | | Height = Application.GetRealHeight(968), |
| | | BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor |
| | | }; |
| | | selectFL.AddChidren(itemFL); |
| | | |
| | | var open = new SelectDeviceWithPickViewRow(0, 60); |
| | | itemFL.AddChidren(open); |
| | | open.Init(); |
| | | open.SetTitle(R.MyInternationalizationString.Open); |
| | | open.IsSelected = true; |
| | | |
| | | open.pickerView.OnSelectChangeEvent = (l1, l2, l3) => |
| | | { |
| | | tempId = l1; |
| | | modelId = l2; |
| | | fanid = l3; |
| | | }; |
| | | |
| | | var shut = new SelectSceneStatuRow(0, 60 + 703 + 30); |
| | | itemFL.AddChidren(shut); |
| | | shut.Init(); |
| | | shut.hideLine(true); |
| | | shut.SetTitle(R.MyInternationalizationString.Shut); |
| | | |
| | | open.ClickButton.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | | }; |
| | | |
| | | shut.ClickButton.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | open.IsSelected = false; |
| | | shut.IsSelected = true; |
| | | }; |
| | | |
| | | cancleBtn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.RemoveAll(); |
| | | dialog.RemoveFromParent(); |
| | | }; |
| | | |
| | | if (sceneTarget.TaskList.Count > 0) |
| | | { |
| | | if (sceneTarget.TaskList.Count == 1) |
| | | { |
| | | open.IsSelected = false; |
| | | shut.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | open.IsSelected = true; |
| | | shut.IsSelected = false; |
| | | |
| | | for (int i = 0; i < sceneTarget.TaskList.Count; i++) |
| | | { |
| | | var tasklist = sceneTarget.TaskList[i]; |
| | | if (tasklist.Data1 == 6) |
| | | { |
| | | fanid = open.fanList.IndexOf(tasklist.Data2); |
| | | } |
| | | if (tasklist.Data1 == 3) |
| | | { |
| | | modelId = open.modeList.IndexOf(tasklist.Data2); |
| | | } |
| | | if (tasklist.Data1 == 4 || tasklist.Data1 == 5) |
| | | { |
| | | tempId = open.temperatureList.IndexOf(tasklist.Data2 / 100); |
| | | } |
| | | } |
| | | open.pickerView.setCurrentItems(tempId, modelId, fanid); |
| | | } |
| | | } |
| | | |
| | | comfrimBtn.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | |
| | | var taskList = new List<ZigBee.Device.Scene.TaskListInfo> { }; |
| | | |
| | | int taskType = 5; |
| | | int data1 = 0; |
| | | int data2 = 0; |
| | | |
| | | if (shut.IsSelected) |
| | | { |
| | | //关 |
| | | data1 = 3; |
| | | data2 = 0; |
| | | var taskInfo = new ZigBee.Device.Scene.TaskListInfo |
| | | { |
| | | TaskType = taskType, |
| | | Data1 = data1, |
| | | Data2 = data2 |
| | | }; |
| | | taskList.Add(taskInfo); |
| | | } |
| | | else |
| | | { |
| | | //fan |
| | | var taskInfo = new ZigBee.Device.Scene.TaskListInfo |
| | | { |
| | | TaskType = taskType, |
| | | Data1 = 6, |
| | | Data2 = open.fanList[fanid] |
| | | }; |
| | | taskList.Add(taskInfo); |
| | | |
| | | //mode |
| | | var taskInfo2 = new ZigBee.Device.Scene.TaskListInfo |
| | | { |
| | | TaskType = taskType, |
| | | Data1 = 3, |
| | | Data2 = open.modeList[modelId] |
| | | }; |
| | | taskList.Add(taskInfo2); |
| | | |
| | | //tem |
| | | if (open.modeList[modelId] == 4) |
| | | { |
| | | //heat |
| | | var taskInfo3 = new ZigBee.Device.Scene.TaskListInfo |
| | | { |
| | | TaskType = taskType, |
| | | Data1 = 4, |
| | | Data2 = open.temperatureList[tempId] * 100 |
| | | }; |
| | | taskList.Add(taskInfo3); |
| | | |
| | | } |
| | | else |
| | | { |
| | | //heat |
| | | var taskInfo3 = new ZigBee.Device.Scene.TaskListInfo |
| | | { |
| | | TaskType = taskType, |
| | | Data1 = 5, |
| | | Data2 = open.temperatureList[tempId] * 100 |
| | | }; |
| | | taskList.Add(taskInfo3); |
| | | } |
| | | } |
| | | |
| | | sceneTarget.TaskList = taskList; |
| | | sceneTarget.DeviceUI = device; |
| | | selectedAction?.Invoke(sceneTarget); |
| | | dialog.RemoveFromParent(); |
| | | }; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | } |
| | | } |