JLChen
2020-02-24 ac39680a5ace5c02c63369014993fbfc959dbe5f
2020-02-24 1.优化更新。

2020-02-24
1.远程模式时,增加网络切换、切换住宅时的重连操作。
2.增加场景个数统计按钮的刷新。
3.修复网关搜索页面,重复弹窗问题。
4.网关配置页面优化。
2个文件已添加
16个文件已修改
6191 ■■■■ 已修改文件
Crabtree/.vs/SmartHome/xs/UserPrefs.xml 47 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-shm 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-wal 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/ON.Ios/AppDelegate.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/ON/Application.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/ON/Properties/AndroidManifest.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/ON/Resources/Resource.designer.cs 5907 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/HDL/Operation/BusSocket.cs 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/UI/SimpleControl/MainPage.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddGateway.cs 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddResidence.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs 75 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/UI/SimpleControl/Phone/Scene/UserAddSceneDevice.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/UI/SimpleControl/Phone/Scene/UserDeviceToScene.cs 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/UI/SimpleControl/Phone/Scene/UserScenePage.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserDeviceView.cs 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Crabtree/.vs/SmartHome/xs/UserPrefs.xml
@@ -1,44 +1,25 @@
<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">
@@ -46,9 +27,9 @@
                    <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" />
Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide
Binary files differ
Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-shm
Binary files differ
Crabtree/.vs/SmartHome/xs/sqlite3/storage.ide-wal
Binary files differ
Crabtree/ON.Ios/AppDelegate.cs
@@ -231,7 +231,7 @@
                    }
                    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 ();
@@ -241,7 +241,7 @@
                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 ();
            }
Crabtree/ON/Application.cs
@@ -190,7 +190,7 @@
                }
            }
            Console.WriteLine ("");
            Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote (internetStatus);
            Shared.SimpleControl.EquipmentPublicClass.CheckLinkRemote (internetStatus,false);
        }
        bool isNetworkAvailable (Context context)
Crabtree/ON/Properties/AndroidManifest.xml
@@ -1,5 +1,5 @@
<?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" />
Crabtree/ON/Resources/Resource.designer.cs
Diff too large
Crabtree/SmartHome/HDL/Operation/BusSocket.cs
@@ -160,14 +160,15 @@
                }
                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 { 
            
Crabtree/SmartHome/UI/SimpleControl/EquipmentPublicClass.cs
@@ -21,7 +21,7 @@
        /// <summary>
        /// 检测/连接远程
        /// </summary>
        public static void CheckLinkRemote (int status)
        public static void CheckLinkRemote (int status, bool IsReconnectRemote = true)
        {
            //if (isConnectiong) {
            //    return;
@@ -65,14 +65,26 @@
                                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) {
Crabtree/SmartHome/UI/SimpleControl/MainPage.cs
@@ -39,7 +39,7 @@
        //public static Button LogoButton = new Button ();
        public static string RequestVersion = "20200217";
        public static string RequestVersion = "20200221";
        public static UserInfo LoginUser;
        /// <summary>
        /// 是否是管理员权限(变更了,成员的时候,这个也为ture。为什么会声明这样变量,因为有些接口必须使用原来的Token)
Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddGateway.cs
@@ -345,14 +345,16 @@
        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) => {
@@ -443,6 +445,8 @@
                        } 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 ();
@@ -468,19 +472,18 @@
            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 ();
@@ -489,8 +492,9 @@
                }
            } 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 ();
Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideAddResidence.cs
@@ -798,7 +798,7 @@
                    //创建住宅成功,切换到该住宅
                    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 {
Crabtree/SmartHome/UI/SimpleControl/Phone/Guide/GuideSettingGateway.cs
@@ -736,9 +736,42 @@
            System.Threading.Tasks.Task.Run (() => {
                try {
                    //读取一端口交换机、无线网关的配置信息
                    gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, new byte [] { });
                    ////读取一端口交换机、无线网关的配置信息
                    //gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, new byte [] { });
                    //if (gatewayBytes == null) {
                    //    //读取一端口交换机、无线网关的配置信息失败
                    //    new Alert ("", "Read gateway configuration failed!", "Close").Show ();
                    //    return;
                    //}
                    //1.修改用户名信息 和修改连接模式
                    if (SetGateWayModelInfo()) {
                        //2.修改管理信息
                        if (SetGateWayAdminInfo ()) {
                            //3.写配置成功后下一步操作
                            GatewaySettingSucceeded ();
                        }
                    }
                } catch (Exception ex) {
                    Console.WriteLine (ex.Message);
                    Application.RunOnMainThread (() => {
                        //修改网关连接模式失败
                        new Alert ("", "Failed to modify gateway connection mode!", Language.StringByID (R.MyInternationalizationString.Close)).Show ();
                    });
                    bool canRemove = false;
                } finally {
                    Application.RunOnMainThread (() => {
                        MainPage.Loading.Hide ();
                        //this.RemoveAll ();
                    });
                }
            });
            //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";
@@ -767,37 +800,8 @@
                    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 ();
                    //}
                    //2.修改管理信息
                    if (SetGateWayAdminInfo ()) {
                        //3.写配置成功后下一步操作
                        GatewaySettingSucceeded ();
                    }
                } catch (Exception ex) {
                    Console.WriteLine (ex.Message);
                    Application.RunOnMainThread (() => {
                        //修改网关连接模式失败
                        new Alert ("", "Failed to modify gateway connection mode!", Language.StringByID (R.MyInternationalizationString.Close)).Show ();
                    });
                    bool canRemove = false;
                } finally {
                    Application.RunOnMainThread (() => {
                        MainPage.Loading.Hide ();
                        //this.RemoveAll ();
                    });
                }
            });
            //Room.InitAllRoom ();
            byte [] backBytes = Control.ControlBytesSendHasReturn (Command.SetGateWayModelInfo, gatewayDeicve.SubnetID, gatewayDeicve.DeviceID, gatewayBytes);
            return CheckIsSuccessfulWithBytes (backBytes, "Failed to modify gateway connection mode.");
        }
        /// <summary>
@@ -964,9 +968,14 @@
            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);
        }
Crabtree/SmartHome/UI/SimpleControl/Phone/Scene/UserAddSceneDevice.cs
@@ -30,6 +30,7 @@
            filesList = IO.FileUtils.ReadFiles ().FindAll ((obj) => { return obj.Split ('_').Length == 5; });
        }
        public void ShowScene (Action<string> action)
        {
            this.BackgroundColor = SkinStyle.Current.MainColor;
Crabtree/SmartHome/UI/SimpleControl/Phone/Scene/UserDeviceToScene.cs
@@ -19,6 +19,14 @@
            curView = this;
        }
        public override void RemoveFromParent ()
        {
            curView = null;
            UserDeviceView.UpdataScenesCountNumber ();
            base.RemoveFromParent ();
        }
        public static bool hasModify = false;
        public static void Refresh ()
        {
@@ -137,7 +145,7 @@
            InitView (UserConfig.Instance.SceneOfGloba);
        }
        void InitView (bool isGolba)
        public void InitView (bool isGolba)
        {
            bodyScrolView.RemoveAll ();
            if (isGolba) {
@@ -341,7 +349,7 @@
                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;
Crabtree/SmartHome/UI/SimpleControl/Phone/Scene/UserScenePage.cs
@@ -16,11 +16,20 @@
        /// <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 标题
Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserDeviceView.cs
@@ -216,6 +216,71 @@
            }
        }
        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) {