| | |
| | | <Properties StartupConfiguration="{D998E133-F0DD-4760-BE3C-461632F54DA4}|Default"> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.47f89eb181110cd1c1050db004cedf20a2ec9c7f" /> |
| | | <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/Common/HDLCommon.cs"> |
| | | <MonoDevelop.Ide.ItemProperties.HDL-ON__iOS PreferredExecutionTarget="MonoDevelop.IPhone.IPhoneDeviceTarget.6242be7109c740c6cb8999a8904b6e0ea8d45192" /> |
| | | <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/Entity/Function/Light.cs"> |
| | | <Files> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/AddRoom/AddRoomPage.cs" Line="490" Column="28" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPage.cs" Line="159" Column="10" /> |
| | | <File FileName="HDL_ON/UI/UI2/4-PersonalCenter/RoomListManage/RoomEditPageBLL.cs" Line="33" Column="18" /> |
| | | <File FileName="HDL_ON/UI/UI2/2-Classification/RoomPageBLL.cs" Line="33" Column="21" /> |
| | | <File FileName="HDL_ON/Entity/Room.cs" Line="466" Column="23" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/Music/View/PlayView.cs" Line="221" Column="17" /> |
| | | <File FileName="HDL_ON/UI/UI2/3-Intelligence/IntelligencePage.cs" Line="88" Column="14" /> |
| | | <File FileName="HDL_ON/UI/UI2/2-Classification/ClassificationPageBLL.cs" Line="340" Column="68" /> |
| | | <File FileName="HDL_ON/Common/HDLCommon.cs" Line="294" Column="7" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPageBLL.cs" Line="69" Column="31" /> |
| | | <File FileName="HDL_ON/UI/UI2/FuntionControlView/Light/DimmerPage.cs" Line="40" Column="36" /> |
| | | <File FileName="HDL_ON/Entity/Function/Function.cs" Line="256" Column="21" /> |
| | | <File FileName="HDL_ON/Entity/Function/Light.cs" Line="94" Column="95" /> |
| | | </Files> |
| | | <Pads> |
| | | <Pad Id="ProjectPad"> |
| | | <State name="__root__"> |
| | | <Node name="HDL_APP_Project" expanded="True"> |
| | | <Node name="HDL_ON" expanded="True"> |
| | | <Node name="Common" expanded="True"> |
| | | <Node name="HDLCommon.cs" selected="True" /> |
| | | <Node name="Common" expanded="True" /> |
| | | <Node name="DAL" expanded="True"> |
| | | <Node name="DriverLayer" expanded="True" /> |
| | | <Node name="Mqtt" expanded="True" /> |
| | | <Node name="Server" expanded="True" /> |
| | | </Node> |
| | | <Node name="Entity" expanded="True"> |
| | | <Node name="Function" expanded="True"> |
| | | <Node name="Light.cs" selected="True" /> |
| | | </Node> |
| | | </Node> |
| | | <Node name="UI" expanded="True"> |
| | | <Node name="UI0-Public" expanded="True" /> |
| | | <Node name="UI2" expanded="True"> |
| | | <Node name="2-Classification" expanded="True" /> |
| | | <Node name="3-Intelligence" expanded="True"> |
| | | <Node name="Scene" expanded="True" /> |
| | | </Node> |
| | | <Node name="4-PersonalCenter" expanded="True"> |
| | | <Node name="RoomListManage" expanded="True"> |
| | | <Node name="AddRoom" expanded="True" /> |
| | | </Node> |
| | | <Node name="UnlockSetting" expanded="True" /> |
| | | </Node> |
| | | <Node name="FuntionControlView" expanded="True"> |
| | | <Node name="AC" expanded="True" /> |
| | | <Node name="Electrical" expanded="True" /> |
| | | <Node name="FoolHeating" expanded="True" /> |
| | | <Node name="Light" expanded="True" /> |
| | | <Node name="Music" expanded="True"> |
| | | <Node name="View" expanded="True" /> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | | </Node> |
| | |
| | | <BreakpointStore> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/Entity/Function/Scene.cs" relfile="HDL_ON/Entity/Function/Scene.cs" line="323" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs" relfile="HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs" line="505" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs" relfile="HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs" line="76" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs" relfile="HDL_ON/UI/UI0-Public/PublicAssmeblyBLL.cs" line="86" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs" relfile="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs" line="465" column="1" /> |
| | | <Breakpoint file="/Users/kaede/Desktop/HDL_APP_Project/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs" relfile="HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs" line="458" column="1" /> |
| | | </BreakpointStore> |
| | | </MonoDevelop.Ide.DebuggingService.Breakpoints> |
| | | <MultiItemStartupConfigurations /> |
| | |
| | | public void UpdataFunctionStatus(string revString) |
| | | { |
| | | MainPage.Log($"A协议更新状态:{revString}"); |
| | | if(Control.Ins.myUdp!= null) |
| | | { |
| | | //重置重启udp判断调整 |
| | | Ins.myUdp.controlLostCount = 0; |
| | | } |
| | | var temp = Newtonsoft.Json.JsonConvert.DeserializeObject<AlinkFunctionStatusObj>(revString); |
| | | if (temp != null) |
| | | { |
| | |
| | | var bytes = new byte[] { function.bus_Data.loopId, |
| | | b, |
| | | 254, 0,Convert.ToByte(light.fadeTime) ,3, |
| | | (byte)light.redColor,(byte)light.greenColor, |
| | | (byte)light.blueColor, |
| | | (byte)light.RedColor,(byte)light.GreenColor, |
| | | (byte)light.BlueColor, |
| | | 0,0}; |
| | | ControlBytesSend(Command.SetLogicLoopColor, subnetId, deviceId, bytes, 1); |
| | | break; |
| | |
| | | |
| | | try |
| | | { |
| | | //MainPage.Log("发送数据:" + SendFlag); |
| | | MainPage.Log("发送数据:" + SendFlag); |
| | | UdpSocket._BusSocket.AsyncBeginSend(Packet); |
| | | Packet.HaveSendCount--; |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | //private void signAlinkPacket() |
| | | //{ |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// 发送数据 |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | public void SendLocalHdlLinkData(byte[] sendBytes) |
| | | { |
| | | if (controlLostCount > 3) |
| | | { |
| | | UdpSocket._BusSocket.Stop(); |
| | | UdpSocket._BusSocket.Start(8585); |
| | | controlLostCount = 0; |
| | | } |
| | | Packet = new Packet(sendBytes, new System.Net.IPEndPoint(System.Net.IPAddress.Parse(Control.Ins.reportIp), 8585)); |
| | | Packet.HaveSendCount = 4;//ps:没有重发,后期有时间可以增加重发判断 |
| | | Packet.HaveSendCount = 2;//ps:没有重发,后期有时间可以增加重发判断 |
| | | |
| | | System.Threading.Thread thread = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(managerSendCount)); |
| | | thread.IsBackground = true; |
| | | thread.Start(Packet); |
| | | //wait();不需要等待 |
| | | //MainPage.Log($"发送Hdl-Link数据,IP:{Control.Ins.reportIp}:8585"); |
| | | controlLostCount++; |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | rgb.brightness = receiveBytes[1]; |
| | | rgb.lastState = Language.StringByID(StringId.Brightness) + " : " + receiveBytes[1] + "%"; |
| | | } |
| | | rgb.redColor = receiveBytes[6]; |
| | | rgb.greenColor = receiveBytes[7]; |
| | | rgb.blueColor = receiveBytes[8]; |
| | | rgb.SetRGBcolor(new byte[] { receiveBytes[6], receiveBytes[7], receiveBytes[8] }); |
| | | |
| | | HomePage.UpdataFunctionStates(rgb); |
| | | RoomPage.UpdataStates(rgb); |
| | |
| | | { |
| | | sFunc.status.Add(new SceneFunctionStatus() { key = attr.key, value = attr.curValue.ToString() }); |
| | | } |
| | | sFunc.sid = this.sid; |
| | | } |
| | | sFunc.sid = this.sid; |
| | | return sFunc; |
| | | } |
| | | |
| | |
| | | /// <summary> |
| | | /// 颜色 |
| | | /// </summary> |
| | | public const string Color = "color"; |
| | | public const string RGB = "rgb"; |
| | | /// <summary> |
| | | /// 渐变时间 |
| | | /// </summary> |
| | | public const string FadeTime = "fade_time"; |
| | | /// <summary> |
| | | /// 模式 |
| | | /// </summary> |
| | |
| | | { |
| | | if (trait_fadeTime == null) |
| | | { |
| | | trait_fadeTime = attributes.Find((obj) => obj.key == "fade_time"); |
| | | trait_fadeTime = attributes.Find((obj) => obj.key == FunctionAttributeKey.FadeTime); |
| | | //找不到属性需要声明一个,防止报错闪退 |
| | | if (trait_fadeTime == null) |
| | | { |
| | | trait_fadeTime = new FunctionAttributes() |
| | | { |
| | | key = "fade_time", |
| | | key = FunctionAttributeKey.FadeTime, |
| | | value = new List<string> { "up", "down" }, |
| | | max = 10, |
| | | min = 0, |
| | |
| | | } |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 获取rgb颜色 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public int GetRGBcolor() |
| | | { |
| | | if (trait_color == null) |
| | | { |
| | | trait_color = attributes.Find((obj) => obj.key == FunctionAttributeKey.RGB); |
| | | //找不到属性需要声明一个,防止报错闪退 |
| | | if (trait_color == null) |
| | | { |
| | | trait_color = new FunctionAttributes() |
| | | { |
| | | key = "color", |
| | | value = new List<string> { "255,255,255" }, |
| | | curValue = "255,255,255" |
| | | }; |
| | | } |
| | | if (trait_color.curValue.ToString() == "{}") |
| | | trait_color.curValue = "255,255,255"; |
| | | int.TryParse(trait_color.curValue.ToString().Split(",")[0], out redColor); |
| | | int.TryParse(trait_color.curValue.ToString().Split(",")[1], out greenColor); |
| | | int.TryParse(trait_color.curValue.ToString().Split(",")[2], out blueColor); |
| | | } |
| | | |
| | | int recolor = redColor * 256 * 256 + greenColor * 256 + blueColor; |
| | | |
| | | return recolor; |
| | | } |
| | | /// <summary> |
| | | /// 获取rgb 控制字符串 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public string GetRGBcolorString() |
| | | { |
| | | return redColor + "," + greenColor + "," + blueColor; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 设置rgb颜色 |
| | | /// </summary> |
| | | public void SetRGBcolor(byte[] color) |
| | | { |
| | | redColor = color[0]; |
| | | greenColor = color[1]; |
| | | blueColor = color[2]; |
| | | } |
| | | |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public FunctionAttributes trait_color; |
| | | /// <summary> |
| | | /// RGB颜色 |
| | | /// 255255255 |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public int color |
| | | int redColor = 255; |
| | | int greenColor = 255; |
| | | int blueColor = 255; |
| | | |
| | | public int RedColor { |
| | | get |
| | | { |
| | | return redColor; |
| | | } |
| | | } |
| | | public int GreenColor { |
| | | get |
| | | { |
| | | return greenColor; |
| | | } |
| | | } |
| | | public int BlueColor |
| | | { |
| | | get |
| | | { |
| | | if (trait_color == null) |
| | | { |
| | | trait_color = attributes.Find((obj) => obj.key == "color"); |
| | | //找不到属性需要声明一个,防止报错闪退 |
| | | if (trait_color == null) |
| | | { |
| | | trait_color = new FunctionAttributes() |
| | | { |
| | | key = "color", |
| | | value = new List<string> { "FFFFFF" }, |
| | | max = 0xFFFFFF, |
| | | min = 0x00000F, |
| | | curValue = 0x00000F |
| | | }; |
| | | } |
| | | if (trait_color.curValue.ToString() == "{}") |
| | | trait_color.curValue = 0x00000F; |
| | | } |
| | | return Convert.ToInt32(trait_color.curValue); |
| | | } |
| | | set |
| | | { |
| | | try |
| | | { |
| | | trait_color.curValue = value; |
| | | } |
| | | catch |
| | | { |
| | | MainPage.Log("color 数据刷新失败."); |
| | | } |
| | | } |
| | | } |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public int redColor |
| | | { |
| | | get { |
| | | try |
| | | { |
| | | return color >> 16; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"Get red color error : {ex.Message}"); |
| | | return 0; |
| | | } |
| | | } |
| | | set |
| | | { |
| | | try |
| | | { |
| | | var rc = value << 16; |
| | | color = rc + (color & 0xFFFF); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"set red color error : {ex.Message}"); |
| | | } |
| | | } |
| | | } |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public int greenColor |
| | | { |
| | | get |
| | | { |
| | | try |
| | | { |
| | | return (color & 0xFFFF) >> 8; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"Get green color error : {ex.Message}"); |
| | | return 0; |
| | | } |
| | | } |
| | | set |
| | | { |
| | | try |
| | | { |
| | | var gc = value << 8; |
| | | color = gc + (color & 0xFF00FF); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"set green color error : {ex.Message}"); |
| | | } |
| | | } |
| | | } |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public int blueColor |
| | | { |
| | | get |
| | | { |
| | | try |
| | | { |
| | | return color & 0xFF; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"Get blue color error : {ex.Message}"); |
| | | return 0; |
| | | } |
| | | } |
| | | set |
| | | { |
| | | try |
| | | { |
| | | color = value + (color & 0xFFFF00); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"set blue color error : {ex.Message}"); |
| | | } |
| | | return blueColor; |
| | | } |
| | | } |
| | | } |
| | |
| | | var deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(pack.Data.ToString()); |
| | | if (deviceList != null) |
| | | { |
| | | for (int i =0;i < List.GetDeviceFunctionList().Count;) |
| | | if (List.GetDeviceFunctionList().Count > 0) |
| | | { |
| | | var localFunction = List.GetDeviceFunctionList()[i]; |
| | | var newFunction = deviceList.list.Find((obj) => obj.deviceId == localFunction.deviceId); |
| | | if (newFunction == null)//如果云端最新数据没有该条数据,则本地需要删掉该数据记录 |
| | | for (int i = 0; i < List.GetDeviceFunctionList().Count;) |
| | | { |
| | | List.DeleteFunction(localFunction); |
| | | } |
| | | else |
| | | { |
| | | i++; |
| | | if (localFunction.modifyTime != newFunction.modifyTime) |
| | | var localFunction = List.GetDeviceFunctionList()[i]; |
| | | if (localFunction.functionCategory == FunctionCategory.Music) |
| | | { |
| | | MainPage.Log($"local:{localFunction.modifyTime}\r\n server:{newFunction.modifyTime}"); |
| | | localFunction.name = newFunction.name; |
| | | localFunction.collect = newFunction.collect; |
| | | localFunction.modifyTime = newFunction.modifyTime; |
| | | localFunction.roomIds = newFunction.roomIds; |
| | | localFunction.bus_Data = newFunction.bus_Data; |
| | | localFunction.SaveFunctionData(false); |
| | | i++; |
| | | continue; |
| | | } |
| | | deviceList.list.Remove(newFunction);//操作完的数据清理掉,剩下的就是新增的功能 |
| | | var newFunction = deviceList.list.Find((obj) => obj.deviceId == localFunction.deviceId); |
| | | if (newFunction == null)//如果云端最新数据没有该条数据,则本地需要删掉该数据记录 |
| | | { |
| | | List.DeleteFunction(localFunction); |
| | | } |
| | | else |
| | | { |
| | | i++; |
| | | if (localFunction.modifyTime != newFunction.modifyTime) |
| | | { |
| | | MainPage.Log($"local:{localFunction.modifyTime}\r\n server:{newFunction.modifyTime}"); |
| | | localFunction.name = newFunction.name; |
| | | localFunction.collect = newFunction.collect; |
| | | localFunction.modifyTime = newFunction.modifyTime; |
| | | localFunction.roomIds = newFunction.roomIds; |
| | | localFunction.bus_Data = newFunction.bus_Data; |
| | | localFunction.SaveFunctionData(false); |
| | | } |
| | | deviceList.list.Remove(newFunction);//操作完的数据清理掉,剩下的就是新增的功能 |
| | | } |
| | | } |
| | | } |
| | | //处理剩下的新增功能 |
| | |
| | | case FunctionAttributeKey.Brightness: |
| | | text = Language.StringByID(StringId.Brightness); |
| | | break; |
| | | case FunctionAttributeKey.Color: |
| | | case FunctionAttributeKey.RGB: |
| | | text = Language.StringByID(StringId.ColorValue); |
| | | break; |
| | | case FunctionAttributeKey.Mode: |
| | |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = isWhite ? CSS_Color.FirstLevelTitleColor : CSS_Color.MainBackgroundColor, |
| | | Text = msg, |
| | | IsMoreLines = true, |
| | | }; |
| | | frame.AddChidren(btnTipMsg); |
| | | |
| | |
| | | switch (function.functionType) |
| | | { |
| | | case FunctionType.Relay: |
| | | var relayView = new RelayPage(function as Light); |
| | | MainPage.BasePageView.AddChidren(relayView); |
| | | relayView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | if (function.spk == SPK.ElectricSocket) |
| | | { |
| | | var s1View = new SocketPage(function as SwitchSocket); |
| | | MainPage.BasePageView.AddChidren(s1View); |
| | | s1View.LoadPage(btnCollectionIcon, btnName, btnFromFloor); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | else |
| | | { |
| | | var relayView = new RelayPage(function as Light); |
| | | MainPage.BasePageView.AddChidren(relayView); |
| | | relayView.LoadPage(btnCollectionIcon, btnName, btnFromFloor); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | } |
| | | break; |
| | | case FunctionType.RGB: |
| | | var rgbView = new RGBPage(function as Light); |
| | |
| | | { |
| | | Button btnFunctionCount = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16) + Application.GetRealWidth(7 * functionCount.ToString().Length), |
| | | X = Application.GetRealWidth(17) + Application.GetRealWidth(7 * functionCount.ToString().Length), |
| | | Y = btnName.Bottom, |
| | | Width = Application.GetRealWidth(120), |
| | | Height = Application.GetRealHeight(24), |
| | |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = btnName.Bottom, |
| | | Width = Application.GetRealWidth(12 * functionCount.ToString().Length), |
| | | Width = Application.GetRealWidth(14 * functionCount.ToString().Length), |
| | | Height = Application.GetRealHeight(24), |
| | | TextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | |
| | | { |
| | | btnAddSceneBg.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if(!DB_ResidenceData.Instance.HomeGateway.gatewayStatus) |
| | | { |
| | | new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.GatewayOfflineCannotCreateScene), true); |
| | | return; |
| | | } |
| | | //if(!DB_ResidenceData.Instance.HomeGateway.gatewayStatus) |
| | | //{ |
| | | // new PublicAssmebly().TipMsgAutoClose(Language.StringByID(StringId.GatewayOfflineCannotCreateScene), true); |
| | | // return; |
| | | //} |
| | | |
| | | if (DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull()) |
| | | { |
| | |
| | | } |
| | | updataTime = DateTime.Now; |
| | | bodyView.arcBar.ProgressBarColor = bodyView.aC.trait_on_off.curValue.ToString() == "on" ? CSS_Color.MainColor : CSS_Color.PromptingColor2; |
| | | bodyView.btnTemp.Text = uAc.trait_temp.curValue.ToString().Substring(0, 2); |
| | | bodyView.btnTemp.Text = uAc.trait_temp.curValue.ToString(); |
| | | bodyView.btnIndoorTemp.Text = Language.StringByID(StringId.IndoorTemp) + Convert.ToInt32(Convert.ToDouble(uAc.trait_IndoorTemp.curValue)) + "°C"; |
| | | bodyView.btnMode.UnSelectedImagePath = uAc.curModeImage; |
| | | bodyView.btnWindSpeed.UnSelectedImagePath = uAc.curFanImage; |
| | |
| | | }; |
| | | controlView.AddChidren(btnSwitch); |
| | | |
| | | |
| | | LoadEventList(); |
| | | |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.Fan)).LoadTopView_FunctionTop(socketFunction, actionRefresh); |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.Socket)).LoadTopView_FunctionTop(socketFunction, actionRefresh); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | DriverLayer.Control.Ins.SendReadCommand(socketFunction); |
| | |
| | | { |
| | | btnSwitchIcon.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | btnSwitchIcon.IsSelected = !btnSwitchIcon.IsSelected; |
| | | btnSwitchIcon.IsSelected = btnSwitch.IsSelected = !btnSwitchIcon.IsSelected; |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | |
| | | }; |
| | | btnSwitch.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | btnSwitch.IsSelected = !btnSwitch.IsSelected; |
| | | btnSwitch.IsSelected = btnSwitchIcon.IsSelected = !btnSwitch.IsSelected; |
| | | |
| | | new System.Threading.Thread(() => |
| | | { |
| | |
| | | light.brightness = dimmerBar.Progress; |
| | | //Control.Send(CommandType_A.write, light); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("brightness", light.brightness.ToString()); |
| | | d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); |
| | | Control.Ins.SendWriteCommand(light, d); |
| | | light.fadeTime = barFadeTime.Progress; |
| | | }; |
| | |
| | | { |
| | | //Control.Send(CommandType_A.write, this.light); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("brightness", light.brightness.ToString()); |
| | | d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); |
| | | Control.Ins.SendWriteCommand(light, d); |
| | | } |
| | | else |
| | |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("brightness", light.brightness.ToString()); |
| | | d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); |
| | | Control.Ins.SendWriteCommand(light, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | { |
| | | light.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", light.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, light.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(light, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | }; |
| | | controlView.AddChidren(btnFromFoorAndRoom); |
| | | |
| | | if(light.redColor==0&&light.greenColor == 0&& light.blueColor == 0) |
| | | { |
| | | } |
| | | |
| | | btnCurColor = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | |
| | | Radius = (uint)Application.GetMinRealAverage(8), |
| | | BorderColor = CSS_Color.PromptingColor2, |
| | | BorderWidth = 1, |
| | | BackgroundColor = (uint)(0xFF000000 + light.redColor * 256 * 256 + light.greenColor * 256 + light.blueColor) |
| | | BackgroundColor = (uint)(0xFF000000 + light.GetRGBcolor()) |
| | | }; |
| | | |
| | | if (light.redColor == 0 && light.greenColor == 0 && light.blueColor == 0) |
| | | { |
| | | btnCurColor.BackgroundColor = 0x00000000; |
| | | } |
| | | controlView.AddChidren(btnCurColor); |
| | | |
| | | btnCollection = new Button() |
| | |
| | | } |
| | | bodyView.dimmerBar.ProgressBarColor = uFunction.trait_on_off.curValue.ToString() == "on" ? CSS.CSS_Color.AuxiliaryColor1 : CSS.CSS_Color.PromptingColor2; |
| | | bodyView.btnSwitch.IsSelected = uFunction.trait_on_off.curValue.ToString() == "on"; |
| | | bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.light.redColor * 256 * 256 + bodyView.light.greenColor * 256 + bodyView.light.blueColor); |
| | | bodyView.btnCurColor.BackgroundColor = (uint)(0xFF000000 + bodyView.light.GetRGBcolor()); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | colorPicker.ColorChaged += (sender2, e2) => { |
| | | if ((DateTime.Now - colorChangeTime).TotalMilliseconds > 200) |
| | | { |
| | | light.redColor = e2[0]; |
| | | light.greenColor = e2[1]; |
| | | light.blueColor = e2[2]; |
| | | light.SetRGBcolor(e2); |
| | | colorChangeTime = DateTime.Now; |
| | | btnCurColor.BackgroundColor = (uint)(0xFF000000 + light.redColor * 256 * 256 + light.greenColor * 256 + light.blueColor); |
| | | btnCurColor.BackgroundColor = (uint)(0xFF000000 + light.GetRGBcolor()); |
| | | //Control.Send(CommandType_A.write, this.light); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("color", (light.redColor * 256 * 256 + light.greenColor * 256 + light.blueColor).ToString()); |
| | | d.Add(FunctionAttributeKey.RGB, light.GetRGBcolorString()); |
| | | Control.Ins.SendWriteCommand(light, d); |
| | | } |
| | | }; |
| | |
| | | onDimmerBar = false; |
| | | light.brightness = dimmerBar.Progress; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("brightness", light.brightness.ToString()); |
| | | d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); |
| | | Control.Ins.SendWriteCommand(light, d); |
| | | light.fadeTime = barFadeTime.Progress; |
| | | //Control.Send(CommandType_A.write, light); |
| | |
| | | { |
| | | //Control.Send(CommandType_A.write, this.light); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("brightness", light.brightness.ToString()); |
| | | d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); |
| | | Control.Ins.SendWriteCommand(light, d); |
| | | } |
| | | else |
| | |
| | | { |
| | | //Control.Send(CommandType_A.write, light); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("brightness", light.brightness.ToString()); |
| | | d.Add(FunctionAttributeKey.Brightness, light.brightness.ToString()); |
| | | Control.Ins.SendWriteCommand(light, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | { |
| | | light.trait_on_off.curValue = btnSwitch.IsSelected ? "on" : "off"; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("on_off", light.trait_on_off.curValue.ToString()); |
| | | d.Add(FunctionAttributeKey.OnOff, light.trait_on_off.curValue.ToString()); |
| | | Control.Ins.SendWriteCommand(light, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | |
| | | { |
| | | btnRestoredPoint.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | light.color = 0xFFFFFF; |
| | | light.SetRGBcolor(new byte[] { 255, 255, 255 }); |
| | | btnCurColor.BackgroundColor = 0xFFFFFFFF; |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add("color", "FFFFFF"); |
| | | d.Add(FunctionAttributeKey.RGB, light.GetRGBcolorString()); |
| | | Control.Ins.SendWriteCommand(light, d); |
| | | }; |
| | | } |
| | | |
| | | } |
| | | } |