Merge branch 'Dev-Branch' into wjc
| | |
| | | { |
| | | |
| | | |
| | | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.2.0.99")] |
| | | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Android.Build.Tasks", "13.2.1.111")] |
| | | public partial class Resource |
| | | { |
| | | |
| | |
| | | //#endif |
| | | JPushInterface.Init(this); |
| | | |
| | | Com.Chteam.Agent.BuglyAgentHelper.Init(this.ApplicationContext, "316a8f5d83"); |
| | | //Com.Chteam.Agent.BuglyAgentHelper.Init(this.ApplicationContext, "316a8f5d83"); |
| | | |
| | | |
| | | BaseActivity.OnCreateActoin += (activity, application) => |
| | |
| | | Console.WriteLine("111111111111"); |
| | | SetCurrentLanguage(); |
| | | //Shared.Application.FontSize = 12; |
| | | Bugly.Bugly.StartWithAppId("1dc40c170a"); |
| | | //Bugly.Bugly.StartWithAppId("1dc40c170a"); |
| | | //取消EditText默认密码输入方式 |
| | | //Shared.Application.IsEditTextContentTypePassword = false; |
| | | //默认使用苹方字体 |
| | |
| | | <PackageReference Include="RestSharp"> |
| | | <Version>106.13.0</Version> |
| | | </PackageReference> |
| | | <PackageReference Include="Xamarin.iOS.Bugly"> |
| | | <Version>1.0.4</Version> |
| | | </PackageReference> |
| | | <PackageReference Include="Xamarin.Essentials"> |
| | | <Version>1.7.0</Version> |
| | | </PackageReference> |
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; |
| | | } |
| | | |
| | | } |
| | |
| | | /// </summary> |
| | | public class Packet |
| | | { |
| | | /// <summary> |
| | | /// 缓冲区大小 |
| | | /// Link协议现在一个包的数据比较大,缓冲区太小存不完全部数据 2023-07-14 16:03:56 wxr |
| | | /// </summary> |
| | | public const int Size = 1024 * 10; |
| | | ///// <summary> |
| | | ///// 缓冲区大小 |
| | | ///// Link协议现在一个包的数据比较大,缓冲区太小存不完全部数据 2023-07-14 16:03:56 wxr |
| | | ///// </summary> |
| | | //public const int Size = 2000; |
| | | |
| | | /// <summary> |
| | | /// 接收到的数据 |
| | |
| | | /// </summary> |
| | | public System.Net.EndPoint RemoteEndPoint; |
| | | |
| | | public Packet() |
| | | public Packet(int lenght) |
| | | { |
| | | this.Bytes = new byte[Size]; |
| | | this.Bytes = new byte[lenght]; |
| | | |
| | | RemoteEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Any, 0); |
| | | } |
| | | |
| | | |
| | | |
| | | public Packet(byte[] data, System.Net.EndPoint remoteEndPoint) |
| | | { |
| | | this.Bytes = data; |
| | |
| | | using System; |
| | | //using System; |
| | | //using System.Net.Sockets; |
| | | //using System.Net; |
| | | |
| | | //namespace HDL_ON.DriverLayer |
| | | //{ |
| | | // public class UdpSocket |
| | | // { |
| | | // static UdpSocket _busSocket; |
| | | // public static UdpSocket _BusSocket |
| | | // { |
| | | // get |
| | | // { |
| | | // if(_busSocket == null) |
| | | // { |
| | | // _busSocket = new UdpSocket(); |
| | | // } |
| | | // return _busSocket; |
| | | // } |
| | | // } |
| | | |
| | | // //本地Socket |
| | | // private Socket busSocket; |
| | | // public int Port = 0; |
| | | // /// <summary> |
| | | // /// 启动Socket接收和发送功能 |
| | | // /// </summary> |
| | | // public void Start (int port = 0) |
| | | // { |
| | | // if (IsRunning) |
| | | // { |
| | | // if (port == Port) |
| | | // { |
| | | // return; |
| | | // } |
| | | // else |
| | | // { |
| | | // busSocket.Close(); |
| | | // } |
| | | // } |
| | | // if (port != 0) |
| | | // Port = port; |
| | | // if (Port == 0) |
| | | // return; |
| | | |
| | | // busSocket = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); |
| | | // busSocket.EnableBroadcast = true; |
| | | // 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){ |
| | | // MainPage.Log ($"udp port bind error : {ex.Message}"); |
| | | |
| | | // busSocket = null; |
| | | // return; |
| | | // } |
| | | |
| | | // asyncBeginReceive(); |
| | | |
| | | // MainPage.Log ($"udp port : {port}"); |
| | | // } |
| | | |
| | | // /// <summary> |
| | | // /// 停止Socket |
| | | // /// </summary> |
| | | // public void Stop() |
| | | // { |
| | | // if(busSocket == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // if (!IsRunning) |
| | | // { |
| | | // return; |
| | | // } |
| | | // try |
| | | // { |
| | | // busSocket.Close(); |
| | | // relinkCount = 0; |
| | | // } |
| | | // catch { } |
| | | // busSocket = null; |
| | | // MainPage.Log("Socket关闭"); |
| | | // } |
| | | |
| | | // /// <summary> |
| | | // /// 当前的Socket是否运行 |
| | | // /// </summary> |
| | | // public bool IsRunning |
| | | // { |
| | | // get |
| | | // { |
| | | // return null == busSocket ? false : true; |
| | | // } |
| | | // } |
| | | |
| | | // /// <summary> |
| | | // /// 开始异步接收数据 |
| | | // /// </summary> |
| | | // private void asyncBeginReceive() |
| | | // { |
| | | // if (!IsRunning) |
| | | // { |
| | | // return; |
| | | // } |
| | | // if(busSocket == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | |
| | | // 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) { |
| | | // System.Threading.Thread.Sleep (1); |
| | | // Console.WriteLine("asyncBeginReceive " + relinkCount ); |
| | | // if (relinkCount == 0) |
| | | // { |
| | | // relinkCount = 1; |
| | | // asyncBeginReceive(); |
| | | // } |
| | | // Console.WriteLine($"asyncBeginReceive {e.Message}"); |
| | | // } |
| | | // } |
| | | // /// <summary> |
| | | // /// 重连次数 |
| | | // /// </summary> |
| | | // private int relinkCount = 0; |
| | | |
| | | |
| | | |
| | | // /// <summary> |
| | | // /// 异步接收数据结束 |
| | | // /// </summary> |
| | | // /// <param name="iar"></param> |
| | | // private void asyncEndReceive(IAsyncResult iar) |
| | | // { |
| | | // if (!IsRunning) |
| | | // { |
| | | // return; |
| | | // } |
| | | // try |
| | | // { |
| | | // if (busSocket == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // asyncBeginReceive(); |
| | | // Packet packet = (Packet)iar.AsyncState; |
| | | // int len = busSocket.EndReceiveFrom(iar, ref packet.RemoteEndPoint); |
| | | |
| | | // byte[] bytes = packet.Bytes; |
| | | // packet.Bytes = new byte[len]; |
| | | // Array.Copy(bytes, 0, packet.Bytes, 0, packet.Bytes.Length); |
| | | |
| | | // //MainPage.Log($"接收{packet.RemoteEndPoint}数据"); |
| | | // //mqtt连接数据读取 A协议网络设备信息读取回复 处理 |
| | | // if (((IPEndPoint)packet.RemoteEndPoint).Port == 8585) |
| | | // { |
| | | // Control.Ins.ConvertReceiveData(bytes, ((IPEndPoint)packet.RemoteEndPoint).Address.ToString()); |
| | | // } |
| | | // else if (((IPEndPoint)packet.RemoteEndPoint).Port == 6000)//处理bus 6000端口的数据 |
| | | // { |
| | | // packet.Manager(); |
| | | // } |
| | | |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // MainPage.Log($"异步接收数据结束 {ex.Message},{((Packet)iar.AsyncState).Bytes}"); |
| | | // } |
| | | // } |
| | | |
| | | // /// <summary> |
| | | // /// 异步发送数据 |
| | | // /// </summary> |
| | | // /// <param name="tempPacket"></param> |
| | | // public void AsyncBeginSend(Packet tempPacket) |
| | | // { |
| | | // try |
| | | // { |
| | | // if (!IsRunning) |
| | | // { |
| | | // tempPacket.HaveSendCount++; |
| | | // return; |
| | | // } |
| | | // tempPacket.FlagDateTime = System.DateTime.Now; |
| | | // tempPacket.HaveSendCount++; |
| | | // busSocket.BeginSendTo(tempPacket.Bytes, 0, tempPacket.Bytes.Length, SocketFlags.None, tempPacket.RemoteEndPoint, new AsyncCallback(asyncEndSend), tempPacket); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // MainPage.Log($"AsyncBeginSend error {ex.Message}"); |
| | | // } |
| | | // } |
| | | |
| | | // /// <summary> |
| | | // /// 异步发送数据结束 |
| | | // /// </summary> |
| | | // /// <param name="iar"></param> |
| | | // private void asyncEndSend(IAsyncResult iar) |
| | | // { |
| | | // Packet tempUDPPacketBuffer = (Packet)iar.AsyncState; |
| | | // try |
| | | // { |
| | | // int bytesSent = busSocket.EndSendTo(iar); |
| | | // } |
| | | // catch { |
| | | |
| | | // } |
| | | // } |
| | | // } |
| | | //} |
| | | |
| | | using System; |
| | | using System.Net.Sockets; |
| | | using System.Net; |
| | | |
| | |
| | | { |
| | | static UdpSocket _busSocket; |
| | | public static UdpSocket _BusSocket |
| | | { |
| | | get |
| | | { |
| | | if(_busSocket == null) |
| | | { |
| | | { |
| | | get |
| | | { |
| | | if (_busSocket == null) |
| | | { |
| | | _busSocket = new UdpSocket(); |
| | | } |
| | | } |
| | | return _busSocket; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //本地Socket |
| | | private Socket busSocket; |
| | |
| | | /// <summary> |
| | | /// 启动Socket接收和发送功能 |
| | | /// </summary> |
| | | public void Start (int port = 0) |
| | | { |
| | | public void Start(int port = 0) |
| | | { |
| | | if (IsRunning) |
| | | { |
| | | if (port == Port) |
| | | { |
| | | return; |
| | | { |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | busSocket.Close(); |
| | | else |
| | | { |
| | | busSocket.Close(); |
| | | } |
| | | } |
| | | } |
| | | if (port != 0) |
| | | Port = port; |
| | | if (Port == 0) |
| | | return; |
| | | |
| | | busSocket = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); |
| | | busSocket.EnableBroadcast = true; |
| | | try { |
| | | busSocket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); |
| | | busSocket.EnableBroadcast = true; |
| | | 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){ |
| | | MainPage.Log ($"udp port bind error : {ex.Message}"); |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"udp port bind error : {ex.Message}"); |
| | | |
| | | busSocket = null; |
| | | return; |
| | | } |
| | | return; |
| | | } |
| | | |
| | | asyncBeginReceive(); |
| | | asyncBeginReceive(); |
| | | |
| | | MainPage.Log ($"udp port : {port}"); |
| | | } |
| | | MainPage.Log($"udp port : {port}"); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 停止Socket |
| | | /// </summary> |
| | | public void Stop() |
| | | { |
| | | if(busSocket == null) |
| | | { |
| | | if (busSocket == null) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | if (!IsRunning) |
| | | { |
| | | return; |
| | |
| | | } |
| | | } |
| | | |
| | | byte []receiveBytes = new byte[2000]; |
| | | |
| | | /// <summary> |
| | | /// 开始异步接收数据 |
| | | /// </summary> |
| | |
| | | { |
| | | return; |
| | | } |
| | | if(busSocket == null) |
| | | { |
| | | if (busSocket == null) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | |
| | | 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) { |
| | | System.Threading.Thread.Sleep (1); |
| | | Console.WriteLine("asyncBeginReceive " + relinkCount ); |
| | | try |
| | | { |
| | | int len = busSocket.Receive(receiveBytes, SocketFlags.None); |
| | | |
| | | Packet packet = new Packet(len); |
| | | |
| | | System.Array.Copy(receiveBytes, packet.Bytes, len); |
| | | packet.Manager(); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | System.Threading.Thread.Sleep(1); |
| | | Console.WriteLine("asyncBeginReceive " + relinkCount); |
| | | if (relinkCount == 0) |
| | | { |
| | | relinkCount = 1; |
| | | asyncBeginReceive(); |
| | | } |
| | | Console.WriteLine($"asyncBeginReceive {e.Message}"); |
| | | } |
| | | Console.WriteLine($"asyncBeginReceive {e.Message}"); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 重连次数 |
| | | /// </summary> |
| | | /// 重连次数 |
| | | /// </summary> |
| | | private int relinkCount = 0; |
| | | |
| | | |
| | |
| | | { |
| | | int bytesSent = busSocket.EndSendTo(iar); |
| | | } |
| | | catch { |
| | | |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | //SetGatewayOnlineResetCheck(); |
| | | //var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, mqttEncryptKey); |
| | | //bus数据解析 |
| | | var packet = new Packet(); |
| | | var packet = new Packet(e.ApplicationMessage.Payload.Length); |
| | | |
| | | if (!string.IsNullOrEmpty(DB_ResidenceData.Instance.HomeGateway.aesKey)) |
| | | { |
| | |
| | | static void SendPushSignOut() |
| | | { |
| | | byte[] message = Encoding.UTF8.GetBytes(PushSignStr); |
| | | #if DEBUG |
| | | |
| | | MqttRemoteSend(message, 4); |
| | | #endif |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | 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> |
| | | /// 红外热水器 |
| | | /// </summary> |
| | | public const string HeaterIr = " ir.water_heater"; |
| | | public const string HeaterIr = "ir.water_heater"; |
| | | /// <summary> |
| | | /// 红外风扇 |
| | | /// </summary> |
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\MemberManagement\AddMemberScanPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\MemberManagement\MemberManagementPageBLL.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\MemberManagement\MemberPermissionPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\MemberManagement\ChooseShareMemberTargetListPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\AddDevciePage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\DeviceListPage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\4-PersonalCenter\AddFunction\BrandListPage.cs" />
|
| | |
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Automation\Constant.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Scene\SceneTargetTypeChoosePage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)UI\UI2\3-Intelligence\Scene\SceneAutomationListChoosePage.cs" />
|
| | | <Compile Include="$(MSBuildThisFileDirectory)DAL\DriverLayer\AsyncUdpServer.cs" />
|
| | | </ItemGroup>
|
| | | <ItemGroup>
|
| | | <Folder Include="$(MSBuildThisFileDirectory)Entity\Device\" />
|
| | |
| | | try |
| | | { |
| | | #if __ANDROID__ |
| | | Com.Chteam.Agent.BuglyAgentHelper.SetUserId(UserInfo.Current.AccountString); |
| | | //Com.Chteam.Agent.BuglyAgentHelper.SetUserId(UserInfo.Current.AccountString); |
| | | #else |
| | | Bugly.Bugly.SetUserIdentifier(UserInfo.Current.AccountString); |
| | | //Bugly.Bugly.SetUserIdentifier(UserInfo.Current.AccountString); |
| | | #endif |
| | | } |
| | | catch (Exception ex) |
| | |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | this.AddChidren(bodyView); |
| | | new TopViewDiv(this, bodyView, titleStr).LoadTopView(closeAction); |
| | | var topView = new TopViewDiv(this, bodyView, titleStr); |
| | | topView.maginY = 10; |
| | | topView.LoadTopView(closeAction); |
| | | //WebView |
| | | mWebView = new WebView() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = bodyView.Height - Application.GetRealHeight(64), |
| | | Y = Application.GetRealHeight(64+10), |
| | | Height = bodyView.Height - Application.GetRealHeight(64+10), |
| | | X = Application.GetRealWidth(16), |
| | | Width = bodyView.Width - Application.GetRealWidth(32) |
| | | }; |
| | |
| | | //返回键 |
| | | var btnBack = new PicViewControl(40, 28); |
| | | btnBack.X = Application.GetRealWidth(10); |
| | | btnBack.Y = Application.GetRealHeight(9);
|
| | | btnBack.Y = Application.GetRealHeight(19);
|
| | | btnBack.UnSelectedImagePath = "Public/BackIcon.png"; |
| | | topFrameLayout.AddChidren(btnBack);
|
| | | topFrameLayout.AddTag("btnBack", btnBack); |
| | |
| | | //标题
|
| | | var btnTilte = new NormalViewControl(270, 25, true);
|
| | | btnTilte.Gravity = Gravity.CenterHorizontal;
|
| | | btnTilte.Y = Application.GetRealHeight(10);
|
| | | btnTilte.Y = Application.GetRealHeight(20);
|
| | | btnTilte.TextAlignment = TextAlignment.Center;
|
| | | btnTilte.TextSize = UI.CSS.CSS_FontSize.HeadlineFontSize;
|
| | | btnTilte.TextColor = UI.CSS.CSS_Color.FirstLevelTitleColor;
|
| | |
| | | /// <param name="btnHigherCollection">上一级界面的收藏控件(原来on的框架太坑)</param>
|
| | | /// <param name="btnHigherDeviceName">上一级界面的设备名字控件(原来on的框架太坑)</param>
|
| | | private void AddTopSettingIcon(Button btnHigherDeviceName, Button btnHigherRoom)
|
| | | {
|
| | | //设置图标(门锁界面需要借用这个图标的X轴和Y轴,所以加进来)
|
| | | var btnSetting = new PicViewControl(28, 28);
|
| | | btnSetting.X = Application.GetRealWidth(337);
|
| | | btnSetting.Y = Application.GetRealHeight(9);
|
| | | btnSetting.UnSelectedImagePath = "Public/FuncInfoSetIcon.png";
|
| | | { |
| | | //设置图标(门锁界面需要借用这个图标的X轴和Y轴,所以加进来) |
| | | var btnSetting = new Button() |
| | | { |
| | | X = Application.GetRealWidth(337),
|
| | | Y = Application.GetRealHeight(19),
|
| | | Width = Application.GetMinRealAverage(32),
|
| | | Height = Application.GetMinRealAverage(32),
|
| | | UnSelectedImagePath = "Public/FuncInfoSetIcon.png", |
| | | };
|
| | | //var btnSetting = new PicViewControl(28, 28);
|
| | | //btnSetting.X = Application.GetRealWidth(337);
|
| | | //btnSetting.Y = Application.GetRealHeight(9);
|
| | | //btnSetting.UnSelectedImagePath = "Public/FuncInfoSetIcon.png";
|
| | | btnSetting.Name = "btnSetting";
|
| | | topFrameLayout.AddChidren(btnSetting);
|
| | |
|
| | |
| | | btnSetting.Visible = false;
|
| | | }
|
| | |
|
| | | btnSetting.ButtonClickEvent += (sender, e) =>
|
| | | btnSetting.MouseUpEventHandler += (sender, e) =>
|
| | | {
|
| | | var infoView = new UI.FunctionBaseInfoSetPage(this.device, () =>
|
| | | {
|
| | |
| | | /// <summary>
|
| | | /// 画面TopFrameLayout的高度(高度:44)
|
| | | /// </summary>
|
| | | public static int TopFrameHeight = Application.GetRealHeight(44);
|
| | | public static int TopFrameHeight = Application.GetRealHeight(44 + 10);
|
| | | /// <summary>
|
| | | /// 画面BodyFrameLayout的高度(不能直接指定数值,不然有可能会出现误差,导致无法铺满)
|
| | | /// </summary>
|
| | |
| | | skipView.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView_LightFunction(action); |
| | | var topView = new TopViewDiv(bodyView, Language.StringByID(titleId)); |
| | | topView.maginY = 10; |
| | | topView.LoadTopView_LightFunction(action); |
| | | } |
| | | else |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView(); |
| | | var topView = new TopViewDiv(bodyView, Language.StringByID(titleId)); |
| | | topView.maginY = 10; |
| | | topView.LoadTopView(); |
| | | } |
| | | |
| | | |
| | | |
| | | #if DEBUG |
| | | //Button testBtn = new Button() |
| | | //{ |
| | | // X = Application.GetRealWidth(80), |
| | | // Height = Application.GetRealHeight(64), |
| | | // BackgroundColor = 0xFFFF0000 |
| | | //}; |
| | | //bodyView.AddChidren(testBtn); |
| | | //int ddd = 0; |
| | | //testBtn.MouseUpEventHandler = (sender, e) => { |
| | | // ddd++; |
| | | |
| | | // Function function_online = FunctionList.List.GetLightList().Find((obj) => obj.sid == "0001017DB92D2602020100010101"); |
| | | // if (ddd % 2 == 0) |
| | | // { |
| | | // function_online.online = true; |
| | | // } |
| | | // else |
| | | // { |
| | | // function_online.online = false; |
| | | // } |
| | | // HomePage.LoadEvent_RefreshDevcieOnline(function_online); |
| | | // FunctionPage.UpdataOnline(function_online); |
| | | // RoomPage.UpdataOnline(function_online); |
| | | |
| | | |
| | | //}; |
| | | #endif |
| | | |
| | | /// <summary> |
| | | /// 房间内容显示区域 |
| | | /// </summary> |
| | | var roomFloorChangeView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Y = Application.GetRealHeight(64+10), |
| | | Height = Application.GetRealHeight(52), |
| | | }; |
| | | bodyView.AddChidren(roomFloorChangeView); |
| | |
| | | |
| | | functionListView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64 + 52), |
| | | Height = Application.GetRealHeight(603 - 12 - 52), |
| | | Y = Application.GetRealHeight(64 + 52 +10), |
| | | Height = Application.GetRealHeight(603 - 12 - 52-10), |
| | | }; |
| | | bodyView.AddChidren(functionListView); |
| | | |
| | |
| | | /// </summary> |
| | | public void LoadPage() |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.Complaints)).LoadTopView(); |
| | | var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.Complaints)); |
| | | topView.maginY = 10; |
| | | topView.LoadTopView(); |
| | | |
| | | #region 投诉联系 |
| | | FrameLayout phoneRow = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Y = Application.GetRealHeight(64+10), |
| | | Height = Application.GetRealWidth(50), |
| | | }; |
| | | bodyView.AddChidren(phoneRow); |
| | |
| | | |
| | | public void ShowPage() |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.FirmwareUpdate)).LoadTopView(); |
| | | var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.FirmwareUpdate)); |
| | | topView.maginY = 10; |
| | | topView.LoadTopView(); |
| | | |
| | | var contentView = new VerticalScrolViewLayout() |
| | | { |
| | | X = Application.GetRealWidth(12), |
| | | Y = Application.GetRealHeight(90), |
| | | Y = Application.GetRealHeight(100), |
| | | Height = bodyView.Height, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | |
| | | } |
| | | public void ShowPage() |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.SupportHomeKitNotes)).LoadTopView(); |
| | | var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.SupportHomeKitNotes)); |
| | | topView.maginY = 10; |
| | | topView.LoadTopView(); |
| | | |
| | | var contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(90), |
| | | Height = bodyView.Height , |
| | | Y = Application.GetRealHeight(100), |
| | | Height = Application.GetRealHeight(490) , |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | if (isAdd) |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.GroupControl)).LoadTopView(); |
| | | var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.GroupControl)); |
| | | topView.maginY = 10; |
| | | topView.LoadTopView(); |
| | | } |
| | | else |
| | | { |
| | | new TopViewDiv(bodyView, "").LoadTopView_SettingText(()=> { |
| | | var topView = new TopViewDiv(bodyView, ""); |
| | | topView.maginY = 10; |
| | | topView.LoadTopView_SettingText(()=> { |
| | | |
| | | Action action = () => { |
| | | var waitPage = new Loading(); |
| | |
| | | } |
| | | var contentView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealHeight(667-64), |
| | | Y = Application.GetRealHeight(64+10), |
| | | Height = Application.GetRealHeight(667-64-10), |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | |
| | | functionListView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(220), |
| | | Height = Application.GetRealHeight(640 - 12 - 52 - 100 -100), |
| | | Height = Application.GetRealHeight(640 - 12 - 52 - 100 -100-10), |
| | | }; |
| | | bodyView.AddChidren(functionListView); |
| | | |
| | |
| | | public void LoadPage() |
| | | { |
| | | |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.GroupControl)).LoadTopView_AddIcon("CombinedDimming", |
| | | var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.GroupControl)); |
| | | topView.maginY = 10; |
| | | topView.LoadTopView_AddIcon("CombinedDimming", |
| | | (s, c) => |
| | | { |
| | | try |
| | |
| | | |
| | | contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealHeight(667 - 64), |
| | | Y = Application.GetRealHeight(64+10), |
| | | Height = Application.GetRealHeight(667 - 64-10), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | |
| | | public void LoadPage() |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.CombinedDimming)).LoadTopView(); |
| | | var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.CombinedDimming)); |
| | | topView.maginY = 10; |
| | | topView.LoadTopView(); |
| | | |
| | | contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealHeight(667 - 64), |
| | | Y = Application.GetRealHeight(64+10), |
| | | Height = Application.GetRealHeight(667 - 64-10), |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | |
| | | public void LoadPage() |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.AddMember)).LoadTopView(); |
| | | var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.AddMember)); |
| | | topView.maginY = 10; |
| | | topView.LoadTopView(); |
| | | |
| | | var btnMemberName = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(70), |
| | | Y = Application.GetRealHeight(70+10), |
| | | X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealHeight(32), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | |
| | | public void LoadPage() |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | new TopViewDiv(bodyView, memberInfo.nickName).LoadTopView(); |
| | | var topView = new TopViewDiv(bodyView, memberInfo.nickName); |
| | | topView.maginY = 10; |
| | | topView.LoadTopView(); |
| | | |
| | | #region 人脸管理 |
| | | var btnMemberFaceTitle = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(80), |
| | | Y = Application.GetRealHeight(80+10), |
| | | X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealHeight(32), |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | |
| | | public void LoadPage(int tId) |
| | | { |
| | | titleId = tId; |
| | | new TopViewDiv(bodyView, Language.StringByID(titleId)).LoadTopView(); |
| | | var topView = new TopViewDiv(bodyView, Language.StringByID(titleId)); |
| | | topView.maginY = 10; |
| | | topView.LoadTopView(); |
| | | |
| | | allRoomView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Y = Application.GetRealHeight(64+10), |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | |
| | | |
| | | contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64+50), |
| | | Height = Application.GetRealHeight(450), |
| | | Y = Application.GetRealHeight(64+50+10), |
| | | Height = Application.GetRealHeight(450-10), |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | |
| | | //是否需要保存 |
| | | new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.IfNeedToSave, action); |
| | | |
| | | //if (titleId == StringId.PermissionToUse)//从个人中心进入单独分享 |
| | | //{ |
| | | // Action action = () => |
| | | // { |
| | | // UploadShareDeviceList(); |
| | | // }; |
| | | // //是否需要保存 |
| | | // new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.IfNeedToSave, action); |
| | | //} |
| | | //else |
| | | //{ |
| | | // //var sharedBytes = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(funs_New)); |
| | | // //2020-12-01 屏蔽页面 |
| | | // //var page = new ChooseShareMemberTargetListPage(funs_New, memberInfo); |
| | | // //MainPage.BasePageView.AddChidren(page); |
| | | // //page.LoadPage(); |
| | | // //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | //} |
| | | }; |
| | | } |
| | | |
| | |
| | | public void LoadPage() |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.MemberPermissionManagement)).LoadTopView(); |
| | | var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.MemberPermissionManagement)); |
| | | topView.maginY = 10; |
| | | topView.LoadTopView(); |
| | | |
| | | FrameLayout headPortraitView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Y = Application.GetRealHeight(64+10), |
| | | Height = Application.GetRealHeight(66), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | |
| | | BorderColor = CSS.CSS_Color.DividingLineColor, |
| | | BorderWidth = 3, |
| | | TextColor = CSS.CSS_Color.TextualColor, |
| | | Radius = 1, |
| | | }; |
| | | searchView.AddChidren(searchTv); |
| | | |
| | |
| | | |
| | | 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, |
| | |
| | | /// </summary> |
| | | public void LoadPage() |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.DataManagement)).LoadTopView(); |
| | | var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.DataManagement)); |
| | | topView.maginY = 10; |
| | | topView.LoadTopView(); |
| | | |
| | | int bodyY = Application.GetRealHeight(64); |
| | | int bodyY = Application.GetRealHeight(64+10); |
| | | bodyScrolView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = bodyY, |
| | |
| | | public void LoadPage() |
| | | { |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.LocationManagement)).LoadTopView(); |
| | | var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.LocationManagement)); |
| | | topView.maginY = 10; |
| | | topView.LoadTopView(); |
| | | |
| | | contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealHeight(667 - 64), |
| | | Y = Application.GetRealHeight(64+10), |
| | | Height = Application.GetRealHeight(667 - 64-10), |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |