| | |
| | | /// </summary> |
| | | Button btnFloor; |
| | | /// <summary> |
| | | /// 全选按钮 |
| | | /// </summary> |
| | | Button btnChooseAll; |
| | | /// <summary> |
| | | /// 功能列表集合显示区域 |
| | | /// </summary> |
| | | static VerticalScrolViewLayout functionListView; |
| | |
| | | btnFloor = new Button() |
| | | { |
| | | X = btnFloorDownIcon.Right, |
| | | Y = Application.GetRealHeight(18), |
| | | //Y = Application.GetRealHeight(18), |
| | | Width = Application.GetRealWidth(200), |
| | | Height = Application.GetMinRealAverage(16), |
| | | //Height = Application.GetMinRealAverage(16+18*2), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | Text = DB_ResidenceData.Instance.CurFloor.roomName, |
| | | }; |
| | | roomFloorChangeView.AddChidren(btnFloor); |
| | | |
| | | btnChooseAll = new Button() |
| | | { |
| | | X = Application.GetRealWidth(245), |
| | | Width = Application.GetRealWidth(109), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextID = StringId.SelectedAll, |
| | | }; |
| | | if(sceneLishtList.Count>0) |
| | | { |
| | | btnChooseAll.TextID = StringId.Cancel; |
| | | } |
| | | roomFloorChangeView.AddChidren(btnChooseAll); |
| | | btnChooseAll.MouseUpEventHandler = (sender, e) => { |
| | | if (sceneLishtList.Count > 0) |
| | | { |
| | | sceneLishtList.Clear(); |
| | | btnChooseAll.TextID = StringId.SelectAll; |
| | | btnConfrim.IsSelected = false; |
| | | } |
| | | else |
| | | { |
| | | sceneLishtList.AddRange(lightList); |
| | | btnChooseAll.TextID = StringId.Cancel; |
| | | btnConfrim.IsSelected = true; |
| | | } |
| | | LoadLightRow(lightList); |
| | | }; |
| | | |
| | | #endregion |
| | | |
| | | functionListView = new VerticalScrolViewLayout() |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 显示的设备的总数 |
| | | /// </summary> |
| | | int showCount = 0; |
| | | |
| | | /// <summary> |
| | | /// 加载功能row |
| | | /// </summary> |
| | | /// <param name="lightList"></param> |
| | | void LoadLightRow(List<Function> functions) |
| | | void LoadLightRow(List<Function> functions, bool isAppend = false) |
| | | { |
| | | functionListView.RemoveAll(); |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(""); |
| | | |
| | | foreach (var function in functions) |
| | | new System.Threading.Thread(() => |
| | | { |
| | | var functionDiv = new LightRow(function) |
| | | try |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(62), |
| | | Radius = (uint)Application.GetMinRealAverage(12), |
| | | BorderColor = 0x00FFFFFF, |
| | | BorderWidth = 1, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Tag = function.spk + function.sid |
| | | }; |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (!isAppend) |
| | | { |
| | | showCount = 0; |
| | | functionListView.RemoveAll(); |
| | | } |
| | | int i = 0; |
| | | foreach (var function in functions) |
| | | { |
| | | i++; |
| | | if (i > 100) |
| | | { |
| | | break; |
| | | } |
| | | showCount++; |
| | | var functionDiv = new LightRow(function) |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(62), |
| | | Radius = (uint)Application.GetMinRealAverage(12), |
| | | BorderColor = 0x00FFFFFF, |
| | | BorderWidth = 1, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Tag = function.spk + function.sid |
| | | }; |
| | | |
| | | Action setAction = () => |
| | | Action setAction = () => |
| | | { |
| | | if (sceneLishtList.Count > 0) |
| | | { |
| | | btnConfrim.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | btnConfrim.IsSelected = false; |
| | | } |
| | | }; |
| | | |
| | | functionDiv.LoadDiv(sceneLishtList, setAction); |
| | | functionListView.AddChidren(functionDiv); |
| | | |
| | | functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) }); |
| | | } |
| | | |
| | | if (functions.Count > showCount) |
| | | { |
| | | var btnAppend = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(60), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | Text = "加载更多", |
| | | }; |
| | | if (Language.CurrentLanguage != "Chinese") |
| | | { |
| | | btnAppend.Text = "Load more"; |
| | | } |
| | | functionListView.AddChidren(btnAppend); |
| | | btnAppend.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | btnAppend.RemoveFromParent(); |
| | | LoadLightRow(functions, true); |
| | | }; |
| | | } |
| | | }); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | if (sceneLishtList.Count > 0) |
| | | MainPage.Log("ShowFunctionRowError : " + ex.Message); |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnConfrim.IsSelected = true; |
| | | } |
| | | else |
| | | { |
| | | btnConfrim.IsSelected = false; |
| | | } |
| | | }; |
| | | |
| | | functionDiv.LoadDiv(sceneLishtList,setAction); |
| | | functionListView.AddChidren(functionDiv); |
| | | |
| | | functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) }); |
| | | } |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | |
| | |
| | | var form = new FloorRoomSelectPopupView(); |
| | | form.ShowDeviceFunctionView(btnFloor, this.lightList, (selectId, listFunc) => |
| | | { |
| | | btnChooseAll.MouseUpEventHandler = (sender2, e2) => { |
| | | if (sceneLishtList.Count > 0) |
| | | { |
| | | sceneLishtList.Clear(); |
| | | btnChooseAll.TextID = StringId.SelectAll; |
| | | btnConfrim.IsSelected = false; |
| | | } |
| | | else |
| | | { |
| | | sceneLishtList.AddRange(listFunc); |
| | | btnChooseAll.TextID = StringId.Cancel; |
| | | btnConfrim.IsSelected = true; |
| | | } |
| | | LoadLightRow(listFunc); |
| | | }; |
| | | nowSelectId = selectId; |
| | | //重新加载界面 |
| | | LoadLightRow(listFunc); |
| | |
| | | SelectedImagePath = "FunctionIcon/Light/LightScene/CheckOnIcon.png", |
| | | IsSelected = functions.Find((obj) => obj.deviceId == function.deviceId) != null |
| | | }; |
| | | if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl) |
| | | { |
| | | btnSelect.X = Application.GetRealWidth(323); |
| | | } |
| | | bodyDiv.AddChidren(btnSelect); |
| | | |
| | | btnSelect.MouseUpEventHandler = (sender, e) => { |
| | | Application.HideSoftInput(); |
| | | btnSelect.IsSelected = !btnSelect.IsSelected; |
| | | if(btnSelect.IsSelected) |
| | | { |
| | |
| | | |
| | | 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, lightDimming[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" |
| | | }; |
| | | titleView.AddChidren(btnEditIcon); |
| | | 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 }); |
| | | |
| | | var btnCacel = new Button() |
| | | if (string.IsNullOrEmpty(scene.userSceneId)) |
| | | { |
| | | Width = Application.GetRealWidth(172), |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextColor = CSS_Color.TextualColor, |
| | | TextID = StringId.Cancel, |
| | | }; |
| | | bottomView.AddChidren(btnCacel); |
| | | |
| | | var btnSave = new Button() |
| | | { |
| | | X = Application.GetRealWidth(172), |
| | | Width = Application.GetRealWidth(172), |
| | | Height = Application.GetRealHeight(46), |
| | | BackgroundColor = CSS_Color.MainColor, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.Save |
| | | }; |
| | | bottomView.AddChidren(btnSave); |
| | | |
| | | //例:右下圆角 大小为50 |
| | | int mRectCornerID = HDLUtils.RectCornerBottomRight; |
| | | btnSave.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID); |
| | | |
| | | |
| | | |
| | | btnCacel.MouseUpEventHandler = (sender, e) => { |
| | | this.Close(); |
| | | |
| | | //var waitPage = new Loading(); |
| | | //MainPage.BaseView.AddChidren(waitPage); |
| | | //waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | //new Thread(() => |
| | | //{ |
| | | // try |
| | | // { |
| | | // foreach (var light in lights) |
| | | // { |
| | | // Dictionary<string, string> sendDate = new Dictionary<string, string>(); |
| | | // //赋值场景功能数据 |
| | | // foreach (var attr in light.GetAttributes()) |
| | | // { |
| | | // if (commandDic.ContainsKey(attr)) |
| | | // { |
| | | // try |
| | | // { |
| | | // sendDate.Add(attr, commandDic[attr]); |
| | | // } |
| | | // catch { } |
| | | // } |
| | | |
| | | // } |
| | | // Control.Ins.SendWriteCommand(light, sendDate); |
| | | // Thread.Sleep(50); |
| | | // } |
| | | // } |
| | | // catch |
| | | // { } |
| | | // finally |
| | | // { |
| | | // Application.RunOnMainThread(() => |
| | | // { |
| | | // waitPage.Hide(); |
| | | // new PublicAssmebly().TipMsgAutoClose("组合控制已执行", true); |
| | | // if (waitPage != null) |
| | | // { |
| | | // //backAction(null); |
| | | // waitPage.RemoveFromParent(); |
| | | // } |
| | | // }); |
| | | // } |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | |
| | | |
| | | btnSave.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (string.IsNullOrEmpty(scene.name)) |
| | | var btnCacel = new Button() |
| | | { |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.NameCannotBeEmpty), |
| | | Direction = AMPopTipDirection.None, |
| | | }.Show(bodyView); |
| | | return; |
| | | } |
| | | foreach (var tempRoom in FunctionList.List.scenes) |
| | | Width = Application.GetRealWidth(172), |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextColor = CSS_Color.TextualColor, |
| | | TextID = StringId.Cancel, |
| | | }; |
| | | bottomView.AddChidren(btnCacel); |
| | | |
| | | var btnSave = new Button() |
| | | { |
| | | if (scene.name == tempRoom.name) |
| | | X = Application.GetRealWidth(172), |
| | | Width = Application.GetRealWidth(172), |
| | | Height = Application.GetRealHeight(46), |
| | | BackgroundColor = CSS_Color.MainColor, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.Save |
| | | }; |
| | | bottomView.AddChidren(btnSave); |
| | | |
| | | //例:右下圆角 大小为50 |
| | | int mRectCornerID = HDLUtils.RectCornerBottomRight; |
| | | btnSave.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID); |
| | | |
| | | btnCacel.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | this.Close(); |
| | | |
| | | //var waitPage = new Loading(); |
| | | //MainPage.BaseView.AddChidren(waitPage); |
| | | //waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | //new Thread(() => |
| | | //{ |
| | | // try |
| | | // { |
| | | // foreach (var light in lights) |
| | | // { |
| | | // Dictionary<string, string> sendDate = new Dictionary<string, string>(); |
| | | // //赋值场景功能数据 |
| | | // foreach (var attr in light.GetAttributes()) |
| | | // { |
| | | // if (commandDic.ContainsKey(attr)) |
| | | // { |
| | | // try |
| | | // { |
| | | // sendDate.Add(attr, commandDic[attr]); |
| | | // } |
| | | // catch { } |
| | | // } |
| | | |
| | | // } |
| | | // Control.Ins.SendWriteCommand(light, sendDate); |
| | | // Thread.Sleep(50); |
| | | // } |
| | | // } |
| | | // catch |
| | | // { } |
| | | // finally |
| | | // { |
| | | // Application.RunOnMainThread(() => |
| | | // { |
| | | // waitPage.Hide(); |
| | | // new PublicAssmebly().TipMsgAutoClose("组合控制已执行", true); |
| | | // if (waitPage != null) |
| | | // { |
| | | // //backAction(null); |
| | | // waitPage.RemoveFromParent(); |
| | | // } |
| | | // }); |
| | | // } |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | }; |
| | | |
| | | btnSave.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (string.IsNullOrEmpty(scene.name)) |
| | | { |
| | | new PublicAssmebly().TipMsg(StringId.Tip, StringId.NameAlreadyExists); |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.NameCannotBeEmpty), |
| | | Direction = AMPopTipDirection.None, |
| | | }.Show(bodyView); |
| | | return; |
| | | } |
| | | } |
| | | var waitPage = new Loading(); |
| | | MainPage.BaseView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | new Thread(() => |
| | | { |
| | | try |
| | | foreach (var tempRoom in FunctionList.List.scenes) |
| | | { |
| | | var serverScene = new Scene(); |
| | | for (int i = 0; i < lights.Count; i++) |
| | | if (scene.name == tempRoom.name) |
| | | { |
| | | var light = lights[i]; |
| | | new PublicAssmebly().TipMsg(StringId.Tip, StringId.NameAlreadyExists); |
| | | return; |
| | | } |
| | | } |
| | | var waitPage = new Loading(); |
| | | MainPage.BaseView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | new Thread(() => |
| | | { |
| | | try |
| | | { |
| | | var serverScene = new Scene(); |
| | | for (int i = 0; i < lights.Count; i++) |
| | | { |
| | | var light = lights[i]; |
| | | //赋值场景功能数据 |
| | | foreach (var attr in light.GetAttributes()) |
| | | { |
| | | if (commandDic.ContainsKey(attr)) |
| | | { |
| | | try |
| | | if (commandDic.ContainsKey(attr)) |
| | | { |
| | | light.SetAttrState(attr, commandDic[attr]); |
| | | try |
| | | { |
| | | light.SetAttrState(attr, commandDic[attr]); |
| | | } |
| | | catch { } |
| | | } |
| | | catch { } |
| | | } |
| | | } |
| | | //转换场景的功能对象 |
| | | var sceneFunction = light.ConvertSceneFunction(); |
| | | //查询有没有存在 |
| | | var temp = scene.functions.Find((obj) => obj.sid == sceneFunction.sid); |
| | | //赋值 |
| | | if (temp != null) |
| | | { |
| | | temp = sceneFunction; |
| | | } |
| | | else |
| | | { |
| | | scene.functions.Add(sceneFunction); |
| | | } |
| | | } |
| | | var result = FunctionList.List.AddScene(scene, out serverScene); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (result == StateCode.SUCCESS) |
| | | { |
| | | scene.userSceneId = serverScene.userSceneId; |
| | | FunctionList.List.scenes.Add(scene); |
| | | backAction?.Invoke(scene); |
| | | this.Close(); |
| | | } |
| | | else |
| | | { |
| | | if (result == "124005") |
| | | IMessageCommon.Current.ShowErrorInfoAlter(Language.StringByID(StringId.GatewayOffline)); |
| | | { |
| | | temp = sceneFunction; |
| | | } |
| | | else |
| | | IMessageCommon.Current.ShowErrorInfoAlter(result); |
| | | { |
| | | scene.functions.Add(sceneFunction); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | waitPage.Hide(); |
| | | waitPage.RemoveFromParent(); |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true, Priority = ThreadPriority.AboveNormal }.Start(); |
| | | }; |
| | | var result = FunctionList.List.AddScene(scene, out serverScene); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (result == StateCode.SUCCESS) |
| | | { |
| | | scene.userSceneId = serverScene.userSceneId; |
| | | FunctionList.List.scenes.Add(scene); |
| | | backAction?.Invoke(scene); |
| | | this.Close(); |
| | | } |
| | | else |
| | | { |
| | | if (result == "124005") |
| | | IMessageCommon.Current.ShowErrorInfoAlter(Language.StringByID(StringId.GatewayOffline)); |
| | | else |
| | | IMessageCommon.Current.ShowErrorInfoAlter(result); |
| | | } |
| | | }); |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | 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.Brightness,out briValue); |
| | | |
| | | var dimmingView = new FrameLayout() |
| | | { |
| | |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextID = StringId.Brightness, |
| | | }; |
| | | btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + commandDic[FunctionAttributeKey.Percent] + "%"; |
| | | btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + commandDic[FunctionAttributeKey.Brightness] + "%"; |
| | | dimmingView.AddChidren(btnBrightnessText); |
| | | |
| | | |
| | |
| | | ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | ProgressBarColor = CSS_Color.AuxiliaryColor1, |
| | | MaxValue = 100, |
| | | Progress = Convert.ToInt32(commandDic[FunctionAttributeKey.Percent]), |
| | | Progress = Convert.ToInt32(commandDic[FunctionAttributeKey.Brightness]), |
| | | SeekBarPadding = Application.GetRealWidth(20), |
| | | IsProgressTextShow = false, |
| | | ProgressChangeDelayTime = 0, |
| | |
| | | btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%"; |
| | | }; |
| | | dimmerBar.OnStopTrackingTouchEvent = (sender, e) => { |
| | | commandDic[FunctionAttributeKey.Percent] = dimmerBar.Progress.ToString(); |
| | | commandDic[FunctionAttributeKey.Brightness] = dimmerBar.Progress.ToString(); |
| | | btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%"; |
| | | |
| | | foreach (var light in lights) |
| | |
| | | void LoadCctAttrView(VerticalScrolViewLayout attrView) |
| | | { |
| | | #region 色温 |
| | | |
| | | string valueStr = "2700"; |
| | | commandDic.TryGetValue(FunctionAttributeKey.CCT, out valueStr); |
| | | int value = Convert.ToInt32(valueStr) / 100; |
| | | |
| | | var cctView = new FrameLayout() |
| | | { |
| | |
| | | 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.RGB, 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) => |
| | | { |