From f60ce72c3c29c7d31a046795c88ec39a69e73d45 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期三, 06 一月 2021 17:33:54 +0800
Subject: [PATCH] 2021-01-06 1.替换新云端前期准备相关接口,和修改相关参数。

---
 Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserSettingView.cs |  186 ++++++++++++++++++++++++++-------------------
 1 files changed, 107 insertions(+), 79 deletions(-)

diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserSettingView.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserSettingView.cs
index 4a3177a..2c82573 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserSettingView.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/User/UserSettingView.cs
@@ -211,89 +211,91 @@
 
             #region ---鏁版嵁鎺ユ敹---
             //if (MainPage.LoginUser.AccountType == 2 || MainPage.LoginUser.AccountString == @"464027401@qq.com") {
-            //    var DataReceptionView = new FrameLayout () {
-            //        Width = Application.GetRealWidth (640),
-            //        Height = Application.GetRealHeight (100),
-            //        BackgroundColor = SkinStyle.Current.ViewColor
-            //    };
-            //    UserMiddle.SettingView.AddChidren (DataReceptionView);
-            //    var btnDataReceptionIcon = new Button () {
-            //        X = Application.GetRealWidth (30),
-            //        Gravity = Gravity.CenterVertical,
-            //        Width = Application.GetRealWidth (75),
-            //        Height = Application.GetRealHeight (75),
-            //        UnSelectedImagePath = "AccountSettings/DataShared.png"
-            //    };
-            //    DataReceptionView.AddChidren (btnDataReceptionIcon);
-            //    var btnDataReceptionTitle = new Button () {
-            //        X = Application.GetRealWidth (125),
-            //        TextAlignment = TextAlignment.CenterLeft,
-            //        TextID = R.MyInternationalizationString.DataReception,
-            //        TextColor = SkinStyle.Current.TextColor1,
-            //    };
-            //    DataReceptionView.AddChidren (btnDataReceptionTitle);
-            //    EventHandler<MouseEventArgs> DataReceptionEventHandler = (sender, e) => {
-            //        GoData ();
-            //    };
-            //    DataReceptionView.MouseUpEventHandler += DataReceptionEventHandler;
-            //    btnDataReceptionIcon.MouseUpEventHandler += DataReceptionEventHandler;
-            //    btnDataReceptionTitle.MouseUpEventHandler += DataReceptionEventHandler;
-            //    Button btnNull3 = new Button () {
-            //        BackgroundColor = SkinStyle.Current.MainColor,
-            //        Height = Application.GetRealHeight (5)
-            //    };
-            //    UserMiddle.SettingView.AddChidren (btnNull3);
-            //}
-            #endregion
+            if (true) {
+                var DataReceptionView = new FrameLayout () {
+                    Width = Application.GetRealWidth (640),
+                    Height = Application.GetRealHeight (100),
+                    BackgroundColor = SkinStyle.Current.ViewColor
+                };
+                UserMiddle.SettingView.AddChidren (DataReceptionView);
+                var btnDataReceptionIcon = new Button () {
+                    X = Application.GetRealWidth (30),
+                    Gravity = Gravity.CenterVertical,
+                    Width = Application.GetRealWidth (75),
+                    Height = Application.GetRealHeight (75),
+                    UnSelectedImagePath = "AccountSettings/DataShared.png"
+                };
+                DataReceptionView.AddChidren (btnDataReceptionIcon);
+                var btnDataReceptionTitle = new Button () {
+                    X = Application.GetRealWidth (125),
+                    TextAlignment = TextAlignment.CenterLeft,
+                    TextID = R.MyInternationalizationString.DataReception,
+                    TextColor = SkinStyle.Current.TextColor1,
+                };
+                DataReceptionView.AddChidren (btnDataReceptionTitle);
+                EventHandler<MouseEventArgs> DataReceptionEventHandler = (sender, e) => {
+
+                    GoData ();
+                };
+                DataReceptionView.MouseUpEventHandler += DataReceptionEventHandler;
+                btnDataReceptionIcon.MouseUpEventHandler += DataReceptionEventHandler;
+                btnDataReceptionTitle.MouseUpEventHandler += DataReceptionEventHandler;
+                Button btnNull3 = new Button () {
+                    BackgroundColor = SkinStyle.Current.MainColor,
+                    Height = Application.GetRealHeight (5)
+                };
+                UserMiddle.SettingView.AddChidren (btnNull3);
+            }
+        #endregion
 
 
-            #region ---msg---
-            //FrameLayout WarningMsgView = new FrameLayout () {
-            //    Width = Application.GetRealWidth (640),
-            //    Height = Application.GetRealHeight (100),
-            //    BackgroundColor = SkinStyle.Current.ViewColor
-            //};
-            //UserMiddle.SettingView.AddChidren (WarningMsgView);
-            //Button btnWarningMsgIcon = new Button () {
-            //    X = Application.GetRealWidth (30),
-            //    Gravity = Gravity.CenterVertical,
-            //    Width = Application.GetRealWidth (75),
-            //    Height = Application.GetRealHeight (75),
-            //    UnSelectedImagePath = "RemoteMsg/RemoteIcon.png",
-            //    SelectedImagePath = "RemoteMsg/RemoteIconOn.png"
-            //};
-            //WarningMsgView.AddChidren (btnWarningMsgIcon);
+        #region ---msg---
+        //FrameLayout WarningMsgView = new FrameLayout () {
+        //    Width = Application.GetRealWidth (640),
+        //    Height = Application.GetRealHeight (100),
+        //    BackgroundColor = SkinStyle.Current.ViewColor
+        //};
+        //UserMiddle.SettingView.AddChidren (WarningMsgView);
+        //Button btnWarningMsgIcon = new Button () {
+        //    X = Application.GetRealWidth (30),
+        //    Gravity = Gravity.CenterVertical,
+        //    Width = Application.GetRealWidth (75),
+        //    Height = Application.GetRealHeight (75),
+        //    UnSelectedImagePath = "RemoteMsg/RemoteIcon.png",
+        //    SelectedImagePath = "RemoteMsg/RemoteIconOn.png"
+        //};
+        //WarningMsgView.AddChidren (btnWarningMsgIcon);
 
