JLChen
2021-01-05 f500e14c0a994487070380c50c85e0929cbc8e63
Crabtree/SmartHome/UI/SimpleControl/Phone/Register/SubaccountListView.cs
@@ -58,6 +58,11 @@
            topView.AddChidren (ItemButton);
            #endregion
            //2020-07-01
            if (UserConfig.Instance.CurrentRegion != null && !string.IsNullOrEmpty (UserConfig.Instance.CurrentRegion.Name)) {
                NameButton.Text = UserConfig.Instance.CurrentRegion.Name;
            }
            EventHandler<MouseEventArgs> addSubaccountHandler = (sender, e) => {
                modifySubaccount (null);
            };
@@ -73,7 +78,7 @@
            Button btnUserIcon = new Button () {
                X = Application.GetRealWidth (27),
                Width = Application.GetRealWidth (96),
                Height = Application.GetRealHeight (96),
                Height = Application.GetRealWidth (96),
                Gravity = Gravity.CenterVertical,
                Radius = 5,
                BorderColor = SkinStyle.Current.Transparent,
@@ -109,13 +114,34 @@
            VerticalScrolViewLayout contentView = new VerticalScrolViewLayout () {
                Y = topUserMsgView.Bottom,
                Height = Application.GetRealHeight (1136) - topUserMsgView.Bottom,
                Height = Application.GetRealHeight (1136-80) - topUserMsgView.Bottom,
                BackgroundColor = SkinStyle.Current.ViewColor,
                ScrollEnabled = false,
            };
            AddChidren (contentView);
            //#region
            ////当前住宅
            //FrameLayout homeView = new FrameLayout () {
            //    Height = Application.GetRealHeight (100),
            //    BackgroundColor = SkinStyle.Current.Transparent
            //};
            //contentView.AddChidren (homeView);
            //Button btnHomeText = new Button () {
            //    X = Application.GetRealWidth (40),
            //    Width = Application.GetRealWidth (600),
            //    //TextID = R.MyInternationalizationString.Subaccount,
            //    TextAlignment = TextAlignment.CenterLeft,
            //    TextColor = SkinStyle.Current.TextColor1,
            //};
            //homeView.AddChidren (btnHomeText);
            //if (UserConfig.Instance.CurrentRegion != null && !string.IsNullOrEmpty (UserConfig.Instance.CurrentRegion.Name)) {
            //    btnHomeText.Text = "Current residence: " + UserConfig.Instance.CurrentRegion.Name;
            //}
            //#endregion
            FrameLayout subaccountView = new FrameLayout () {
                Height = Application.GetRealHeight (50),
                BackgroundColor = SkinStyle.Current.MainColor
@@ -145,6 +171,23 @@
            addSubaccountList ();
            addTipView ();
        }
        void addTipView () {
            var TipView = new Button () {
                Width = LayoutParams.MatchParent,
                Y = Application.GetRealHeight (Application.DesignHeight - 80),
                Height = Application.GetRealHeight (80),
                BackgroundColor = 0xFFFFFFE0,
                TextSize = 11,
                TextColor = 0xFF1F1F1F,
                TextAlignment = TextAlignment.Center,
                IsMoreLines = true,
                Text = "Manage the member list of the current residence and share it to other accounts. \n Tips: You need to add the registered member account.",
            };
            AddChidren (TipView);
        }
        void addSubaccountList ()
@@ -225,7 +268,7 @@
     
                                var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj);
                                var revertObj = MainPage.RequestHttps (API.DeletedSubAccount, requestJson, true);
                                var revertObj = MainPage.RequestHttps (API.DeletedSubAccount, requestJson);
                                if (revertObj.StateCode.ToUpper() == "SUCCESS") {
                                    Application.RunOnMainThread (() => {
                                        subaccountList.Remove (subaccount);
@@ -433,14 +476,14 @@
                            };
                            var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj);
                            var revertObj = MainPage.RequestHttps (API.BindSubAccount, requestJson, true);
                            var revertObj = MainPage.RequestHttps (API.BindSubAccount, requestJson);
                            if (revertObj.StateCode.ToUpper () == "SUCCESS") {
                                var requestObj2 = new GetSubAccountByDistributedMarkObj () {
                                    DistributedMark = UserConfig.Instance.CurrentRegion.Id,
                                };
                                //var requestObj2 = new GetSubAccountListObj ();
                                var requesetJson2 = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj2);
                                var requesetRevertObj2 = MainPage.RequestHttps (API.GetSubAccountByDistributedMark, requesetJson2, true);
                                var requesetRevertObj2 = MainPage.RequestHttps (API.GetSubAccountByDistributedMark, requesetJson2);
                                if (requesetRevertObj2.StateCode.ToUpper () == "SUCCESS") {
                                    var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SubAccountRes>> (requesetRevertObj2.ResponseData.ToString ());
                                    subaccountList = responseDataObj;
@@ -463,7 +506,7 @@
                            new Alert ("", Language.StringByID (R.MyInternationalizationString.FailureToServer),
                                       Language.StringByID (R.MyInternationalizationString.Close)).Show ();
                        });
                        Console.WriteLine (ex.ToString());
                        Utlis.WriteLine (ex.ToString());
                    } finally {
                        Application.RunOnMainThread (() => {
                            MainPage.Loading.Hide ();