| | |
| | | |
| | | public void ShowDialog() |
| | | { |
| | | commandDic.Clear(); |
| | | commandDic.Add(FunctionAttributeKey.OnOff, "off"); |
| | | |
| | | listSwitch = lights.FindAll((obj) => obj.spk == SPK.LightSwitch); |
| | |
| | | lightCCT = lights.FindAll((obj) => obj.spk == SPK.LightCCT); |
| | | lightRGB = lights.FindAll((obj) => obj.spk == SPK.LightRGB); |
| | | |
| | | |
| | | |
| | | var hadDimming = lightDimming.Count > 0; |
| | | var hadCCT = lightCCT.Count > 0; |
| | | var hadRGB = lightRGB.Count > 0; |
| | | if ( hadRGB) |
| | | { |
| | | commandDic.Add(FunctionAttributeKey.RGB, lightRGB[0].GetAttrState(FunctionAttributeKey.RGB)); |
| | | commandDic.Add(FunctionAttributeKey.Brightness, lightRGB[0].GetAttrState(FunctionAttributeKey.Brightness)); |
| | | } |
| | | if (hadCCT) |
| | | { |
| | | commandDic.Add(FunctionAttributeKey.CCT, lightCCT[0].GetAttrState(FunctionAttributeKey.CCT)); |
| | | if (!commandDic.ContainsKey(FunctionAttributeKey.Brightness)) |
| | | { |
| | | commandDic.Add(FunctionAttributeKey.Brightness, lightCCT[0].GetAttrState(FunctionAttributeKey.Brightness)); |
| | | } |
| | | } |
| | | if (hadDimming) |
| | | { |
| | | if (!commandDic.ContainsKey(FunctionAttributeKey.Brightness)) |
| | | { |
| | | commandDic.Add(FunctionAttributeKey.Brightness, lightCCT[0].GetAttrState(FunctionAttributeKey.Brightness)); |
| | | } |
| | | } |
| | | |
| | | var bodyView = new FrameLayout(); |
| | | this.AddChidren(bodyView); |
| | |
| | | X = Application.GetRealWidth(12) + btnTitle.Right, |
| | | Gravity = Gravity.CenterVertical, |
| | | UnSelectedImagePath = "Public/Edit.png", |
| | | //SelectedImagePath = "Public/HookIcon.png" |
| | | }; |
| | | if (string.IsNullOrEmpty(scene.userSceneId)) |
| | | { |
| | | titleView.AddChidren(btnEditIcon); |
| | | } |
| | | else |
| | | { |
| | | btnTitle.Text = scene.name; |
| | | btnTitle.Width = btnTitle.GetTextWidth()+ Application.GetRealWidth(10); |
| | | btnTitle.Gravity = Gravity.Center; |
| | | } |
| | | |
| | | Action<string> callBack = (str) => |
| | | { |
| | |
| | | contentView.AddChidren(bottomView); |
| | | bottomView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | if (string.IsNullOrEmpty(scene.userSceneId)) |
| | | { |
| | | var btnCacel = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(172), |
| | |
| | | int mRectCornerID = HDLUtils.RectCornerBottomRight; |
| | | btnSave.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID); |
| | | |
| | | |
| | | |
| | | btnCacel.MouseUpEventHandler = (sender, e) => { |
| | | btnCacel.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | this.Close(); |
| | | |
| | | //var waitPage = new Loading(); |
| | |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | |
| | | |
| | | btnSave.MouseUpEventHandler = (sender, e) => |
| | | { |
| | |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | waitPage.Hide(); |
| | | waitPage.RemoveFromParent(); |
| | | }); |
| | |
| | | }) |
| | | { IsBackground = true, Priority = ThreadPriority.AboveNormal }.Start(); |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | var btnCacel = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextColor = CSS_Color.TextualColor, |
| | | TextID = StringId.Close, |
| | | }; |
| | | bottomView.AddChidren(btnCacel); |
| | | |
| | | |
| | | //例:右下圆角 大小为50 |
| | | //int mRectCornerID = HDLUtils.RectCornerBottomRight; |
| | | //btnSave.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID); |
| | | |
| | | btnCacel.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | this.Close(); |
| | | }; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | /// <param name="attrView"></param> |
| | | void LoadDimmingAttrView(VerticalScrolViewLayout attrView) |
| | | { |
| | | |
| | | commandDic.TryAdd(FunctionAttributeKey.Percent, "0"); |
| | | string briValue = ""; |
| | | commandDic.TryGetValue(FunctionAttributeKey.Percent,out briValue); |
| | | |
| | | var dimmingView = new FrameLayout() |
| | | { |
| | |
| | | { |
| | | #region 色温 |
| | | |
| | | string valueStr = "2700"; |
| | | commandDic.TryGetValue(FunctionAttributeKey.Percent, out valueStr); |
| | | int value = Convert.ToInt32(valueStr) / 100; |
| | | |
| | | var cctView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(54 + 11) |
| | |
| | | barColorTemplatrue.SeekBarBackgroundColor = 0x00000000; |
| | | cctView.AddChidren(barColorTemplatrue); |
| | | barColorTemplatrue.Y = btnTempClolorMin.Y - (barColorTemplatrue.Height - btnTempClolorMin.Height) / 2; |
| | | var cct = 27; |
| | | //int.TryParse(cctLight.status.Find((obj) => obj.key == FunctionAttributeKey.CCT).value, out cct); |
| | | barColorTemplatrue.Progress = cct; |
| | | barColorTemplatrue.Progress = value; |
| | | //设置初始值 |
| | | btnTempClolor.Text = Language.StringByID(StringId.ColorTemperature) + " " + (barColorTemplatrue.Progress * 100 + "K"); |
| | | barColorTemplatrue.OnProgressChangedEvent = (sender, e) => |
| | |
| | | { |
| | | |
| | | #region RGB |
| | | commandDic.TryAdd(FunctionAttributeKey.RGB, "255,255,255"); |
| | | |
| | | string value = "255,255,255"; |
| | | commandDic.TryGetValue(FunctionAttributeKey.Percent, out value); |
| | | |
| | | var rgbView = new FrameLayout() |
| | | { |
| | |
| | | string rgbString = (e2[0] + "," + e2[1] + "," + e2[2]).ToString(); |
| | | commandDic[FunctionAttributeKey.RGB] = rgbString; |
| | | btnCurColor.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString)); |
| | | foreach (var rgbTemp in lightRGB) |
| | | { |
| | | rgbTemp.SetAttrState(FunctionAttributeKey.RGB, rgbString); |
| | | } |
| | | }; |
| | | colorPicker.MouseDownEventHandler += (sender, e) => |
| | | { |
| | |
| | | btnWhiteRound.Visible = true; |
| | | } |
| | | }; |
| | | colorPicker.MouseUpEventHandler = (sender, e) => { |
| | | foreach (var rgbTemp in lightRGB) |
| | | { |
| | | Dictionary<string, string> d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.RGB, tempLight.GetRGBcolorString(rgbTemp)); |
| | | Control.Ins.SendWriteCommand(rgbTemp, d, false, 0); |
| | | } |
| | | }; |
| | | |
| | | colorPicker.MouseMoveEventHandler += (sender, e) => |
| | | { |