-            //Button btnWarningMsgTitle = new Button () {
-            //    X = btnWarningMsgIcon.Right + Application.GetRealWidth (20),
-            //    TextAlignment = TextAlignment.CenterLeft,
-            //    TextID = R.MyInternationalizationString.MessageAlert,
-            //    TextColor = SkinStyle.Current.TextColor1,
-            //};
-            //WarningMsgView.AddChidren (btnWarningMsgTitle);
-            //btnWarningMsgTitle.MouseLongEventHandler += (sd, ds) => {
-            //    //var uc = UserConfig.Instance.RometoUserInfoKeys.Find ((obj) => obj.Contains ("HiddenJson"));
-            //    //new Alert ("", uc, "close").Show ();
-            //};
+        //Button btnWarningMsgTitle = new Button () {
+        //    X = btnWarningMsgIcon.Right + Application.GetRealWidth (20),
+        //    TextAlignment = TextAlignment.CenterLeft,
+        //    TextID = R.MyInternationalizationString.MessageAlert,
+        //    TextColor = SkinStyle.Current.TextColor1,
+        //};
+        //WarningMsgView.AddChidren (btnWarningMsgTitle);
+        //btnWarningMsgTitle.MouseLongEventHandler += (sd, ds) => {
+        //    //var uc = UserConfig.Instance.RometoUserInfoKeys.Find ((obj) => obj.Contains ("HiddenJson"));
+        //    //new Alert ("", uc, "close").Show ();
+        //};
 
-            //EventHandler<MouseEventArgs> WarningMsgEventHandler = (sender, e) => {
-            //    var msgView = new WarningList ();
-            //    UserMiddle.SettingPageView.AddChidren (msgView);
-            //    msgView.ShowWarningListPage ();
-            //    UserMiddle.SettingPageView.PageIndex = 1;
-            //};
-            //WarningMsgView.MouseUpEventHandler += WarningMsgEventHandler;
-            //btnWarningMsgIcon.MouseUpEventHandler += WarningMsgEventHandler;
-            //btnWarningMsgTitle.MouseUpEventHandler += WarningMsgEventHandler;
-            //Button btnNullWarningMsg = new Button () {
-            //    Height = Application.GetRealHeight (5),
-            //    BackgroundColor = SkinStyle.Current.MainColor
-            //};
-            //UserMiddle.SettingView.AddChidren (btnNullWarningMsg);
-            #endregion
+        //EventHandler<MouseEventArgs> WarningMsgEventHandler = (sender, e) => {
+        //    var msgView = new WarningList ();
+        //    UserMiddle.SettingPageView.AddChidren (msgView);
+        //    msgView.ShowWarningListPage ();
+        //    UserMiddle.SettingPageView.PageIndex = 1;
+        //};
+        //WarningMsgView.MouseUpEventHandler += WarningMsgEventHandler;
+        //btnWarningMsgIcon.MouseUpEventHandler += WarningMsgEventHandler;
+        //btnWarningMsgTitle.MouseUpEventHandler += WarningMsgEventHandler;
+        //Button btnNullWarningMsg = new Button () {
+        //    Height = Application.GetRealHeight (5),
+        //    BackgroundColor = SkinStyle.Current.MainColor
+        //};
+        //UserMiddle.SettingView.AddChidren (btnNullWarningMsg);
+        #endregion
 
-            #region ---Schedule---
-            FrameLayout ScheduleView = new FrameLayout () {
+        #region ---Schedule---
+        FrameLayout ScheduleView = new FrameLayout () {
                 Width = Application.GetRealWidth (640),
                 Height = Application.GetRealHeight (100),
                 BackgroundColor = SkinStyle.Current.ViewColor
@@ -421,7 +423,7 @@
                             //var requestObj = new GetSubAccountListObj ();
                             var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj);
                             var revertObj = MainPage.RequestHttps (API.GetSubAccountByDistributedMark, requestJson);
-                            if (revertObj.StateCode.ToUpper() == "SUCCESS") {
+                            if (revertObj.StateCode.ToUpper() == StateCode.SUCCESS) {
                                 Application.RunOnMainThread (() => {
                                     var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SubAccountRes>> (revertObj.ResponseData.ToString ());
                                     SubaccountListView subView = new SubaccountListView (responseDataObj);
@@ -429,6 +431,8 @@
                                     subView.ShowSubaccountListView ();
                                     UserMiddle.SettingPageView.PageIndex += 1;
                                 });
+                            } else {
+                                ShowGetSubAccountByDistributedMarkErrorInfo (revertObj.StateCode);
                             }
                         } catch (Exception ex) {
                             MainPage.FailureToServer ();
@@ -588,5 +592,29 @@
             dialog.Show ();
         }
 
+
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="stateCodeStr"></param>
+        static void ShowGetSubAccountByDistributedMarkErrorInfo (string stateCodeStr)
+        {
+            string mes = "";
+          
+            if (stateCodeStr == ErrorCode.NetworkError) {
+                mes = ErrorCode.NetworkError;
+            } else {
+                mes = ErrorCode.OperationFailed + ErrorCode.Reason + stateCodeStr;
+            }
+            if (!string.IsNullOrEmpty (mes)) {
+                Application.RunOnMainThread (() => {
+                    new Alert ("", mes, Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                });
+            }
+
+
+        }
+
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0