2020-02-24 1.优化更新。
2020-02-24
1.远程模式时,增加网络切换、切换住宅时的重连操作。
2.增加场景个数统计按钮的刷新。
3.修复网关搜索页面,重复弹窗问题。
4.网关配置页面优化。
| | |
| | | <Properties StartupConfiguration="{1D83BF28-BA88-4152-BA41-D7EFE90A5437}|Default"> |
| | | <MonoDevelop.Ide.ItemProperties.ON.Droid PreferredExecutionTarget="Android.Android_Accelerated_Oreo" /> |
| | | <MonoDevelop.Ide.Workbench ActiveDocument="SmartHome/UI/SimpleControl/Phone/Light/UserDeviceToLight.cs"> |
| | | <MonoDevelop.Ide.Workbench ActiveDocument="SmartHome/HDL/Operation/BusSocket.cs"> |
| | | <Files> |
| | | <File FileName="ON.Ios/Resources/Language.ini" Line="261" Column="4" IsPinned="True" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/R.cs" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/Light/UserDeviceToLight.cs" Line="693" Column="65" /> |
| | | <File FileName="SmartHome/HDL/Operation/ResponseEntity/ErrorCode.cs" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/User/UserMiddle.cs" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/Alexa/AlexaDeviceListPage.cs" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/MainPage.cs" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs" /> |
| | | <File FileName="SmartHome/HDL/Operation/Control.cs" Line="317" Column="33" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/EquipmentPublicClass.cs" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/Guide/GuideAddGateway.cs" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/System/SystemMiddle.cs" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/System/SystemWirelessGateway.cs" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/AC/UserDeviceToAC.cs" Line="365" Column="65" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/Register/AccountLogin.cs" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/MqttCommon.cs" Line="504" Column="1" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/Curtain/UserDeviceToCurtains.cs" Line="526" Column="26" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/Fan/UserDeviceToFan.cs" Line="325" Column="30" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/Light/UserDeviceToSocket.cs" Line="426" Column="59" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/Scene/SceneMethod.cs" Line="472" Column="40" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/Light/UserLightPage.cs" Line="379" Column="25" /> |
| | | <File FileName="SmartHome/HDL/Operation/BusSocket.cs" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/User/UserSettingView.cs" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/Register/AccountView.cs" Line="1" Column="1" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/Register/Databackup.cs" Line="1" Column="1" /> |
| | | <File FileName="ON.Ios/Info.plist" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/Light/SendControl.cs" Line="1" Column="1" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/Room/UserRoom.cs" Line="1880" Column="71" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/Phone/User/UserDeviceView.cs" Line="253" Column="21" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/EquipmentPublicClass.cs" Line="95" Column="1" /> |
| | | <File FileName="SmartHome/UI/SimpleControl/MainPage.cs" Line="1" Column="1" /> |
| | | <File FileName="SmartHome/HDL/Operation/BusSocket.cs" Line="1" Column="1" /> |
| | | </Files> |
| | | <Pads> |
| | | <Pad Id="ProjectPad"> |
| | | <State name="__root__"> |
| | | <Node name="SmartHome" expanded="True"> |
| | | <Node name="ON.Droid" expanded="True"> |
| | | <Node name="Properties" expanded="True" /> |
| | | </Node> |
| | | <Node name="ON.Ios" expanded="True" /> |
| | | <Node name="Shared" expanded="True"> |
| | | <Node name="HDL" expanded="True"> |
| | | <Node name="Operation" expanded="True" /> |
| | | <Node name="Operation" expanded="True"> |
| | | <Node name="BusSocket.cs" selected="True" /> |
| | | </Node> |
| | | </Node> |
| | | <Node name="UI" expanded="True"> |
| | | <Node name="SimpleControl" expanded="True"> |
| | |
| | | <Node name="AC" expanded="True" /> |
| | | <Node name="Curtain" expanded="True" /> |
| | | <Node name="Fan" expanded="True" /> |
| | | <Node name="Light" expanded="True"> |
| | | <Node name="UserDeviceToLight.cs" selected="True" /> |
| | | </Node> |
| | | <Node name="FresAir" expanded="True" /> |
| | | <Node name="Guide" expanded="True" /> |
| | | <Node name="Light" expanded="True" /> |
| | | <Node name="Register" expanded="True" /> |
| | | <Node name="Room" expanded="True" /> |
| | | <Node name="Scene" expanded="True" /> |
| | |
| | | } |
| | | Shared.Application.RunOnMainThread (() => { |
| | | Shared.BusSocket.Start (6000); |
| | | Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote ((int)Reachability.InternetConnectionStatus ()); |
| | | Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote ((int)Reachability.InternetConnectionStatus (),false); |
| | | //RemoteInfo.Current.ReadMsgList (NSUserDefaults.StandardUserDefaults.StringForKey ("PushDeviceToken"), true); |
| | | if (SmartHome.WiFiSet.refreshView != null) { |
| | | SmartHome.WiFiSet.refreshView (); |
| | |
| | | return; |
| | | } |
| | | Shared.BusSocket.Start (6000); |
| | | Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote ((int)Reachability.InternetConnectionStatus ()); |
| | | Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote ((int)Reachability.InternetConnectionStatus (), false); |
| | | if (SmartHome.WiFiSet.refreshView != null) { |
| | | SmartHome.WiFiSet.refreshView (); |
| | | } |
| | |
| | | } |
| | | } |
| | | Console.WriteLine (""); |
| | | Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote (internetStatus); |
| | | Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote (internetStatus,false); |
| | | } |
| | | |
| | | bool isNetworkAvailable (Context context) |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtree" android:versionName="2.50217" android:versionCode="20200217"> |
| | | <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.hdl.crabtree" android:versionName="2.50221" android:versionCode="20200221"> |
| | | <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="26" /> |
| | | <!-- Required 一些系统要求的权限,此处是极光推送需求的权限,如访问网络等--> |
| | | <permission android:name="com.hdl.on.permission.JPUSH_MESSAGE" android:protectionLevel="signature" /> |
| | |
| | | } |
| | | tempPacket.FlagDateTime = System.DateTime.Now; |
| | | tempPacket.HaveSendCount++; |
| | | |
| | | byte [] messageSend; |
| | | //2020-01-14 增加本地通讯加密 |
| | | if (UserConfig.Instance.IsLocalEncrypt) { |
| | | var messageSend = Shared.Securitys.EncryptionService.AesEncryptPayload (tempPacket.Bytes, UserConfig.Instance.LocalEncryptKey); |
| | | tempPacket.Bytes = messageSend; |
| | | messageSend = Shared.Securitys.EncryptionService.AesEncryptPayload (tempPacket.Bytes, UserConfig.Instance.LocalEncryptKey); |
| | | } else { |
| | | messageSend = tempPacket.Bytes; |
| | | } |
| | | |
| | | busSocket.BeginSendTo(tempPacket.Bytes, 0, tempPacket.Bytes.Length, SocketFlags.None, tempPacket.RemoteEndPoint, new AsyncCallback(asyncEndSend), tempPacket); |
| | | busSocket.BeginSendTo(messageSend, 0, messageSend.Length, SocketFlags.None, tempPacket.RemoteEndPoint, new AsyncCallback(asyncEndSend), tempPacket); |
| | | } |
| | | catch { |
| | | |
| | |
| | | /// <summary> |
| | | /// 检测/连接远程 |
| | | /// </summary> |
| | | public static void CheckLinkRemote (int status) |
| | | public static void CheckLinkRemote (int status, bool IsReconnectRemote = true) |
| | | { |
| | | //if (isConnectiong) { |
| | | // return; |
| | |
| | | obj.Split ('_') [1].ToString () == DeviceType.OnePortMqttFR.ToString ()); |
| | | }); |
| | | bool canRemote = false; |
| | | if (CommonPage.IsRemote) { |
| | | //await SmartHome.MqttCommon.StartCloudMqtt (); |
| | | SmartHome.MqttCommon.MqttRemoteSend (new byte [] { }, 3); |
| | | } |
| | | |
| | | if (gateWayList == null || gateWayList.Count == 0) { |
| | | Utlis.ShowAppLinkStatus (AppLinkStatus.WiFiOffline); |
| | | await DisConnectRemoteAsync (); |
| | | } |
| | | |
| | | |
| | | if (IsReconnectRemote) { |
| | | if (CommonPage.IsRemote) { |
| | | CommonPage.IsRemote = false; |
| | | Utlis.ShowAppLinkStatus (AppLinkStatus.WiFiOffline); |
| | | await SmartHome.MqttCommon.DisConnectRemoteMqttClient (); |
| | | } |
| | | } |
| | | |
| | | if (CommonPage.IsRemote) { |
| | | //await SmartHome.MqttCommon.StartCloudMqtt (); |
| | | SmartHome.MqttCommon.MqttRemoteSend (new byte [] { }, 3); |
| | | } |
| | | |
| | | //本地是否存在与当前住宅绑定网关的数据 |
| | | bool HomeGatewaysExistsLocally = false; |
| | | foreach (var gatewayFileName in gateWayList) { |
| | |
| | | |
| | | //public static Button LogoButton = new Button (); |
| | | |
| | | public static string RequestVersion = "20200217"; |
| | | public static string RequestVersion = "20200221"; |
| | | public static UserInfo LoginUser; |
| | | /// <summary> |
| | | /// 是否是管理员权限(变更了,成员的时候,这个也为ture。为什么会声明这样变量,因为有些接口必须使用原来的Token) |
| | |
| | | |
| | | |
| | | static bool inThisView = false; |
| | | Alert checkInternetAlert = new Alert ("", "Your phone in not connected to WIFI network, please connet", "Close", "Search again"); |
| | | Alert confirmAlert = new Alert ("", "Please make sure gateway is powered up and comect to WiFi router.", "Close", "Search again"); |
| | | Alert confirmAlert1 = new Alert ("", "If not all the gateways are in the list,you can search again.", "Close", "Search again"); |
| | | Alert wrongPasswordAlert = new Alert ("", ErrorCode.GatewayPasswordError, "Close", "Search again"); |
| | | //Alert checkInternetAlert = new Alert ("", "Your phone in not connected to WIFI network, please connet", "Close", "Search again"); |
| | | //Alert confirmAlert = new Alert ("", "Please make sure gateway is powered up and comect to WiFi router.", "Close", "Search again"); |
| | | //Alert confirmAlert1 = new Alert ("", "If not all the gateways are in the list,you can search again.", "Close", "Search again"); |
| | | //Alert wrongPasswordAlert = new Alert ("", ErrorCode.GatewayPasswordError, "Close", "Search again"); |
| | | |
| | | void SearchGatewayList () |
| | | { |
| | | if (UserConfig.Instance.internetStatus == 0 || UserConfig.Instance.internetStatus == 1) { |
| | | Alert checkInternetAlert = new Alert ("", "Your phone in not connected to WIFI network, please connet", "Close", "Search again"); |
| | | |
| | | checkInternetAlert.Show (); |
| | | |
| | | checkInternetAlert.ResultEventHandler += (dsss, eee) => { |
| | |
| | | } else { |
| | | if (this != null && this.Parent != null) { |
| | | if (inThisView) {// this.Parent.GetChildren (this.Parent.ChildrenCount - 1) == this) { |
| | | Alert confirmAlert1 = new Alert ("", "If not all the gateways are in the list,you can search again.", "Close", "Search again"); |
| | | |
| | | confirmAlert1.Show (); |
| | | confirmAlert1.ResultEventHandler += (ddf, ddd) => { |
| | | MainPage.Loading.Hide (); |
| | |
| | | if (UserConfig.Instance.IsLocalEncrypt) { |
| | | //密码检验正确 |
| | | if (UserConfig.Instance.EncryptedPasswordCorrect) { |
| | | |
| | | inView.confirmAlert.Show (); |
| | | inView.confirmAlert.ResultEventHandler += (ddf, ddd) => { |
| | | Alert confirmAlert = new Alert ("", "Please make sure gateway is powered up and comect to WiFi router.", "Close", "Search again"); |
| | | confirmAlert.Show (); |
| | | confirmAlert.ResultEventHandler += (ddf, ddd) => { |
| | | MainPage.Loading.Hide (); |
| | | if (ddd) { |
| | | inView.SearchGatewayList (); |
| | | } |
| | | }; |
| | | } else { |
| | | |
| | | |
| | | inView.wrongPasswordAlert.Show (); |
| | | inView.wrongPasswordAlert.ResultEventHandler += (ddf, ddd) => { |
| | | Alert wrongPasswordAlert = new Alert ("", ErrorCode.GatewayPasswordError, "Close", "Search again"); |
| | | wrongPasswordAlert.Show (); |
| | | wrongPasswordAlert.ResultEventHandler += (ddf, ddd) => { |
| | | MainPage.Loading.Hide (); |
| | | if (ddd) { |
| | | inView.SearchGatewayList (); |
| | |
| | | |
| | | } |
| | | } else { |
| | | inView.confirmAlert.Show (); |
| | | inView.confirmAlert.ResultEventHandler += (ddf, ddd) => { |
| | | Alert confirmAlert = new Alert ("", "Please make sure gateway is powered up and comect to WiFi router.", "Close", "Search again"); |
| | | confirmAlert.Show (); |
| | | confirmAlert.ResultEventHandler += (ddf, ddd) => { |
| | | MainPage.Loading.Hide (); |
| | | if (ddd) { |
| | | inView.SearchGatewayList (); |
| | |
| | | //创建住宅成功,切换到该住宅 |
| | | var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<RegionInfoRes>> (revertObj21.ResponseData.ToString ()); |
| | | if (responseDataObj != null && responseDataObj.Count > 0) { |
| | | ChangeRegion (responseDataObj [0], false, true, goToGuideAddGatewayView); |
| | | ChangeRegion (responseDataObj [0], true, true, goToGuideAddGatewayView); |
| | | |
| | | } |
| | | } else { |
| | |
| | | System.Threading.Tasks.Task.Run (() => { |
| | | try { |
| | | |
| | | //读取一端口交换机、无线网关的配置信息 |
| | | gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, new byte [] { }); |
| | | |
| | | gatewayDeicve.Remote_GroupName = MainPage.LoginUser.AccountString;//UserConfig.Instance.CurrentRegion.RegionName; |
| | | gatewayDeicve.Remote_ProjectName = gatewayDeicve.MAC.Replace (".", "");//UserConfig.Instance.CurrentRegion.RegionName; |
| | | gatewayDeicve.Remote_UserName = "Admin"; |
| | | gatewayDeicve.Remote_Password = "c" + MainPage.LoginUser.ID; |
| | | //gatewayDeicve.Remote_Password = "85521566"; |
| | | byte [] ggn = new byte [20]; |
| | | byte [] b1 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_GroupName); |
| | | gatewayDeicve.Remote_GroupName = CommonPage.MyEncodingGB2312.GetString (b1); |
| | | Array.Copy (b1, 0, ggn, 0, 20 < b1.Length ? 20 : b1.Length); |
| | | |
| | | byte [] gpn = new byte [20]; |
| | | byte [] b2 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_ProjectName); |
| | | Array.Copy (b2, 0, gpn, 0, 20 < b2.Length ? 20 : b2.Length); |
| | | |
| | | byte [] gun = new byte [8]; |
| | | byte [] b3 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_UserName); |
| | | Array.Copy (b3, 0, gun, 0, 8 < b3.Length ? 8 : b3.Length); |
| | | |
| | | byte [] gpw = new byte [8]; |
| | | byte [] b4 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_Password); |
| | | Array.Copy (b4, 0, gpw, 0, 8 < b4.Length ? 8 : b4.Length); |
| | | |
| | | |
| | | gatewayBytes [0] = TYPEHdlMQTT;//HDL MQTT |
| | | Array.Copy (ggn, 0, gatewayBytes, 1, 20); |
| | | Array.Copy (gpn, 0, gatewayBytes, 21, 20); |
| | | Array.Copy (gun, 0, gatewayBytes, 41, 8); |
| | | Array.Copy (gpw, 0, gatewayBytes, 49, 8); |
| | | //1.修改用户名信息 |
| | | Control.ControlBytesSend (Command.SetGateWayModelInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, gatewayBytes); |
| | | ////2.读取一次管理信息 |
| | | //byte [] adminBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayAdminInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, new byte [] { }); |
| | | ////3.修改管理信息 |
| | | //if (SetGateWayAdminInfo (adminBytes)) { |
| | | // //4.写配置成功后下一步操作 |
| | | // GatewaySettingSucceeded (); |
| | | ////读取一端口交换机、无线网关的配置信息 |
| | | //gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, new byte [] { }); |
| | | //if (gatewayBytes == null) { |
| | | // //读取一端口交换机、无线网关的配置信息失败 |
| | | // new Alert ("", "Read gateway configuration failed!", "Close").Show (); |
| | | // return; |
| | | //} |
| | | |
| | | //2.修改管理信息 |
| | | if (SetGateWayAdminInfo ()) { |
| | | //3.写配置成功后下一步操作 |
| | | GatewaySettingSucceeded (); |
| | | |
| | | //1.修改用户名信息 和修改连接模式 |
| | | if (SetGateWayModelInfo()) { |
| | | //2.修改管理信息 |
| | | if (SetGateWayAdminInfo ()) { |
| | | //3.写配置成功后下一步操作 |
| | | GatewaySettingSucceeded (); |
| | | } |
| | | } |
| | | |
| | | } catch (Exception ex) { |
| | |
| | | } |
| | | }); |
| | | //Room.InitAllRoom (); |
| | | } |
| | | |
| | | bool SetGateWayModelInfo () { |
| | | byte [] gatewayBytes = new byte [60]; |
| | | gatewayDeicve.Remote_GroupName = MainPage.LoginUser.AccountString;//UserConfig.Instance.CurrentRegion.RegionName; |
| | | gatewayDeicve.Remote_ProjectName = gatewayDeicve.MAC.Replace (".", "");//UserConfig.Instance.CurrentRegion.RegionName; |
| | | gatewayDeicve.Remote_UserName = "Admin"; |
| | | gatewayDeicve.Remote_Password = "c" + MainPage.LoginUser.ID; |
| | | //gatewayDeicve.Remote_Password = "85521566"; |
| | | byte [] ggn = new byte [20]; |
| | | byte [] b1 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_GroupName); |
| | | gatewayDeicve.Remote_GroupName = CommonPage.MyEncodingGB2312.GetString (b1); |
| | | Array.Copy (b1, 0, ggn, 0, 20 < b1.Length ? 20 : b1.Length); |
| | | |
| | | byte [] gpn = new byte [20]; |
| | | byte [] b2 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_ProjectName); |
| | | Array.Copy (b2, 0, gpn, 0, 20 < b2.Length ? 20 : b2.Length); |
| | | |
| | | byte [] gun = new byte [8]; |
| | | byte [] b3 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_UserName); |
| | | Array.Copy (b3, 0, gun, 0, 8 < b3.Length ? 8 : b3.Length); |
| | | |
| | | byte [] gpw = new byte [8]; |
| | | byte [] b4 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDeicve.Remote_Password); |
| | | Array.Copy (b4, 0, gpw, 0, 8 < b4.Length ? 8 : b4.Length); |
| | | |
| | | |
| | | gatewayBytes [0] = TYPEHdlMQTT;//HDL MQTT |
| | | Array.Copy (ggn, 0, gatewayBytes, 1, 20); |
| | | Array.Copy (gpn, 0, gatewayBytes, 21, 20); |
| | | Array.Copy (gun, 0, gatewayBytes, 41, 8); |
| | | Array.Copy (gpw, 0, gatewayBytes, 49, 8); |
| | | byte [] backBytes = Control.ControlBytesSendHasReturn (Command.SetGateWayModelInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, gatewayBytes); |
| | | return CheckIsSuccessfulWithBytes (backBytes, "Failed to modify gateway connection mode."); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | MainPage.LoginUser.LastTime = DateTime.Now; |
| | | Application.RunOnMainThread (() => { |
| | | bodyView.RemoveAll (); |
| | | //MainPage.WiFiStatus = "CrabtreeAdd/WiFi.png"; |
| | | UserMiddle.Init (true); |
| | | MainPage.WiFiStatus = "CrabtreeAdd/WiFi.png"; |
| | | UserMiddle.btnLinkStatus.UnSelectedImagePath = MainPage.WiFiStatus; |
| | | }); |
| | | |
| | | //Utlis.ShowAppLinkStatus (AppLinkStatus.WiFi); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | filesList = IO.FileUtils.ReadFiles ().FindAll ((obj) => { return obj.Split ('_').Length == 5; }); |
| | | } |
| | | |
| | | |
| | | public void ShowScene (Action<string> action) |
| | | { |
| | | this.BackgroundColor = SkinStyle.Current.MainColor; |
| | |
| | | curView = this; |
| | | } |
| | | |
| | | public override void RemoveFromParent () |
| | | { |
| | | curView = null; |
| | | UserDeviceView.UpdataScenesCountNumber (); |
| | | base.RemoveFromParent (); |
| | | |
| | | } |
| | | |
| | | public static bool hasModify = false; |
| | | public static void Refresh () |
| | | { |
| | |
| | | InitView (UserConfig.Instance.SceneOfGloba); |
| | | } |
| | | |
| | | void InitView (bool isGolba) |
| | | public void InitView (bool isGolba) |
| | | { |
| | | bodyScrolView.RemoveAll (); |
| | | if (isGolba) { |
| | |
| | | roomView.AddChidren (btnNumber); |
| | | |
| | | btnRoomName.MouseUpEventHandler += (sender, e) => { |
| | | var userScenePage = new UserScenePage (); |
| | | var userScenePage = new UserScenePage (this); |
| | | UserMiddle.DevicePageView.AddChidren (userScenePage); |
| | | userScenePage.ShowUserScene (room); |
| | | UserMiddle.DevicePageView.PageIndex = 2; |
| | |
| | | /// <summary> |
| | | ///构造函数 |
| | | /// </summary> |
| | | public UserScenePage () |
| | | public UserScenePage (UserDeviceToScene mView) |
| | | { |
| | | mUserDeviceToScene = mView; |
| | | BackgroundColor = SkinStyle.Current.MainColor; |
| | | } |
| | | |
| | | UserDeviceToScene mUserDeviceToScene; |
| | | public override void RemoveFromParent () |
| | | { |
| | | mUserDeviceToScene.InitView (UserConfig.Instance.SceneOfGloba); |
| | | base.RemoveFromParent (); |
| | | |
| | | } |
| | | |
| | | public void ShowUserScene (Room room) |
| | | { |
| | | #region 标题 |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | public static void UpdataScenesCountNumber () |
| | | { |
| | | try { |
| | | Application.RunOnMainThread (() => { |
| | | for (int i = 0; i < UserMiddle.DeviceView.ChildrenCount; i++) { |
| | | if (UserMiddle.DeviceView.GetChildren (i).GetType () == typeof (FrameLayout)) { |
| | | FrameLayout rowView = (FrameLayout)UserMiddle.DeviceView.GetChildren (i); |
| | | for (int j = 0; j < rowView.ChildrenCount; j++) { |
| | | if (rowView.GetChildren (j).GetType () == typeof (FrameLayout)) { |
| | | FrameLayout frameView = (FrameLayout)rowView.GetChildren (j); |
| | | if (frameView.GetTagByKey ("DeviceType").ToString () == Shared.Language.StringByID (R.MyInternationalizationString.Scenes)) { |
| | | for (int k = 0; k < frameView.ChildrenCount; k++) { |
| | | if (frameView.GetChildren (k).GetType () == typeof (Button)) { |
| | | Button btn = (Button)frameView.GetChildren (k); |
| | | if (btn.GetTagByKey ("DeviceType") != null && btn.GetTagByKey ("DeviceType").ToString () == Shared.Language.StringByID (R.MyInternationalizationString.Scenes)) { |
| | | |
| | | //int eCount = 0; |
| | | btn.IsSelected = false; |
| | | CheckAndSetScenesCount (btn); |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } catch { |
| | | } |
| | | } |
| | | |
| | | static void CheckAndSetScenesCount (Button mButton) { |
| | | int eCount = 0; |
| | | System.Threading.Tasks.Task.Run (() => { |
| | | foreach (var room in Room.Lists) { |
| | | if (string.IsNullOrEmpty (room.Name)) { |
| | | continue; |
| | | } |
| | | if (room != null) { |
| | | foreach (var sceneFilePath in room.SceneFilePathList) { |
| | | var scene = Scene.GetSceneByFilePath (sceneFilePath); |
| | | if (scene != null) |
| | | eCount += scene.LoopCount; |
| | | } |
| | | } |
| | | } |
| | | var globalSceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<string>> (CommonPage.MyEncodingUTF8.GetString (IO.FileUtils.ReadFile (Scene.GlobalSceneFilePath))); |
| | | if (globalSceneList != null) { |
| | | foreach (var sceneFilePath in globalSceneList) { |
| | | var scene = Scene.GetSceneByFilePath (sceneFilePath); |
| | | if (scene == null) |
| | | continue; |
| | | eCount += scene.LoopCount; |
| | | } |
| | | } |
| | | |
| | | |
| | | Application.RunOnMainThread (() => { |
| | | mButton.Text = eCount.ToString (); |
| | | }); |
| | | }); |
| | | } |
| | | //static void DelUserEquipmentView (int deviceCount, int deviceType) |
| | | //{ |
| | | // if (deviceCount == 0) { |