Merge branch 'Dev-Google-V2.4.3' into Google-2023-11-17-1
| | |
| | | <Reference Include="Shared.Droid"> |
| | | <HintPath>..\DLL\Android\Shared.Droid.dll</HintPath> |
| | | </Reference> |
| | | <Reference Include="HdlEzvizDroid"> |
| | | <HintPath>..\..\..\HdlEzvizDroid.dll</HintPath> |
| | | </Reference> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <Compile Include="MainActivity.cs" /> |
| | |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\Light\LightScene\gp_all_on_home.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\Light\LightScene\gp_all_on.png" /> |
| | | <AndroidAsset Include="Assets\Phone\LogicIcon\electricaltvhisense.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\EnvirSensor\Pm10Icon.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\EnvirSensor\Pm10Bg.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidResource Include="Resources\values\colors.xml" /> |
| | |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\Light\LightScene\gp_all_on_home.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\Light\LightScene\gp_all_on.png" /> |
| | | <BundleResource Include="Resources\Phone\LogicIcon\electricaltvhisense.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\EnvirSensor\Pm10Bg.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\EnvirSensor\Pm10Icon.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ITunesArtwork Include="iTunesArtwork" /> |
| | |
| | | <key>CFBundleName</key> |
| | | <string>On Pro</string> |
| | | <key>CFBundleShortVersionString</key> |
| | | <string>2.4.2</string> |
| | | <string>2.4.3</string> |
| | | <key>CFBundleURLTypes</key> |
| | | <array> |
| | | <dict> |
| | |
| | | </dict> |
| | | </array> |
| | | <key>CFBundleVersion</key> |
| | | <string>2.4.2</string> |
| | | <string>2.4.3</string> |
| | | <key>LSApplicationQueriesSchemes</key> |
| | | <array> |
| | | <string>weixinULAPI</string> |
| | |
| | | //======================安防==================== |
| | | GetSecurityList(); |
| | | |
| | | //===================读取逻辑列表========================== |
| | | //===================读取逻辑列表==================== |
| | | Logic.LogicList.Clear();//主页下拉强制刷新自动化列表 |
| | | MainView.GetLogicList();//读取自动化列表 |
| | | }) |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Net; |
| | | using System.Net.Sockets; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace HDL_ON.DAL.DriverLayer |
| | | { |
| | | //class AsyncUdpServer |
| | | /// <summary> |
| | | /// UdpClient 实现异步UDP服务器 |
| | | /// </summary> |
| | | public class AsyncUdpServer |
| | | { |
| | | #region Fields |
| | | /// <summary> |
| | | /// 服务器程序允许的最大客户端连接数 |
| | | /// </summary> |
| | | private int _maxClient; |
| | | |
| | | /// <summary> |
| | | /// 当前的连接的客户端数 |
| | | /// </summary> |
| | | //private int _clientCount; |
| | | |
| | | /// <summary> |
| | | /// 服务器使用的异步UdpClient |
| | | /// </summary> |
| | | private UdpClient _server; |
| | | |
| | | /// <summary> |
| | | /// 客户端会话列表 |
| | | /// </summary> |
| | | //private List<AsyncUDPState> _clients; |
| | | |
| | | private bool disposed = false; |
| | | |
| | | /// <summary> |
| | | /// 数据接受缓冲区 |
| | | /// </summary> |
| | | private byte[] _recvBuffer; |
| | | |
| | | #endregion |
| | | |
| | | #region Properties |
| | | |
| | | /// <summary> |
| | | /// 服务器是否正在运行 |
| | | /// </summary> |
| | | public bool IsRunning { get; private set; } |
| | | /// <summary> |
| | | /// 监听的IP地址 |
| | | /// </summary> |
| | | public IPAddress Address { get; private set; } |
| | | /// <summary> |
| | | /// 监听的端口 |
| | | /// </summary> |
| | | public int Port { get; private set; } |
| | | /// <summary> |
| | | /// 通信使用的编码 |
| | | /// </summary> |
| | | public Encoding Encoding { get; set; } |
| | | |
| | | #endregion |
| | | |
| | | #region 构造函数 |
| | | |
| | | /// <summary> |
| | | /// 异步UdpClient UDP服务器 |
| | | /// </summary> |
| | | /// <param name="listenPort">监听的端口</param> |
| | | public AsyncUdpServer(int listenPort) |
| | | : this(IPAddress.Any, listenPort, 10240) |
| | | { |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 异步UdpClient UDP服务器 |
| | | /// </summary> |
| | | /// <param name="localEP">监听的终结点</param> |
| | | public AsyncUdpServer(IPEndPoint localEP) |
| | | : this(localEP.Address, localEP.Port, 10240) |
| | | { |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 异步UdpClient UDP服务器 |
| | | /// </summary> |
| | | /// <param name="localIPAddress">监听的IP地址</param> |
| | | /// <param name="listenPort">监听的端口</param> |
| | | /// <param name="maxClient">最大客户端数量</param> |
| | | public AsyncUdpServer(IPAddress localIPAddress, int listenPort, int maxClient) |
| | | { |
| | | this.Address = localIPAddress; |
| | | this.Port = listenPort; |
| | | this.Encoding = Encoding.Default; |
| | | |
| | | _maxClient = maxClient; |
| | | //_clients = new List<AsyncUDPSocketState>(); |
| | | _server = new UdpClient(new IPEndPoint(this.Address, this.Port)); |
| | | uint IOC_IN = 0x80000000; |
| | | uint IOC_VENDOR = 0x18000000; |
| | | uint SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12; |
| | | |
| | | _server.Client.IOControl((int)SIO_UDP_CONNRESET, new byte[] { Convert.ToByte(false) }, null); |
| | | |
| | | _recvBuffer = new byte[_server.Client.ReceiveBufferSize]; |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region Method |
| | | /// <summary> |
| | | /// 启动服务器 |
| | | /// </summary> |
| | | /// <returns>异步TCP服务器</returns> |
| | | public void Start() |
| | | { |
| | | try |
| | | { |
| | | if (!IsRunning) |
| | | { |
| | | IsRunning = true; |
| | | _server.EnableBroadcast = true; |
| | | _server.BeginReceive(ReceiveDataAsync, null); |
| | | } |
| | | } |
| | | catch (Exception e) { } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 停止服务器 |
| | | /// </summary> |
| | | public void Stop() |
| | | { |
| | | try |
| | | { |
| | | //if (IsRunning) |
| | | { |
| | | IsRunning = false; |
| | | _server.Close(); |
| | | //TODO 关闭对所有客户端的连接 |
| | | |
| | | } |
| | | } |
| | | catch (Exception e) { } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 接收数据的方法 |
| | | /// </summary> |
| | | /// <param name="ar"></param> |
| | | private void ReceiveDataAsync(IAsyncResult ar) |
| | | { |
| | | bool isReceive = false; |
| | | try |
| | | { |
| | | var udpState = new AsyncUDPState(); |
| | | IPEndPoint remote = null; |
| | | udpState.buffer = _server.EndReceive(ar, ref remote); ; |
| | | udpState.remote = remote; |
| | | udpState.udpClient = _server; |
| | | |
| | | isReceive = true; |
| | | receive(); |
| | | |
| | | //触发数据收到事件 |
| | | RaiseDataReceived(udpState); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | //TODO 处理异常 |
| | | RaiseOtherException(null); |
| | | } |
| | | finally |
| | | { |
| | | if (!isReceive) |
| | | { |
| | | receive(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void receive() |
| | | { |
| | | if (IsRunning && _server != null) |
| | | { |
| | | int count = 10; |
| | | while (0 < count--) |
| | | { |
| | | try |
| | | { |
| | | _server.BeginReceive(ReceiveDataAsync, null); |
| | | break; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | System.Threading.Thread.Sleep(100); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发送数据 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | /// <param name="remote"></param> |
| | | public void Send(byte[] data, IPEndPoint remote) |
| | | { |
| | | try |
| | | { |
| | | RaisePrepareSend(null); |
| | | _server.BeginSend(data, data.Length, remote, new AsyncCallback(SendCallback), null); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | //TODO 异常处理 |
| | | RaiseOtherException(null); |
| | | } |
| | | } |
| | | |
| | | private void SendCallback(IAsyncResult ar) |
| | | { |
| | | //if (ar.IsCompleted) |
| | | { |
| | | try |
| | | { |
| | | _server.EndSend(ar); |
| | | //消息发送完毕事件 |
| | | RaiseCompletedSend(null); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | //TODO 数据发送失败事件 |
| | | RaiseOtherException(null); |
| | | } |
| | | } |
| | | |
| | | } |
| | | #endregion |
| | | |
| | | #region 事件 |
| | | /// <summary> |
| | | /// 接收到数据事件 |
| | | /// </summary> |
| | | public event EventHandler<AsyncUDPEventArgs> DataReceived; |
| | | |
| | | private void RaiseDataReceived(AsyncUDPState state) |
| | | { |
| | | if (DataReceived != null) |
| | | { |
| | | DataReceived(this, new AsyncUDPEventArgs(state)); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 发送数据前的事件 |
| | | /// </summary> |
| | | public event EventHandler<AsyncUDPEventArgs> PrepareSend; |
| | | |
| | | /// <summary> |
| | | /// 触发发送数据前的事件 |
| | | /// </summary> |
| | | /// <param name="state"></param> |
| | | private void RaisePrepareSend(AsyncUDPState state) |
| | | { |
| | | if (PrepareSend != null) |
| | | { |
| | | PrepareSend(this, new AsyncUDPEventArgs(state)); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 数据发送完毕事件 |
| | | /// </summary> |
| | | public event EventHandler<AsyncUDPEventArgs> CompletedSend; |
| | | |
| | | /// <summary> |
| | | /// 触发数据发送完毕的事件 |
| | | /// </summary> |
| | | /// <param name="state"></param> |
| | | private void RaiseCompletedSend(AsyncUDPState state) |
| | | { |
| | | if (CompletedSend != null) |
| | | { |
| | | CompletedSend(this, new AsyncUDPEventArgs(state)); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 网络错误事件 |
| | | /// </summary> |
| | | public event EventHandler<AsyncUDPEventArgs> NetError; |
| | | /// <summary> |
| | | /// 触发网络错误事件 |
| | | /// </summary> |
| | | /// <param name="state"></param> |
| | | private void RaiseNetError(AsyncUDPState state) |
| | | { |
| | | if (NetError != null) |
| | | { |
| | | NetError(this, new AsyncUDPEventArgs(state)); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 异常事件 |
| | | /// </summary> |
| | | public event EventHandler<AsyncUDPEventArgs> OtherException; |
| | | /// <summary> |
| | | /// 触发异常事件 |
| | | /// </summary> |
| | | /// <param name="state"></param> |
| | | private void RaiseOtherException(AsyncUDPState state, string descrip) |
| | | { |
| | | if (OtherException != null) |
| | | { |
| | | OtherException(this, new AsyncUDPEventArgs(descrip, state)); |
| | | } |
| | | } |
| | | private void RaiseOtherException(AsyncUDPState state) |
| | | { |
| | | RaiseOtherException(state, ""); |
| | | } |
| | | #endregion |
| | | |
| | | #region Close |
| | | /// <summary> |
| | | /// 关闭一个与客户端之间的会话 |
| | | /// </summary> |
| | | /// <param name="state">需要关闭的客户端会话对象</param> |
| | | public void Close(AsyncUDPState state) |
| | | { |
| | | if (state != null) |
| | | { |
| | | //_clients.Remove(state); |
| | | //_clientCount--; |
| | | //TODO 触发关闭事件 |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 关闭所有的客户端会话,与所有的客户端连接会断开 |
| | | /// </summary> |
| | | public void CloseAllClient() |
| | | { |
| | | //foreach (AsyncUDPSocketState client in _clients) |
| | | //{ |
| | | // Close(client); |
| | | //} |
| | | //_clientCount = 0; |
| | | //_clients.Clear(); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 释放 |
| | | /// <summary> |
| | | /// Performs application-defined tasks associated with freeing, |
| | | /// releasing, or resetting unmanaged resources. |
| | | /// </summary> |
| | | public void Dispose() |
| | | { |
| | | Dispose(true); |
| | | GC.SuppressFinalize(this); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// Releases unmanaged and - optionally - managed resources |
| | | /// </summary> |
| | | /// <param name="disposing"><c>true</c> to release |
| | | /// both managed and unmanaged resources; <c>false</c> |
| | | /// to release only unmanaged resources.</param> |
| | | protected virtual void Dispose(bool disposing) |
| | | { |
| | | if (!this.disposed) |
| | | { |
| | | if (disposing) |
| | | { |
| | | try |
| | | { |
| | | Stop(); |
| | | if (_server != null) |
| | | { |
| | | _server = null; |
| | | } |
| | | } |
| | | catch (SocketException) |
| | | { |
| | | //TODO |
| | | RaiseOtherException(null); |
| | | } |
| | | } |
| | | disposed = true; |
| | | } |
| | | } |
| | | #endregion |
| | | } |
| | | } |
| | | public class AsyncUDPState |
| | | { |
| | | // Client socket. |
| | | public UdpClient udpClient = null; |
| | | // Size of receive buffer. |
| | | public const int BufferSize = 1024; |
| | | // Receive buffer. |
| | | public byte[] buffer = new byte[BufferSize]; |
| | | // Received data string. |
| | | public StringBuilder sb = new StringBuilder(); |
| | | |
| | | public IPEndPoint remote = new IPEndPoint(IPAddress.Any, 0); |
| | | } |
| | | /// <summary> |
| | | /// UdpClient 异步UDP服务器事件参数类 |
| | | /// </summary> |
| | | public class AsyncUDPEventArgs : EventArgs |
| | | { |
| | | /// <summary> |
| | | /// 提示信息 |
| | | /// </summary> |
| | | public string _msg; |
| | | |
| | | /// <summary> |
| | | /// 客户端状态封装类 |
| | | /// </summary> |
| | | public AsyncUDPState _state; |
| | | |
| | | /// <summary> |
| | | /// 是否已经处理过了 |
| | | /// </summary> |
| | | public bool IsHandled { get; set; } |
| | | |
| | | public AsyncUDPEventArgs(string msg) |
| | | { |
| | | this._msg = msg; |
| | | IsHandled = false; |
| | | } |
| | | public AsyncUDPEventArgs(AsyncUDPState state) |
| | | { |
| | | this._state = state; |
| | | IsHandled = false; |
| | | } |
| | | public AsyncUDPEventArgs(string msg, AsyncUDPState state) |
| | | { |
| | | this._msg = msg; |
| | | this._state = state; |
| | | IsHandled = false; |
| | | } |
| | | |
| | | } |
| | |
| | | FloorHeatingPage.UpdataStates(localFunction); |
| | | break; |
| | | case SPK.SensorPm25: |
| | | case SPK.SensorPm10: |
| | | case SPK.SensorCO2: |
| | | case SPK.SensorTVOC: |
| | | case SPK.SensorTemperature: |
| | |
| | | FunctionPage.UpdataStates(lightTeme); |
| | | ClassificationPage.UpdataInfo(lightTeme); |
| | | RGBPage.UpdataStates(lightTeme); |
| | | }else if(lightTeme.spk == SPK.LightCCT) |
| | | } |
| | | else if (lightTeme.spk == SPK.LightCCT) |
| | | { |
| | | lightTeme.SetAttrState(FunctionAttributeKey.OnOff, receiveBytes[1] > 0 ? "on" : "off"); |
| | | if (receiveBytes[1] > 0) |
| | |
| | | if (receiveBytes[9] > 128) |
| | | { |
| | | indoorTemp = 1 - (receiveBytes[9] - 128); |
| | | }else |
| | | } |
| | | else |
| | | { |
| | | indoorTemp = receiveBytes[9]; |
| | | } |
| | |
| | | |
| | | busSocket = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); |
| | | busSocket.EnableBroadcast = true; |
| | | try { |
| | | try |
| | | { |
| | | busSocket.Bind(new IPEndPoint(IPAddress.Any, Port)); |
| | | |
| | | busSocket.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.AddMembership, new MulticastOption(IPAddress.Parse("239.0.168.188"))); |
| | | relinkCount = 0; |
| | | } |
| | | catch (Exception ex){ |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log ($"udp port bind error : {ex.Message}"); |
| | | |
| | | busSocket = null; |
| | |
| | | return; |
| | | } |
| | | |
| | | try { |
| | | try |
| | | { |
| | | Packet packet = new Packet (); |
| | | busSocket.BeginReceiveFrom (packet.Bytes, 0, packet.Bytes.Length, SocketFlags.None, ref packet.RemoteEndPoint, new AsyncCallback (asyncEndReceive), packet); |
| | | } |
| | | catch (Exception e) { |
| | | catch (Exception e) |
| | | { |
| | | System.Threading.Thread.Sleep (1); |
| | | Console.WriteLine("asyncBeginReceive " + relinkCount ); |
| | | if (relinkCount == 0) |
| | |
| | | { |
| | | int bytesSent = busSocket.EndSendTo(iar); |
| | | } |
| | | catch { |
| | | catch |
| | | { |
| | | |
| | | } |
| | | } |
| | |
| | | if (mHomeGatewayRes.Count > 0) |
| | | { |
| | | DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes[0];//网关状态 |
| | | DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes[0].gatewayStatus; |
| | | HDL_ON.DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes[0].gatewayStatus; |
| | | DB_ResidenceData.Instance.SaveResidenceData(); |
| | | return revertObj.Code; |
| | | } |
| | |
| | | var mHomeGatewayRes = Newtonsoft.Json.JsonConvert.DeserializeObject<HomeGatewayInfo>(revertObj.Data.ToString()); |
| | | if (mHomeGatewayRes != null) |
| | | { |
| | | DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes.gatewayStatus; |
| | | HDL_ON.DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes.gatewayStatus; |
| | | } |
| | | } |
| | | return revertObj.Code; |
| | |
| | | /// </summary> |
| | | public const string Illuminance = "illuminance"; |
| | | public const string Pm25 = "pm25"; |
| | | public const string Pm10 = "pm10"; |
| | | public const string Tvoc = "tvoc"; |
| | | /// <summary> |
| | | /// 状态,传感器 |
| | |
| | | case SPK.SensorHumidity: |
| | | attr = function.GetAttribute(FunctionAttributeKey.Humidity); |
| | | break; |
| | | case SPK.SensorPm10: |
| | | attr = function.GetAttribute(FunctionAttributeKey.Pm10); |
| | | break; |
| | | |
| | | } |
| | | } |
| | | double value = 0.0; |
| | |
| | | switch (spk) |
| | | { |
| | | case SPK.SensorPm25: |
| | | _intervalValue.Add("0 ~ 50"); |
| | | _intervalValue.Add("51 ~ 100"); |
| | | _intervalValue.Add("101 ~ 150"); |
| | | _intervalValue.Add("151 ~"); |
| | | break; |
| | | case SPK.SensorPm10: |
| | | _intervalValue.Add("0 ~ 35"); |
| | | _intervalValue.Add("36 ~ 75"); |
| | | _intervalValue.Add("76 ~ 115"); |
| | |
| | | _levelColorList.Add(0xFFFF3D3D); |
| | | break; |
| | | case SPK.SensorTVOC: |
| | | case SPK.SensorPm10: |
| | | _levelColorList.Add(0xFFADE764); |
| | | _levelColorList.Add(0xFFFFD154); |
| | | _levelColorList.Add(0xFFFF9D54); |
| | |
| | | switch (spk) |
| | | { |
| | | case SPK.SensorPm25: |
| | | case SPK.SensorPm10: |
| | | _levelTextList.Add(StringId.Great); |
| | | _levelTextList.Add(StringId.Good); |
| | | _levelTextList.Add(StringId.MildPollution); |
| | |
| | | /// <summary> |
| | | /// 版本号 |
| | | /// </summary> |
| | | public static string VersionString = "2.4.2"; |
| | | public static string VersionString = "2.4.3"; |
| | | ///// <summary> |
| | | ///// 客户端类型 |
| | | ///// </summary> |
| | |
| | | //etAccount.Text = "18321091245"; |
| | | //etAccount.Text = "13751916353"; |
| | | etAccount.Text = "13549566666"; |
| | | etAccount.Text = "support7@hdlautomation.com"; |
| | | etAccount.Text = "13375012446";//测试服务器 |
| | | etAccount.Text = "15855403939"; |
| | | etAccount.Text = "15006564444"; |
| | |
| | | etAccount.Text = "13533335801"; |
| | | etAccount.Text = "13682244600"; |
| | | etAccount.Text = "marketing@australindo.co.id"; |
| | | etAccount.Text = "support7@hdlautomation.com"; |
| | | etAccount.Text = "13922115008";//刘总 |
| | | etAccount.Text = "1272061968@qq.com"; |
| | | etAccount.Text = "info@hdlegypt.com"; |
| | | etAccount.Text = "support7@hdlautomation.com"; |
| | | etAccount.Text = "18402017839"; |
| | | |
| | | |
| | | } |
| | |
| | | } |
| | | b = !b; |
| | | etPassword.Text = "123456"; |
| | | if(etAccount.Text == "pjh@hdlchina.com.cn") |
| | | if(etAccount.Text == "info@hdlegypt.com") |
| | | { |
| | | etPassword.Text = "hdl123"; |
| | | etPassword.Text = "@Hdl2020"; |
| | | } |
| | | else if(etAccount.Text == "18600200915") |
| | | { |
| | |
| | | break; |
| | | case ShowFunction.Panel: |
| | | break; |
| | | case ShowFunction.SecurityMonitoring: |
| | | if (!MainPage.NoLoginMode) |
| | | { |
| | | if (OnAppConfig.Instance.RequestHttpsHost.Contains("bahrain")) |
| | | { |
| | | functionCount = 0; |
| | | } |
| | | else |
| | | { |
| | | functionCount = 1; |
| | | } |
| | | } |
| | | break; |
| | | case ShowFunction.Sensor: |
| | | functionCount = FunctionList.List.GetArmSensorList().Count; |
| | | break; |
| | |
| | | case ShowFunction.SecurityCenter: |
| | | functionCount = FunctionList.List.securities.Count; |
| | | break; |
| | | case ShowFunction.Acst: |
| | | functionCount = FunctionList.List.GetAcstParentList().Count; |
| | | functionOnCount = FunctionList.List.GetAcstParentList().FindAll((obj) => obj.trait_on_off.curValue.ToString() == "on").Count; |
| | | break; |
| | | case ShowFunction.VideoDoorLock: |
| | | functionCount = FunctionList.List.GetVideoDoorLockList().Count; |
| | | functionOnCount = FunctionList.List.GetAcstParentList().FindAll((obj) => obj.GetAttrState("status").ToString() == "open" |
| | | || obj.GetAttrState("status").ToString() == "normal_open").Count; |
| | | |
| | | break; |
| | | case ShowFunction.Aks: |
| | | functionCount = FunctionList.List.GetVideoControlsList().Count; |
| | | functionOnCount = 1; |
| | | break; |
| | | |
| | | |
| | | |
| | |
| | | if (indexeList.Count > 0) |
| | | { |
| | | dicSateteList.Clear(); |
| | | string s = string.Empty; |
| | | string userNameStr = string.Empty; |
| | | string seleUsrIdStr = string.Empty; |
| | | string tag = string.Empty; |
| | | //数据封装 |
| | | string[] arrayUserIds = new string[indexeList.Count]; |
| | | //开门类型 |
| | | AddDictionary("open_type", "1", "integer"); |
| | | for (int i = 0; i < indexeList.Count; i++) |
| | | { |
| | | |
| | | if (i > faceIdList.Count) |
| | | { |
| | | continue; |
| | | } |
| | | var indexe = indexeList[i]; |
| | | var face = faceIdList[indexe]; |
| | | AddDictionary("user_id", face.userId, "string"); |
| | | s += face.userName; |
| | | s += ","; |
| | | tag += face.userId; |
| | | tag += "_"; |
| | | userNameStr += face.userName; |
| | | userNameStr += ","; |
| | | arrayUserIds[i] = face.userId; |
| | | } |
| | | seleUsrIdStr = Newtonsoft.Json.JsonConvert.SerializeObject(arrayUserIds); |
| | | AddDictionary("user_id", seleUsrIdStr, "string", "[]"); |
| | | //界面显示选中值 |
| | | btnState.Text = s; |
| | | btnState.Text = InpOrOutLogicMethod.Current.RemoveLastStr(userNameStr); |
| | | btnState.Tag = tag; |
| | | } |
| | | |
| | |
| | | break; |
| | | case SPK.doorgate: |
| | | { |
| | | |
| | | string s = string.Empty; |
| | | try |
| | | { |
| | | if (inputCondition.identifier == "door_call_cloud_event") |
| | | { |
| | | s = Language.StringByID(StringId.shipintonghuahujiao); |
| | |
| | | { |
| | | continue; |
| | | } |
| | | var userId = dic["value"].ToString(); |
| | | var FaceItem = this.GetFaceItem(userId, device.deviceId); |
| | | var value = dic["value"].ToString(); |
| | | if (!string.IsNullOrEmpty(value)) |
| | | { |
| | | var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>>(value); |
| | | for (int a = 0; a < list.Count; a++) |
| | | { |
| | | |
| | | var FaceItem = this.GetFaceItem(list[a], device.deviceId); |
| | | s += FaceItem.userName; |
| | | s += ","; |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | } |
| | | catch { } |
| | | inputView.btnState.Text = s; |
| | | } |
| | | break; |
| | |
| | | case SPK.MusicStandard: |
| | | case SPK.AvMusic: |
| | | { |
| | | string on_off = GetKeyValue("on_off", dicList); |
| | | string song_name = GetKeyValue("song_name", dicList); |
| | | string volume = GetKeyValue("volume", dicList); |
| | | stateStr = song_name + ";" + Language.StringByID(StringId.volumeMusic) + volume; |
| | | if (stateStr.StartsWith(";")) |
| | | |
| | | if (!string.IsNullOrEmpty(on_off)) |
| | | { |
| | | stateStr = stateStr.Substring(1, stateStr.Length - 1); |
| | | } |
| | | else if (stateStr.EndsWith(Language.StringByID(StringId.volumeMusic))) |
| | | if (on_off == "on") |
| | | { |
| | | stateStr = stateStr.Substring(0, stateStr.Length - 3); |
| | | stateStr = Language.StringByID(StringId.onLogic); |
| | | } |
| | | else |
| | | { |
| | | stateStr = Language.StringByID(StringId.offLogic); |
| | | } |
| | | } |
| | | |
| | | if (!string.IsNullOrEmpty(song_name)) |
| | | { |
| | | stateStr += "," + song_name; |
| | | } |
| | | |
| | | if (!string.IsNullOrEmpty(volume)) |
| | | { |
| | | stateStr += "," + volume; |
| | | } |
| | | |
| | | } |
| | | break; |
| | | case SPK.ElectricalTvHisense: |
| | |
| | | { |
| | | foreach (var dic in dicList) |
| | | { |
| | | if (dic["key"] == "song_name") |
| | | if (dic["key"] == "on_off") |
| | | { |
| | | button1.Text = dic["value"]?.ToString(); |
| | | if (dic["value"] == "on") |
| | | { |
| | | button1.Text = Language.StringByID(StringId.onLogic); |
| | | } |
| | | else |
| | | { |
| | | button1.Text = Language.StringByID(StringId.offLogic); |
| | | } |
| | | } |
| | | else if (dic["key"] == "song_name") |
| | | { |
| | | button2.Text = dic["value"]?.ToString(); |
| | | } |
| | | else if (dic["key"] == "volume") |
| | | { |
| | | button2.Text = dic["value"]?.ToString(); |
| | | button3.Text = dic["value"]?.ToString(); |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case SPK.doorgate: |
| | | { |
| | | string s = string.Empty; |
| | | try |
| | | { |
| | | string userNameStr = string.Empty; |
| | | string tag = string.Empty; |
| | | for (int b = 0; b < dicList.Count; b++) |
| | | { |
| | |
| | | { |
| | | continue; |
| | | } |
| | | var userId = dic["value"].ToString(); |
| | | var FaceItem = this.GetFaceItem(userId, device.deviceId); |
| | | s += FaceItem.userName; |
| | | s += ","; |
| | | var value = dic["value"].ToString(); |
| | | if (!string.IsNullOrEmpty(value)) |
| | | { |
| | | var list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>>(value); |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | |
| | | var FaceItem = this.GetFaceItem(list[i], device.deviceId); |
| | | userNameStr += FaceItem.userName; |
| | | userNameStr += ","; |
| | | tag += FaceItem.userId; |
| | | tag += "_"; |
| | | } |
| | | button2.Text = s; |
| | | } |
| | | } |
| | | button2.Text = RemoveLastStr(userNameStr); |
| | | button2.Tag = tag; |
| | | } |
| | | catch { } |
| | | } |
| | | break; |
| | | case SPK.ElectricalTvHisense: |
| | | { |
| | |
| | | /// <summary> |
| | | /// 检测类型 配合condition_type=3时使用,没有该字段、该值或0: 状态检测(每次收到状态就成立),1:动作检测(需要切换状态才成立); |
| | | /// </summary> |
| | | public string detect_type = "0"; |
| | | public string detect_type = "1"; |
| | | /// <summary> |
| | | /// 人体移动传感器(带持续时间) |
| | | /// </summary> |
| | |
| | | case SPK.AvMusic: |
| | | { |
| | | #region 界面 |
| | | ///开关 |
| | | LogicView.FunTypeView switchVie = new LogicView.FunTypeView(); |
| | | switchVie.btnText.TextID = StringId.switchLogic; |
| | | fLayout.AddChidren(switchVie.FLayoutView()); |
| | | //提示语音 |
| | | LogicView.FunTypeView funTypeView = new LogicView.FunTypeView(); |
| | | funTypeView.frameLayout.Y = switchVie.frameLayout.Bottom; |
| | | funTypeView.btnText.TextID = StringId.tishiyin; |
| | | fLayout.AddChidren(funTypeView.FLayoutView()); |
| | | ///音量 |
| | |
| | | |
| | | |
| | | ///设备延时iewv |
| | | DelayView(fLayout, volView.frameLayout.Bottom); |
| | | var delayView = DelayView(fLayout, volView.frameLayout.Bottom); |
| | | if (edit ) |
| | | { |
| | | Output outputs = Logic.currlogic.output[index]; |
| | | var dicList = outputs.status.Find((obj) => obj.ContainsValue(FunctionAttributeKey.OnOff)); |
| | | if (dicList != null) |
| | | { |
| | | if (dicList.ContainsValue( "off") || dicList.ContainsValue("pause")) |
| | | { |
| | | funTypeView.frameLayout.Visible = false; |
| | | volView.frameLayout.Visible = false; |
| | | delayView.frameLayout.Y = switchVie.frameLayout.Bottom; |
| | | } |
| | | } |
| | | } |
| | | #endregion |
| | | #region 点击事件 |
| | | ///开关点击事件 |
| | | switchVie.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | SwitchViewMethod(device, switchVie.btnState, 2, (v) => { |
| | | if (v == "on") |
| | | { |
| | | funTypeView.frameLayout.Visible = true; |
| | | volView.frameLayout.Visible = true; |
| | | delayView.frameLayout.Y = volView.frameLayout.Bottom; |
| | | } |
| | | else |
| | | { |
| | | funTypeView.frameLayout.Visible = false; |
| | | volView.frameLayout.Visible = false; |
| | | delayView.frameLayout.Y = switchVie.frameLayout.Bottom; |
| | | } |
| | | }); |
| | | }; |
| | | ///提示语音点击事件 |
| | | funTypeView.btnClick.MouseUpEventHandler += (sender, e) => |
| | | { |
| | |
| | | if (edit) |
| | | { |
| | | //显示编辑之前的设备状态 |
| | | GetEditDeviceState(device, index, funTypeView.btnState, volView.btnState, null, null); |
| | | GetEditDeviceState(device, index, switchVie.btnState, funTypeView.btnState, volView.btnState, null); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | dicList.AddRange(diclist);//再添加其它属性 |
| | | dicSateteList = dicList;//重新赋值 |
| | | } |
| | | var onoffDic = dicSateteList.Find((obj) => obj.ContainsValue("on_off")); |
| | | if (onoffDic != null) |
| | | { |
| | | if (onoffDic.ContainsValue("off")) |
| | | { |
| | | for(int i =0;i<dicSateteList.Count;) |
| | | { |
| | | var d = dicSateteList[i]; |
| | | if(!d.ContainsValue("on_off") || d.ContainsValue("delay")) |
| | | { |
| | | dicSateteList.Remove(d); |
| | | continue; |
| | | } |
| | | i++; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | break; |
| | | case SPK.GroupControl: |
| | |
| | | /// </summary> |
| | | /// <param name="fLayout">父控件</param> |
| | | /// <param name="bottomY">在哪个控件下面</param> |
| | | private void DelayView(FrameLayout fLayout, int bottomY) |
| | | private LogicView.FunTypeView DelayView(FrameLayout fLayout, int bottomY) |
| | | { |
| | | LogicView.FunTypeView delayView = new LogicView.FunTypeView(); |
| | | delayView.frameLayout.Y = bottomY; |
| | |
| | | selectedState = "delay_" + strdelay; |
| | | }); |
| | | }; |
| | | return delayView; |
| | | |
| | | } |
| | | |
| | |
| | | /// <param name="device"></param> |
| | | /// <param name="button"></param> |
| | | /// <param name="len">显示选择View数量</param> |
| | | private void SwitchViewMethod(Entity.Function device, Button button, int len) |
| | | /// <param name="action">点击回调事件,用来给音乐刷新界面使用,wxr 2024-01-04 16:03:47</param> |
| | | private void SwitchViewMethod(Entity.Function device, Button button, int len,Action<string> action = null) |
| | | { |
| | | #region 界面 |
| | | FrameLayout frame = new FrameLayout { BackgroundColor = CSS.CSS_Color.viewTrans60lucence }; |
| | |
| | | |
| | | } |
| | | break; |
| | | |
| | | } |
| | | |
| | | //数据封装 |
| | | AddDictionary(key, value); |
| | | action?.Invoke(value); |
| | | }); |
| | | #endregion |
| | | } |
| | |
| | | { |
| | | scene.functions.Remove(temp); |
| | | } |
| | | //else |
| | | { |
| | | scene.functions.Insert(0, sceneFunction); |
| | | |
| | | |
| | | if (sceneFunction.localFunction.spk == SPK.MusicStandard) |
| | | { |
| | | for (var i = 0; i < sceneFunction.status.Count;) |
| | | { |
| | | var ddd = sceneFunction.status[i]; |
| | | if (string.IsNullOrEmpty(ddd.value)) |
| | | { |
| | | sceneFunction.status.Remove(ddd); |
| | | continue; |
| | | } |
| | | i++; |
| | | } |
| | | |
| | | if (sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.PlaylistName) == null) |
| | | { |
| | | if (isOnStatus) |
| | | { |
| | | var songNameStatus = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SongName); |
| | | { |
| | | if (songNameStatus != null) |
| | | { |
| | | if (string.IsNullOrEmpty(songNameStatus.value)) |
| | | { |
| | | sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.PlaylistName, value = "hdl_special" }); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (!string.IsNullOrEmpty(scene.userSceneId)) |
| | | { |
| | |
| | | var regionId = (string)btnHomeName.Tag; |
| | | dialog.Close(); |
| | | LoadEvent_ChangeCurHome(home); |
| | | new System.Threading.Thread(() => { |
| | | try |
| | | { |
| | | while (true) |
| | | { |
| | | if (Common.ApiUtlis.Ins.DownloadDataComplete) |
| | | { |
| | | System.Threading.Thread.Sleep(100); |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | LoadContentView(); |
| | | }); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | | { |
| | | |
| | | } |
| | | }) { IsBackground = true }.Start(); |
| | | |
| | | HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.ChangeCurrHome(home); |
| | | }; |
| | | } |
| | |
| | | var regionId = (string)btnHomeName.Tag; |
| | | dialog.Close(); |
| | | LoadEvent_ChangeCurHome(home); |
| | | new System.Threading.Thread(() => { |
| | | try |
| | | { |
| | | while (true) |
| | | { |
| | | if (Common.ApiUtlis.Ins.DownloadDataComplete) |
| | | { |
| | | System.Threading.Thread.Sleep(100); |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | LoadContentView(); |
| | | }); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | | { |
| | | |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | HDL_ON.UI.UI2.FuntionControlView.VideoDoorLock.CommonMethod.Current.ChangeCurrHome(home); |
| | | }; |
| | | } |
| | |
| | | |
| | | if (MainPage.Increase) |
| | | { |
| | | bodyScrolView.Height = Application.GetRealHeight(541); |
| | | bodyScrolView.Height = Application.GetRealHeight(541-10); |
| | | } |
| | | |
| | | headPortraitView = new FrameLayout() |
| | |
| | | |
| | | #endregion |
| | | |
| | | bodyView.AddChidren(new Button() |
| | | { |
| | | Y = Application.GetRealHeight(622), |
| | | Height = 1, |
| | | BackgroundColor = CSS_Color.DividingLineColor, |
| | | }); |
| | | |
| | | btnLogout = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(623), |
| | | Y = Application.GetRealHeight(624), |
| | | Height = Application.GetRealHeight(50), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | |
| | | d.Add(FunctionAttributeKey.Mode, m); |
| | | Control.Ins.SendWriteCommand(device, d); |
| | | dialog.Close(); |
| | | if (device.GetAttrState(FunctionAttributeKey.Mode) == "fan") |
| | | if (device.GetAttrState(FunctionAttributeKey.Mode) == "fan" || device.GetAttrState(FunctionAttributeKey.Mode) == "dry") |
| | | { |
| | | |
| | | setTempBar.IsClickable = false; |
| | |
| | | string key = ene.name; |
| | | if (list.ContainsKey(key)) |
| | | { |
| | | list.Add(ene.name + DateTime.Now.ToLongTimeString(), tt.ToString()); |
| | | list.Add(ene.name + DateTime.Now.Ticks, tt.ToString()); |
| | | } |
| | | else |
| | | { |
| | |
| | | int index = 0; |
| | | foreach (var sensor in FunctionList.List.GetEnvirSensorsList()) |
| | | { |
| | | if (sensor.spk == SPK.SensorPm10) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | if(SPK.EvironmentSensorList().Contains(sensor.spk) ) |
| | | { |
| | | foreach (var seTemp in sensor.attributes) |
| | |
| | | case SPK.SensorPm25: |
| | | imagePath = "FunctionIcon/EnvirSensor/Pm25Bg.png"; |
| | | iconPath = "FunctionIcon/EnvirSensor/Pm25Icon.png"; |
| | | break; |
| | | case SPK.SensorPm10: |
| | | imagePath = "FunctionIcon/EnvirSensor/Pm25Bg.png"; |
| | | iconPath = "FunctionIcon/EnvirSensor/Pm10Icon.png"; |
| | | break; |
| | | case SPK.SensorTVOC: |
| | | imagePath = "FunctionIcon/EnvirSensor/TvocBg.png"; |
| | |
| | | { |
| | | case SPK.SensorPm25: |
| | | btnTitle.Text = "PM2.5(ug/m³)";//² |
| | | break; |
| | | case SPK.SensorPm10: |
| | | btnTitle.Text = "PM10(ug/m³)";//² |
| | | break; |
| | | case SPK.SensorTemperature: |
| | | btnTitle.Text = Language.StringByID(StringId.Temp) + "(°C)"; |
| | |
| | | case SPK.SensorCO2: |
| | | attr = updateTemp.GetAttribute(FunctionAttributeKey.Co2); |
| | | break; |
| | | case SPK.SensorPm10: |
| | | attr = updateTemp.GetAttribute(FunctionAttributeKey.Pm10); |
| | | break; |
| | | case SPK.SensorTemperature: |
| | | attr = updateTemp.GetAttribute(FunctionAttributeKey.Temperature); |
| | | break; |
| | |
| | | // function.CollectFunction(); |
| | | //}; |
| | | |
| | | |
| | | |
| | | |
| | | //回退刷新信息事件 |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.GroupControl)).LoadTopView_SettingIcon( () => { |
| | | var page = new AddGroupControlPage(function, |
| | |
| | | var btnOnText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(100-9), |
| | | Y = Application.GetRealHeight(500), |
| | | Y = Application.GetRealHeight(495), |
| | | Width = Application.GetMinRealAverage(50), |
| | | Height = Application.GetMinRealAverage(32), |
| | | TextColor = CSS_Color.TextualColor, |
| | |
| | | var btnOffText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(180 - 9), |
| | | Y = Application.GetRealHeight(500), |
| | | Y = Application.GetRealHeight(495), |
| | | Width = Application.GetMinRealAverage(50), |
| | | Height = Application.GetMinRealAverage(32), |
| | | TextColor = CSS_Color.TextualColor, |
| | |
| | | |
| | | if (hadRGB) |
| | | { |
| | | LoadRgbAttrView(hadCCT,hadColorful); |
| | | LoadRgbAttrView(hadCCT,hadColorful,btnOn,btnOff); |
| | | } |
| | | else if (hadCCT) |
| | | { |
| | | LoadCctAttrView(attrView); |
| | | LoadCctAttrView(attrView, btnOn, btnOff); |
| | | } |
| | | else if (hadDimming) |
| | | { |
| | | LoadDimmingAttrView(attrView); |
| | | LoadDimmingAttrView(attrView, btnOn, btnOff); |
| | | } |
| | | else |
| | | { |
| | |
| | | attrView.AddChidren(btnSwitchIcon); |
| | | |
| | | btnSwitchIcon.MouseUpEventHandler = (sender, e) => { |
| | | btnSwitchIcon.IsSelected = !btnSwitchIcon.IsSelected; |
| | | if (btnSwitchIcon.IsSelected) |
| | | { |
| | | var d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, "off"); |
| | | function.Control(d); |
| | | } |
| | | else |
| | | { |
| | | var d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, "on"); |
| | | function.Control(d); |
| | | } |
| | | else |
| | | { |
| | | var d = new Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.OnOff, "off"); |
| | | function.Control(d); |
| | | } |
| | | }; |
| | | |
| | | btnOn.MouseUpEventHandler += (sender, e) => { |
| | | btnSwitchIcon.IsSelected = true; |
| | | }; |
| | | btnOff.MouseUpEventHandler += (sender, e) => { |
| | | btnSwitchIcon.IsSelected = false; |
| | | }; |
| | | } |
| | | |
| | |
| | | /// 加载调光属性设置控件 |
| | | /// </summary> |
| | | /// <param name="attrView"></param> |
| | | void LoadDimmingAttrView(VerticalScrolViewLayout attrView) |
| | | void LoadDimmingAttrView(VerticalScrolViewLayout attrView,Button btnOn,Button btnOff) |
| | | { |
| | | |
| | | |
| | |
| | | |
| | | dimmerBar.OnProgressChangedEvent = (sender, e) => |
| | | { |
| | | |
| | | btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); |
| | | btnBrightnessText.Text = dimmerBar.Progress + "%"; |
| | | return; |
| | | if (e == 0 && lastBrightness != 0) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | }; |
| | | |
| | | |
| | | |
| | | btnOn.MouseUpEventHandler += (sender, e) => { |
| | | dimmerBar.Progress = 100; |
| | | btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); |
| | | btnBrightnessText.Text = dimmerBar.Progress + "%"; |
| | | }; |
| | | btnOff.MouseUpEventHandler += (sender, e) => { |
| | | dimmerBar.Progress = 0; |
| | | btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); |
| | | btnBrightnessText.Text = dimmerBar.Progress + "%"; |
| | | }; |
| | | |
| | | |
| | | } |
| | | int lastBrightness = 0; |
| | |
| | | /// 加载cct属性设置控件 |
| | | /// </summary> |
| | | /// <param name="attrView"></param> |
| | | void LoadCctAttrView(VerticalScrolViewLayout attrView) |
| | | void LoadCctAttrView(VerticalScrolViewLayout attrView,Button btnOn,Button btnOff) |
| | | { |
| | | attrView.AddChidren(new Button |
| | | { |
| | |
| | | |
| | | dimmerBar.OnProgressChangedEvent = (sender, e) => |
| | | { |
| | | btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); |
| | | btnBrightnessText.Text = dimmerBar.Progress + "%"; |
| | | return; |
| | | if (e == 0 && lastBrightness != 0) |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); |
| | | btnBrightnessText.Text = dimmerBar.Progress + "%"; |
| | | }; |
| | | |
| | | |
| | |
| | | cctView.AddChidren(btnTempClolorMax); |
| | | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | btnOn.MouseUpEventHandler += (sender, e) => { |
| | | dimmerBar.Progress = 100; |
| | | btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); |
| | | btnBrightnessText.Text = dimmerBar.Progress + "%"; |
| | | }; |
| | | btnOff.MouseUpEventHandler += (sender, e) => { |
| | | dimmerBar.Progress = 0; |
| | | btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); |
| | | btnBrightnessText.Text = dimmerBar.Progress + "%"; |
| | | }; |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 加载rgb属性设置控件 |
| | | /// </summary> |
| | | /// <param name="attrView"></param> |
| | | void LoadRgbAttrView(bool hadCCT,bool hadColorful) |
| | | void LoadRgbAttrView(bool hadCCT,bool hadColorful,Button btnOn,Button btnOff) |
| | | { |
| | | Light lightTemp = new Light(); |
| | | int magriHeight = 0; |
| | |
| | | |
| | | dimmerBar.OnProgressChangedEvent = (sender, e) => |
| | | { |
| | | //btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); |
| | | //btnBrightnessText.Text = dimmerBar.Progress + "%"; |
| | | return; |
| | | if (e == 0 && lastBrightness != 0) |
| | | { |
| | |
| | | #endregion |
| | | } |
| | | |
| | | btnOn.MouseUpEventHandler += (sender, e) => { |
| | | dimmerBar.Progress = 100; |
| | | //btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); |
| | | //btnBrightnessText.Text = dimmerBar.Progress + "%"; |
| | | }; |
| | | btnOff.MouseUpEventHandler += (sender, e) => { |
| | | dimmerBar.Progress = 0; |
| | | //btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100); |
| | | //btnBrightnessText.Text = dimmerBar.Progress + "%"; |
| | | }; |
| | | |
| | | |
| | | |
| | | } |