Merge branch 'wxr-2.1' into wxr-2.0
| | |
| | | <AndroidAsset Include="Assets\Phone\HisenseTv\yingliangjiaSelected.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\EnvirSensor\IlluminationBg.png" /> |
| | | <AndroidAsset Include="Assets\Phone\FunctionIcon\EnvirSensor\IlluminationIcon.png" /> |
| | | <AndroidAsset Include="Assets\h5\static\js\pages-index-index~pages-inverter-index.0253e8cd.js" /> |
| | | <AndroidAsset Include="Assets\h5\static\img\inverter-center.18b181f4.png" /> |
| | | <AndroidAsset Include="Assets\h5\static\img\co2-reduction-ic.9c75228c.png" /> |
| | | <AndroidAsset Include="Assets\h5\static\img\equal-plant-ic.7ef6befa.png" /> |
| | | <AndroidAsset Include="Assets\h5\static\img\coal-save-ic.6c5fd125.png" /> |
| | | <AndroidAsset Include="Assets\h5\static\font\SourceHanSansCN-Normal.otf" /> |
| | | <AndroidAsset Include="Assets\Phone\Collection\GatewayOnlineTipIcon.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <AndroidResource Include="Resources\values\colors.xml" /> |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.1.2" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202308171"> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="2.1.2" package="com.hdl.onpro" xmlns:tools="http://schemas.android.com/tools" android:versionCode="202308281"> |
| | | <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="29" /> |
| | | <uses-permission android:name="android.permission.RECEIVE_SMS" /> |
| | | <!--友盟--> |
| | |
| | | <BundleResource Include="Resources\Phone\HisenseTv\yingliangjiaSelected.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\EnvirSensor\IlluminationBg.png" /> |
| | | <BundleResource Include="Resources\Phone\FunctionIcon\EnvirSensor\IlluminationIcon.png" /> |
| | | <BundleResource Include="Resources\Phone\Collection\GatewayOnlineTipIcon.png" /> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ITunesArtwork Include="iTunesArtwork" /> |
| | |
| | | } |
| | | else |
| | | { |
| | | var pm = new DAL.Server.HttpServerRequest(); |
| | | var pack = pm.RefreshDeviceStatus(new List<string>() { function.deviceId }); |
| | | var pm = new HttpServerRequest(); |
| | | try |
| | | { |
| | | pm.RefreshDeviceStatus(new List<string>() { function.deviceId }); |
| | | }catch(Exception ex) |
| | | { |
| | | MainPage.Log($"远程读取设备状态异常:{ex.Message}"); |
| | | } |
| | | finally |
| | | { |
| | | pm = null; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | MainPage.Log(localFunction.name); |
| | | |
| | | if (Ins.GatewayOnline_Local && isCloudData)//本地链接,除了涂鸦设备数据之外的云端数据不处理 |
| | | { |
| | | if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(localFunction.spk) && !SPK.MusicSpkList().Contains(localFunction.spk)) |
| | | { |
| | | //MainPage.Log($"A协议更新状态:本地链接,除了涂鸦设备数据之外的云端数据不处理........"); |
| | | |
| | | return; |
| | | } |
| | | } |
| | | |
| | | //if (SPK.MusicSpkList().Contains(localFunction.spk)) |
| | | //{ |
| | | // if (updateTemp.status.Count < 3) |
| | |
| | | { |
| | | localFunction.online = updateTemp.online; |
| | | } |
| | | if (SPK.LightSpkList().Contains(localFunction.spk)) |
| | | { |
| | | localFunction.updateTime = DateTime.Now; |
| | | } |
| | | |
| | | |
| | | //更新界面状态 |
| | | switch (localFunction.spk) |
| | |
| | | break; |
| | | } |
| | | |
| | | |
| | | HomePage.UpdataFunctionStates(localFunction); |
| | | RoomPage.UpdataStates(localFunction); |
| | | FunctionPage.UpdataStates(localFunction); |
| | |
| | | { |
| | | var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey); |
| | | var revString = Encoding.UTF8.GetString(bytes); |
| | | MainPage.Log($"mqtt 状态更新:{revString}"); |
| | | //MainPage.Log($"mqtt 状态更新:{revString}"); |
| | | Control.Ins.UpdataFunctionStatus(revString, null, true); |
| | | //Control.Ins.MsgInfoList.Add($"mqtt 状态更新:{revString}"); |
| | | //Control.Ins.MsgInfoList.Add(revString + "\r\n"); |
| | |
| | | var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetGroupControlInfos, requestJson); |
| | | return pack; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取群控详情 |
| | | /// </summary> |
| | |
| | | /// 更新时间 |
| | | /// </summary> |
| | | public DateTime refreshTime = DateTime.MinValue; |
| | | /// <summary> |
| | | /// 最后更新状态的时间 |
| | | /// </summary> |
| | | [Newtonsoft.Json.JsonIgnore] |
| | | public DateTime updateTime = DateTime.MinValue; |
| | | |
| | | /// <summary> |
| | | /// 获取本地控制数据 |
| | |
| | | || msg.Contains("发送") |
| | | || msg.Contains("接收到推送") |
| | | || msg.Contains("api") |
| | | |
| | | || msg.Contains("读取功能状态") |
| | | //|| true |
| | | ) |
| | | Console.WriteLine(msg); |
| | | #endif |
| | |
| | | //etAccount.Text = "18244942707"; |
| | | //etAccount.Text = "13143792049"; |
| | | etAccount.Text = "18688414428";//天河3楼 |
| | | //etAccount.Text = "18244942707"; |
| | | //etAccount.Text = "13418062953"; |
| | | etAccount.Text = "13138683659"; |
| | | //etAccount.Text = "15217626103"; |
| | |
| | | etAccount.Text = "pjh@hdlchina.com.cn"; |
| | | //etAccount.Text = "12345678904";//2.0 测试 萤石 |
| | | etAccount.Text = "18316672920"; |
| | | etAccount.Text = "18244942707"; |
| | | } |
| | | else |
| | | { |
| | |
| | | /// <summary> |
| | | /// 连接状态提示 |
| | | /// </summary> |
| | | Button btnLinkStateTip; |
| | | FrameLayout divLinkStateTip; |
| | | /// <summary> |
| | | /// 安防状态图标 |
| | | /// </summary> |
| | |
| | | IsBold = true |
| | | }; |
| | | topView.AddChidren(btnResidenceName); |
| | | btnLinkStateTip = new Button() |
| | | |
| | | divLinkStateTip = new FrameLayout() |
| | | { |
| | | //X = Application.GetRealWidth(16), |
| | | Y = btnResidenceName.Bottom, |
| | | Height = Application.GetRealWidth(14), |
| | | //BackgroundColor = CSS_Color.LinkTipFail, |
| | | TextAlignment = TextAlignment.Center, |
| | | Y = Application.GetRealHeight(113) - Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(24), |
| | | BackgroundColor = 0xFFFF4747, |
| | | Visible = false, |
| | | }; |
| | | topView.AddChidren(divLinkStateTip); |
| | | Button btnLinkStateIcon = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetRealWidth(20), |
| | | Height = Application.GetRealWidth(20), |
| | | UnSelectedImagePath = "Collection/GatewayOnlineTipIcon.png" |
| | | }; |
| | | divLinkStateTip.AddChidren(btnLinkStateIcon); |
| | | |
| | | var btnLinkStateTip = new Button() |
| | | { |
| | | X = btnLinkStateIcon.Right + Application.GetRealWidth(4), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | TextID = StringId.NetworkAnomaly, |
| | | }; |
| | | topView.AddChidren(btnLinkStateTip); |
| | | //btnLinkStateTip.Width = btnLinkStateTip.GetTextWidth(); |
| | | divLinkStateTip.AddChidren(btnLinkStateTip); |
| | | //更新链接状态icon颜色 |
| | | |
| | | |
| | | #if DEBUG |
| | | int ddd = 0; |
| | | btnResidenceName.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | //827a98c98da7469b8bc19bb6a3c7651906 |
| | | //St_00009073b431d8b2490c9df0c5cb0e73 |
| | | //Com.Hdl.HdlToLc.InitData(Shared.Application.Activity,false, "827a98c98da7469b8bc19bb6a3c7651906"); |
| | | //Com.Hdl.HdlToLc.OpenActivity(); |
| | | //new System.Threading.Thread(() => |
| | | //{ |
| | | // var http = new HttpServerRequest(); |
| | | // var pack = http.GetLcSubAccountToken(); |
| | | // if (pack.Code == StateCode.SUCCESS) |
| | | // { |
| | | // if(pack.Data == null || string.IsNullOrEmpty(pack.Data.ToString())) |
| | | // { |
| | | // Application.RunOnMainThread(() => |
| | | // { |
| | | // new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip), Language.StringByID(StringId.huoqushujushibao)); |
| | | // }); |
| | | // } |
| | | // Com.Utils.HdlToLcUtils.Instance.HomeId = DB_ResidenceData.Instance.CurrentRegion.id; |
| | | // Com.Utils.HdlToLcUtils.Instance.Token = UserInfo.Current.AccessToken; |
| | | // Com.Utils.HdlToLcUtils.Instance.SubAccessToken = pack.Data.ToString(); |
| | | // Application.RunOnMainThread(() => |
| | | // { |
| | | // //Com.Utils.HdlToLcUtils.Instance.OpenActivity(); |
| | | // //Com.Utils.HdlToLcUtils.Instance.Play() |
| | | // var backTemp = new AddLcCam(); |
| | | // backTemp.backAction = () => |
| | | // { |
| | | // //Load3tyBrandDeviceList(); |
| | | // }; |
| | | // Com.Utils.HdlToLcUtils.Instance.AddCamera(backTemp); |
| | | // }); |
| | | // } |
| | | // else |
| | | // { |
| | | // Application.RunOnMainThread(() => |
| | | // { |
| | | // new PublicAssmebly().TipMsg(Language.StringByID(StringId.Tip), Language.StringByID(StringId.huoqushujushibao) + $"({pack.Code})"); |
| | | // }); |
| | | // } |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | }; |
| | | #endif |
| | | |
| | | environmentalView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(1) + btnResidenceName.Bottom, |
| | |
| | | |
| | | if (!Control.Ins.GatewayOnline_Local && !Control.Ins.GatewayOnline_Cloud) |
| | | { |
| | | bodyView.btnLinkStateTip.BackgroundColor = CSS.CSS_Color.LinkTipFail; |
| | | bodyView.btnLinkStateTip.TextID = StringId.NetworkAnomaly; |
| | | bodyView.environmentalView.Y = Application.GetRealHeight(8) + btnResidenceName.Bottom; |
| | | bodyView.divLinkStateTip.Visible = true; |
| | | } |
| | | //else if () |
| | | //{ |
| | | // bodyView.divLinkStateTip.Visible = true; |
| | | //} |
| | | else |
| | | { |
| | | bodyView.btnLinkStateTip.BackgroundColor = 0x00000000; |
| | | bodyView.btnLinkStateTip.Text = ""; |
| | | bodyView.environmentalView.Y = Application.GetRealHeight(1) + btnResidenceName.Bottom; |
| | | bodyView.divLinkStateTip.Visible = false; |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | object lockObj = new object(); |
| | | |
| | | /// <summary> |
| | | /// 更新显示状态 |
| | | /// </summary> |
| | | public static void UpdataFunctionStates(Function function) |
| | | { |
| | | if(bodyView == null) |
| | | { |
| | | return; |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | |
| | | { |
| | | public partial class FunctionPage |
| | | { |
| | | System.Threading.Thread updateUiThread; |
| | | object lockObj = new object(); |
| | | /// <summary> |
| | | /// 更新功能列表界面功能状态 |
| | | /// </summary> |
| | | /// <param name="function"></param> |
| | | public static void UpdataStates(Function function) |
| | | { |
| | | try |
| | | { |
| | | if (bodyView == null) |
| | | { |
| | | return; |
| | | } |
| | | //if (SPK.LightSpkList().Contains(function.spk)) |
| | | //{ |
| | | |
| | | // { |
| | | // var localFunction = FunctionList.List.GetLightList().Find((obj) => obj.sid == function.sid); |
| | | // { |
| | | // if (localFunction != null) |
| | | // { |
| | | // if (bodyView.updateUiThread == null) |
| | | // { |
| | | // bodyView.updateUiThread = new System.Threading.Thread(() => |
| | | // { |
| | | // lock (bodyView.lockObj) |
| | | // { |
| | | // if (bodyView.updateUiThread == null) |
| | | // { |
| | | // MainPage.Log("线程被置空了!!"); |
| | | // return; |
| | | // } |
| | | // try |
| | | // { |
| | | // while (true) |
| | | // { |
| | | // System.Threading.Thread.Sleep(1500); |
| | | // if (bodyView == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // if (DateTime.Now.AddMilliseconds(-1500) > localFunction.updateTime) |
| | | // { |
| | | // MainPage.Log("没有新数据,更新UI"); |
| | | // break; |
| | | // } |
| | | // else |
| | | // { |
| | | // MainPage.Log("有新数据,继续等待"); |
| | | // } |
| | | // } |
| | | // new ClassificaitionPublicBLL().UpdataStates(localFunction, bodyView, functionListView); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // MainPage.Log("FunctionPage UpdateStates error 2 :" + ex.Message); |
| | | // } |
| | | // finally |
| | | // { |
| | | // //bodyView.updateUiThread = null; |
| | | // } |
| | | // } |
| | | // }); |
| | | // bodyView.updateUiThread.IsBackground = true; |
| | | // bodyView.updateUiThread.Start(); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | //} |
| | | //else |
| | | { |
| | | new ClassificaitionPublicBLL().UpdataStates(function, bodyView, functionListView); |
| | | } |
| | | }catch(Exception ex) |
| | | { |
| | | MainPage.Log("FunctionPage UpdateStates error " + ex.Message); |
| | | } |
| | | } |
| | | |
| | | public static void UpdataOnline(Function function) |
| | | { |
| | |
| | | { |
| | | public partial class RoomPage |
| | | { |
| | | System.Threading.Thread updateUiThread; |
| | | object lockObj = new object(); |
| | | /// <summary> |
| | | /// 更新功能状态 |
| | | /// </summary> |
| | | /// <param name="function"></param> |
| | | public static void UpdataStates(Function function) |
| | | { |
| | | |
| | | try |
| | | { |
| | | if (bodyView == null) |
| | | { |
| | | return; |
| | | } |
| | | //if (SPK.LightSpkList().Contains(function.spk)) |
| | | //{ |
| | | // { |
| | | // var localFunction = FunctionList.List.GetLightList().Find((obj) => obj.sid == function.sid); |
| | | // { |
| | | // if (localFunction != null) |
| | | // { |
| | | // if (bodyView.updateUiThread == null) |
| | | // { |
| | | // bodyView.updateUiThread = new System.Threading.Thread(() => |
| | | // { |
| | | // lock (bodyView.lockObj) |
| | | // { |
| | | // try |
| | | // { |
| | | // while (true) |
| | | // { |
| | | // try |
| | | // { |
| | | // System.Threading.Thread.Sleep(1500); |
| | | // if (bodyView == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // if (bodyView.updateUiThread == null) |
| | | // { |
| | | // return; |
| | | // } |
| | | // if (DateTime.Now.AddMilliseconds(-1500) > localFunction.updateTime) |
| | | // { |
| | | // MainPage.Log("没有新数据,更新UI"); |
| | | // break; |
| | | // } |
| | | // else |
| | | // { |
| | | // MainPage.Log("有新数据,继续等待"); |
| | | // } |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // MainPage.Log("线程异常:" + ex.Message); |
| | | // } |
| | | // } |
| | | // new ClassificaitionPublicBLL().UpdataStates(function, bodyView, functionListView, room); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // MainPage.Log("FunctionPage UpdateStates error 2 :" + ex.Message); |
| | | // } |
| | | // finally |
| | | // { |
| | | // //bodyView.updateUiThread = null; |
| | | // } |
| | | // } |
| | | // }); |
| | | // bodyView.updateUiThread.IsBackground = true; |
| | | // bodyView.updateUiThread.Start(); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | //} |
| | | //else |
| | | { |
| | | new ClassificaitionPublicBLL().UpdataStates(function, bodyView, functionListView,room); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log("FunctionPage UpdateStates error " + ex.Message); |
| | | } |
| | | |
| | | } |
| | | public static void UpdataOnline(Function function) |
| | | { |
| | | new ClassificaitionPublicBLL().UpdataOnlineStatus(function, bodyView, functionListView); |
| | |
| | | |
| | | if (sceneFunction.localFunction.spk == SPK.LightRGB || sceneFunction.localFunction.spk == SPK.GroupControl) |
| | | { |
| | | //var colorfulStatus = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful); |
| | | //if (colorfulStatus != null) |
| | | //{ |
| | | // isColorful = true; |
| | | // LoadColorfulRow(colorfulStatus); |
| | | // isColorful = colorfulStatus.value == "on"; |
| | | //} |
| | | var colorfulStatus = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful); |
| | | if (colorfulStatus != null) |
| | | { |
| | | isColorful = true; |
| | | LoadColorfulRow(colorfulStatus); |
| | | isColorful = colorfulStatus.value == "on"; |
| | | } |
| | | } |
| | | foreach (var attr in sceneFunction.status) |
| | | { |
| | |
| | | MainPage.Log($"新增群控转换数据异常:{ex.Message}"); |
| | | } |
| | | } |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(""); |
| | | new Thread(() => |
| | | { |
| | | try |
| | | { |
| | | groupControl.type = groupControlType.type; |
| | | groupControl.sid = groupControl.NewGroupControlSid(); |
| | | var pack = Common.ApiUtlis.Ins.HttpRequest.AddGroupControl(new List<GroupControl>() { groupControl }); |
| | | var pack = ApiUtlis.Ins.HttpRequest.AddGroupControl(new List<GroupControl>() { groupControl }); |
| | | if (pack != null) |
| | | { |
| | | if (pack.Code == StateCode.SUCCESS) |
| | |
| | | { |
| | | MainPage.Log($"添加群控异常,转译返回数据失败:{ex.Message}"); |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | addActon?.Invoke(groupControl); |
| | | this.RemoveFromParent(); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(pack.Code); |
| | | } |
| | | } |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"新增群控异常:{ex.Message}"); |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | try |
| | | { |
| | | waitPage.Hide(); |
| | | waitPage = null; |
| | | } |
| | | catch { } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | else |
| | | { |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(""); |
| | | new Thread(() => |
| | | { |
| | | try |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | var pack = Common.ApiUtlis.Ins.HttpRequest.EditGroupControl(new List<GroupControl>() { groupControl }); |
| | | var pack = ApiUtlis.Ins.HttpRequest.EditGroupControl(new List<GroupControl>() { groupControl }); |
| | | if (pack != null) |
| | | { |
| | | if (pack.Code == StateCode.SUCCESS) |
| | |
| | | { |
| | | temp = groupControl; |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | addActon?.Invoke(temp); |
| | | this.RemoveFromParent(); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | |
| | | { |
| | | MainPage.Log($"编辑群控异常:{ex.Message}"); |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | | { |
| | | waitPage.Hide(); |
| | | waitPage = null; |
| | | } |
| | | catch { } |
| | | }); |
| | | |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | } |
| | | } |
| | |
| | | public partial class ColorTureLampPage
|
| | | {
|
| | | /// <summary>
|
| | | /// 通知更新界面的时间 |
| | | /// </summary> |
| | | DateTime notiyUpdateTime = DateTime.MinValue; |
| | | System.Threading.Thread updateUiThread; |
| | | object lockObj = new object();
|
| | | /// <summary>
|
| | | /// 更新功能状态
|
| | | /// </summary>
|
| | | public static void UpdataStatus(Function updataTemp)
|
| | | {
|
| | | if(bodyView == null) |
| | | { |
| | | return; |
| | | } |
| | | lock (bodyView.lockObj) |
| | | { |
| | | MainPage.Log($"收到更新" + DateTime.Now.Ticks); |
| | | bodyView.notiyUpdateTime = DateTime.Now; |
| | | if (bodyView.updateUiThread == null) |
| | | { |
| | | bodyView.updateUiThread = new System.Threading.Thread(() => |
| | | { |
| | | while (true) |
| | | { |
| | | System.Threading.Thread.Sleep(1500); |
| | | if (bodyView == null) |
| | | { |
| | | return; |
| | | } |
| | | if (DateTime.Now.AddMilliseconds(-1500) > bodyView.notiyUpdateTime) |
| | | { |
| | | MainPage.Log("没有新数据,更新UI"); |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | MainPage.Log("有新数据,继续等待"); |
| | | } |
| | | } |
| | | |
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | try
|
| | |
| | | {
|
| | | MainPage.Log($"{bodyView.GetType().Name } UpdataStates error : {ex.Message}");
|
| | | }
|
| | | finally |
| | | { |
| | | bodyView.updateUiThread = null; |
| | | } |
| | | |
| | | });
|
| | | |
| | | bodyView.updateUiThread.IsBackground = true; |
| | | bodyView.updateUiThread.Start(); |
| | | }); |
| | | } |
| | | } |
| | | }
|
| | |
|
| | | void LoadEventList()
|
| | |
| | | d.Add(FunctionAttributeKey.Brightness, e.ToString());
|
| | | Control.Ins.SendWriteCommand(function, d);
|
| | | }
|
| | | else
|
| | | {
|
| | | if (350 < (DateTime.Now - function.refreshTime).TotalMilliseconds)
|
| | | {
|
| | | function.refreshTime = DateTime.Now;
|
| | | new System.Threading.Thread(() =>
|
| | | {
|
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
|
| | | d.Add(FunctionAttributeKey.Brightness, e.ToString());
|
| | | Control.Ins.SendWriteCommand(function, d);
|
| | | })
|
| | | { IsBackground = true }.Start();
|
| | | }
|
| | | }
|
| | | //else
|
| | | //{
|
| | | // if (350 < (DateTime.Now - function.refreshTime).TotalMilliseconds)
|
| | | // {
|
| | | // function.refreshTime = DateTime.Now;
|
| | | // new System.Threading.Thread(() =>
|
| | | // {
|
| | | // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
|
| | | // d.Add(FunctionAttributeKey.Brightness, e.ToString());
|
| | | // Control.Ins.SendWriteCommand(function, d);
|
| | | // })
|
| | | // { IsBackground = true }.Start();
|
| | | // }
|
| | | //}
|
| | |
|
| | |
|
| | | btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(222 - 16) / 100) + Application.GetRealWidth(80);
|
| | |
| | | public partial class DimmerPage |
| | | { |
| | | /// <summary> |
| | | /// 通知更新界面的时间 |
| | | /// </summary> |
| | | DateTime notiyUpdateTime = DateTime.MinValue; |
| | | System.Threading.Thread updateUiThread; |
| | | object lockObj = new object(); |
| | | |
| | | /// <summary> |
| | | /// 更新功能状态 |
| | | /// </summary> |
| | | public static void UpdataStates(Function updataTemp) |
| | | { |
| | | Application.RunOnMainThread((() => |
| | | if (bodyView == null) |
| | | { |
| | | return; |
| | | } |
| | | lock (bodyView.lockObj) |
| | | { |
| | | MainPage.Log($"收到更新" + DateTime.Now.Ticks); |
| | | bodyView.notiyUpdateTime = DateTime.Now; |
| | | if (bodyView.updateUiThread == null) |
| | | { |
| | | bodyView.updateUiThread = new System.Threading.Thread(() => |
| | | { |
| | | while (true) |
| | | { |
| | | System.Threading.Thread.Sleep(1500); |
| | | if (bodyView == null) |
| | | { |
| | | return; |
| | | } |
| | | if (DateTime.Now.AddMilliseconds(-1500) > bodyView.notiyUpdateTime) |
| | | { |
| | | MainPage.Log("没有新数据,更新UI"); |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | MainPage.Log("有新数据,继续等待"); |
| | | } |
| | | } |
| | | |
| | | Application.RunOnMainThread(() =>{ |
| | | try |
| | | { |
| | | if (bodyView == null) |
| | |
| | | { |
| | | MainPage.Log($"{bodyView.GetType().Name } UpdataStates error : {ex.Message}"); |
| | | } |
| | | })); |
| | | finally |
| | | { |
| | | bodyView.updateUiThread = null; |
| | | } |
| | | }); |
| | | |
| | | |
| | | bodyView.updateUiThread.IsBackground = true; |
| | | bodyView.updateUiThread.Start(); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | void LoadEventList() |
| | |
| | | //20201223 删除滑动发送命令,防止控件跳动 |
| | | dimmerBar.OnProgressChangedEvent = (sender, e) => |
| | | { |
| | | |
| | | if (!btnSwitch.IsSelected) |
| | | { |
| | | dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1); |
| | |
| | | d.Add(FunctionAttributeKey.Brightness, e.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | } |
| | | else |
| | | { |
| | | if (350 < (DateTime.Now - function.refreshTime).TotalMilliseconds) |
| | | { |
| | | function.refreshTime = DateTime.Now; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Collections.Generic.Dictionary<string, string> dic = new System.Collections.Generic.Dictionary<string, string>(); |
| | | dic.Add(FunctionAttributeKey.Brightness, e.ToString()); |
| | | Control.Ins.SendWriteCommand(function, dic); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | } |
| | | //else |
| | | //{ |
| | | // if (350 < (DateTime.Now - function.refreshTime).TotalMilliseconds) |
| | | // { |
| | | // function.refreshTime = DateTime.Now; |
| | | // new System.Threading.Thread(() => |
| | | // { |
| | | // System.Collections.Generic.Dictionary<string, string> dic = new System.Collections.Generic.Dictionary<string, string>(); |
| | | // dic.Add(FunctionAttributeKey.Brightness, e.ToString()); |
| | | // Control.Ins.SendWriteCommand(function, dic); |
| | | // }) |
| | | // { IsBackground = true }.Start(); |
| | | // } |
| | | //} |
| | | btnBrightnessText.Y = ((100 - dimmerBar.Progress) * Application.GetRealHeight(288 - 16 - 16) / 100) + Application.GetRealWidth(40); |
| | | btnBrightnessText.Text = dimmerBar.Progress + "%"; |
| | | }; |
| | |
| | | |
| | | dimmerBar.OnProgressChangedEvent = (sender, e) => |
| | | { |
| | | return; |
| | | if (e == 0 && lastBrightness != 0) |
| | | { |
| | | lastBrightness = 0; |
| | |
| | | |
| | | dimmerBar.OnProgressChangedEvent = (sender, e) => |
| | | { |
| | | return; |
| | | if (e == 0 && lastBrightness != 0) |
| | | { |
| | | lastBrightness = 0; |
| | |
| | | |
| | | dimmerBar.OnProgressChangedEvent = (sender, e) => |
| | | { |
| | | return; |
| | | if (e == 0 && lastBrightness != 0) |
| | | { |
| | | lastBrightness = 0; |
| | |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(function, actionRefresh); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | DriverLayer.Control.Ins.SendReadCommand(function); |
| | | Control.Ins.SendReadCommand(function); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | new System.Threading.Thread(() => { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | while (true) |
| | | { |
| | | System.Threading.Thread.Sleep(1000); |
| | |
| | | } |
| | | else |
| | | { |
| | | DriverLayer.Control.Ins.SendReadCommand(function); |
| | | System.Threading.Thread.Sleep(1000); |
| | | Control.Ins.SendReadCommand(function); |
| | | curDimmerStatus = true; |
| | | } |
| | | } |
| | |
| | | public partial class RGBPage |
| | | { |
| | | /// <summary> |
| | | /// 通知更新界面的时间 |
| | | /// </summary> |
| | | DateTime notiyUpdateTime = DateTime.MinValue; |
| | | System.Threading.Thread updateUiThread; |
| | | object lockObj = new object(); |
| | | |
| | | public override void RemoveFromParent() |
| | | { |
| | | bodyView = null; |
| | | base.RemoveFromParent(); |
| | | } |
| | | /// <summary> |
| | | /// 更新功能状态 |
| | | /// </summary> |
| | | public static void UpdataStates(Function updateTemp) |
| | | { |
| | | if(bodyView == null) |
| | | { |
| | | return; |
| | | } |
| | | lock (bodyView.lockObj) |
| | | { |
| | | MainPage.Log($"收到更新"+ DateTime.Now.Ticks); |
| | | bodyView.notiyUpdateTime = DateTime.Now; |
| | | if (bodyView.updateUiThread == null) |
| | | { |
| | | bodyView.updateUiThread = new System.Threading.Thread(() => |
| | | { |
| | | while (true) |
| | | { |
| | | System.Threading.Thread.Sleep(1500); |
| | | if(bodyView == null) |
| | | { |
| | | return; |
| | | } |
| | | if (DateTime.Now.AddMilliseconds(-1500) > bodyView.notiyUpdateTime) |
| | | { |
| | | MainPage.Log("没有新数据,更新UI"); |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | MainPage.Log("有新数据,继续等待"); |
| | | } |
| | | } |
| | | |
| | | Application.RunOnMainThread((() => |
| | | { |
| | | try |
| | |
| | | bodyView.btnColorfulSwitch.IsSelected = colorfulState.curValue.ToString() == "on"; |
| | | } |
| | | } |
| | | }catch(Exception ex) |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"更新RGB 炫彩开关状态异常:{ex.Message}"); |
| | | } |
| | |
| | | { |
| | | MainPage.Log($"{bodyView.GetType().Name } UpdataStates error : {ex.Message}"); |
| | | } |
| | | finally |
| | | { |
| | | bodyView.updateUiThread = null; |
| | | } |
| | | })); |
| | | |
| | | }); |
| | | bodyView.updateUiThread.IsBackground = true; |
| | | bodyView.updateUiThread.Start(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | d.Add(FunctionAttributeKey.Brightness, e.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | } |
| | | else |
| | | { |
| | | if (350 < (DateTime.Now - function.refreshTime).TotalMilliseconds) |
| | | { |
| | | function.refreshTime = DateTime.Now; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | //Control.Send(CommandType_A.write, function); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Brightness, e.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | else |
| | | { |
| | | MainPage.Log("skip dimmer control!!"); |
| | | } |
| | | } |
| | | //else |
| | | //{ |
| | | // if (350 < (DateTime.Now - function.refreshTime).TotalMilliseconds) |
| | | // { |
| | | // function.refreshTime = DateTime.Now; |
| | | // new System.Threading.Thread(() => |
| | | // { |
| | | // //Control.Send(CommandType_A.write, function); |
| | | // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | // d.Add(FunctionAttributeKey.Brightness, e.ToString()); |
| | | // Control.Ins.SendWriteCommand(function, d); |
| | | // }) |
| | | // { IsBackground = true }.Start(); |
| | | // } |
| | | // else |
| | | // { |
| | | // MainPage.Log("skip dimmer control!!"); |
| | | // } |
| | | //} |
| | | }; |
| | | } |
| | | } |
| | |
| | | public partial class RGBWPage |
| | | { |
| | | /// <summary> |
| | | /// 通知更新界面的时间 |
| | | /// </summary> |
| | | DateTime notiyUpdateTime = DateTime.MinValue; |
| | | System.Threading.Thread updateUiThread; |
| | | object lockObj = new object(); |
| | | /// <summary> |
| | | /// 更新功能状态 |
| | | /// </summary> |
| | | public static void UpdataStates(Function updateTemp) |
| | | { |
| | | Application.RunOnMainThread((() => |
| | | if (bodyView == null) |
| | | { |
| | | return; |
| | | } |
| | | lock (bodyView.lockObj) |
| | | { |
| | | MainPage.Log($"收到更新" + DateTime.Now.Ticks); |
| | | bodyView.notiyUpdateTime = DateTime.Now; |
| | | if (bodyView.updateUiThread == null) |
| | | { |
| | | bodyView.updateUiThread = new System.Threading.Thread(() => |
| | | { |
| | | while (true) |
| | | { |
| | | System.Threading.Thread.Sleep(1500); |
| | | if (bodyView == null) |
| | | { |
| | | return; |
| | | } |
| | | if (DateTime.Now.AddMilliseconds(-1500) > bodyView.notiyUpdateTime) |
| | | { |
| | | MainPage.Log("没有新数据,更新UI"); |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | MainPage.Log("有新数据,继续等待"); |
| | | } |
| | | } |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | | { |
| | |
| | | { |
| | | MainPage.Log($"{bodyView.GetType().Name } UpdataStates error : {ex.Message}"); |
| | | } |
| | | })); |
| | | finally |
| | | { |
| | | bodyView.updateUiThread = null; |
| | | } |
| | | }); |
| | | |
| | | |
| | | bodyView.updateUiThread.IsBackground = true; |
| | | bodyView.updateUiThread.Start(); |
| | | }); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | d.Add(FunctionAttributeKey.Brightness, e.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | } |
| | | else |
| | | { |
| | | if (350 < (DateTime.Now - function.refreshTime).TotalMilliseconds) |
| | | { |
| | | function.refreshTime = DateTime.Now; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | //Control.Send(CommandType_A.write, function); |
| | | System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | d.Add(FunctionAttributeKey.Brightness, e.ToString()); |
| | | Control.Ins.SendWriteCommand(function, d); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | else |
| | | { |
| | | MainPage.Log("skip dimmer control!!"); |
| | | } |
| | | } |
| | | //else |
| | | //{ |
| | | // if (350 < (DateTime.Now - function.refreshTime).TotalMilliseconds) |
| | | // { |
| | | // function.refreshTime = DateTime.Now; |
| | | // new System.Threading.Thread(() => |
| | | // { |
| | | // //Control.Send(CommandType_A.write, function); |
| | | // System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>(); |
| | | // d.Add(FunctionAttributeKey.Brightness, e.ToString()); |
| | | // Control.Ins.SendWriteCommand(function, d); |
| | | // }) |
| | | // { IsBackground = true }.Start(); |
| | | // } |
| | | // else |
| | | // { |
| | | // MainPage.Log("skip dimmer control!!"); |
| | | // } |
| | | //} |
| | | }; |
| | | } |
| | | } |