HDL_ON/UI/UI2/4-PersonalCenter/MemberManagement/ChooseShareMemberTargetListPage.cs
@@ -1,182 +1,186 @@
using System.Collections.Generic;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
//using System.Collections.Generic;
//using HDL_ON.DAL.Server;
//using HDL_ON.Entity;
//using HDL_ON.UI.CSS;
//using Shared;
namespace HDL_ON.UI
{
    /// <summary>
    /// 加载需要分享到子账号的选择界面
    /// </summary>
    public partial class ChooseShareMemberTargetListPage : FrameLayout
    {
        ChooseShareMemberTargetListPage bodyView;
        VerticalScrolViewLayout contentView;
        Button btnOption;
//namespace HDL_ON.UI
//{
//    /// <summary>
//    /// 加载需要分享到子账号的选择界面
//    /// </summary>
//    public partial class ChooseShareMemberTargetListPage : FrameLayout
//    {
//        ChooseShareMemberTargetListPage bodyView;
//        VerticalScrolViewLayout contentView;
//        Button btnOption;
        Loading waitPage;
        List<ShareData> addFuns;
        List<ResidenceMemberInfo> memberList;
        public ChooseShareMemberTargetListPage(List<ShareData> funs)
        {
            memberList = new List<ResidenceMemberInfo>();
            addFuns = funs;
            bodyView = this;
        }
//        Loading waitPage;
//        List<ShareData> addFuns;
//        List<ResidenceMemberInfo> memberList;
//        ResidenceMemberInfo memberInfo;
        public void LoadPage()
        {
            //创建读取成员账号线程
            var thread = LoadThread_GetResidenceMemberAccount();
            waitPage = new Loading();
            new PublicAssmebly().LoadPage_WaitPage(thread, bodyView, waitPage);
//        public ChooseShareMemberTargetListPage(List<ShareData> funs, ResidenceMemberInfo mInfo)
//        {
//            memberList = new List<ResidenceMemberInfo>();
//            addFuns = funs;
//            bodyView = this;
//            memberInfo = mInfo;
//        }
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            new TopViewDiv(bodyView, Language.StringByID(StringId.Shared)).LoadTopView();
//        public void LoadPage()
//        {
//            //创建读取成员账号线程
//            var thread = LoadThread_GetResidenceMemberAccount();
//            waitPage = new Loading();
//            new PublicAssmebly().LoadPage_WaitPage(thread, bodyView, waitPage);
            #region title view
            FrameLayout titleView = new FrameLayout()
            {
                Y = Application.GetRealHeight(72),
                Height = Application.GetRealHeight(44),
                BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            bodyView.AddChidren(titleView);
//            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
//            new TopViewDiv(bodyView, Language.StringByID(StringId.Shared)).LoadTopView();
            Button btnTitle = new Button()
            {
                X = Application.GetRealWidth(16),
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextID = StringId.SharedTo,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextAlignment = TextAlignment.CenterLeft,
                IsBold = true,
            };
            titleView.AddChidren(btnTitle);
//            #region title view
//            FrameLayout titleView = new FrameLayout()
//            {
//                Y = Application.GetRealHeight(72),
//                Height = Application.GetRealHeight(44),
//                BackgroundColor = CSS_Color.MainBackgroundColor,
//            };
//            bodyView.AddChidren(titleView);
            titleView.AddChidren(new Button() {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealHeight(43),
                Height = Application.GetRealHeight(1),
                BackgroundColor = CSS_Color.DividingLineColor,
            });
            #endregion
//            Button btnTitle = new Button()
//            {
//                X = Application.GetRealWidth(16),
//                TextColor = CSS_Color.FirstLevelTitleColor,
//                TextID = StringId.SharedTo,
//                TextSize = CSS_FontSize.SubheadingFontSize,
//                TextAlignment = TextAlignment.CenterLeft,
//                IsBold = true,
//            };
//            titleView.AddChidren(btnTitle);
            contentView = new VerticalScrolViewLayout()
            {
                Y = titleView.Bottom,
                Height = Application.GetRealHeight(420),
                //BackgroundColor = CSS_Color.MainBackgroundColor,
            };
            bodyView.AddChidren(contentView);
//            titleView.AddChidren(new Button() {
//                X = Application.GetRealWidth(16),
//                Y = Application.GetRealHeight(43),
//                Height = Application.GetRealHeight(1),
//                BackgroundColor = CSS_Color.DividingLineColor,
//            });
//            #endregion
            LoadMemberRow();
//            contentView = new VerticalScrolViewLayout()
//            {
//                Y = titleView.Bottom,
//                Height = Application.GetRealHeight(420),
//                //BackgroundColor = CSS_Color.MainBackgroundColor,
//            };
//            bodyView.AddChidren(contentView);
            btnOption = new Button()
            {
                Y = Application.GetRealHeight(519 + 64),
                Gravity = Gravity.CenterHorizontal,
                Width = Application.GetRealWidth(220),
                Height = Application.GetRealWidth(44),
                BackgroundColor = CSS_Color.MainColor,
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.MainBackgroundColor,
                TextID = StringId.ConfirmShared,
                TextSize = CSS_FontSize.SubheadingFontSize,
                IsBold = true,
                Radius = (uint)Application.GetRealWidth(22),
                BorderColor = 0x00000000,
                BorderWidth = 0,
            };
            bodyView.AddChidren(btnOption);
//            LoadMemberRow();
            LoadEvent_SharedData();
        }
//            btnOption = new Button()
//            {
//                Y = Application.GetRealHeight(519 + 64),
//                Gravity = Gravity.CenterHorizontal,
//                Width = Application.GetRealWidth(220),
//                Height = Application.GetRealWidth(44),
//                BackgroundColor = CSS_Color.MainColor,
//                TextAlignment = TextAlignment.Center,
//                TextColor = CSS_Color.MainBackgroundColor,
//                TextID = StringId.ConfirmShared,
//                TextSize = CSS_FontSize.SubheadingFontSize,
//                IsBold = true,
//                Radius = (uint)Application.GetRealWidth(22),
//                BorderColor = 0x00000000,
//                BorderWidth = 0,
//            };
//            bodyView.AddChidren(btnOption);
        /// <summary>
        /// 加载成员列表区域
        /// </summary>
        void LoadMemberRow()
        {
            contentView.RemoveAll();
//            LoadEvent_SharedData();
//        }
            int index = 1;
            foreach (var mInfo in memberList)
            {
                FrameLayout memberRow = new FrameLayout()
                {
                    Height = Application.GetRealWidth(65),
                    BackgroundColor = CSS_Color.MainBackgroundColor,
                };
                contentView.AddChidren(memberRow);
//        /// <summary>
//        /// 加载成员列表区域
//        /// </summary>
//        void LoadMemberRow()
//        {
//            contentView.RemoveAll();
                var memberHeadImageView = new ImageView()
                {
                    X = Application.GetRealWidth(16),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetMinRealAverage(36),
                    Height = Application.GetMinRealAverage(36),
                    Radius = (uint)Application.GetMinRealAverage(24),
                    ImagePath = mInfo.headImagePagePath,
                };
                memberRow.AddChidren(memberHeadImageView);
//            int index = 1;
//            foreach (var mInfo in memberList)
//            {
//                FrameLayout memberRow = new FrameLayout()
//                {
//                    Height = Application.GetRealWidth(65),
//                    BackgroundColor = CSS_Color.MainBackgroundColor,
//                };
//                contentView.AddChidren(memberRow);
                Button btnMemberName = new Button()
                {
                    X = Application.GetRealWidth(64),
                    Y = Application.GetRealWidth(10),
                    //Width = Application.GetRealWidth(300),
                    Height = Application.GetRealWidth(24),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.TextFontSize,
                    Text = mInfo.UserName,
                };
                memberRow.AddChidren(btnMemberName);
//                var memberHeadImageView = new ImageView()
//                {
//                    X = Application.GetRealWidth(16),
//                    Gravity = Gravity.CenterVertical,
//                    Width = Application.GetMinRealAverage(36),
//                    Height = Application.GetMinRealAverage(36),
//                    Radius = (uint)Application.GetMinRealAverage(24),
//                    ImagePath = mInfo.headImagePagePath,
//                };
//                memberRow.AddChidren(memberHeadImageView);
                Button btnMemberMail = new Button()
                {
                    X = Application.GetRealWidth(64),
                    Y = btnMemberName.Bottom,
                    //Width = Application.GetRealWidth(300),
                    Height = Application.GetRealWidth(21),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = CSS_Color.PromptingColor1,
                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                    Text = mInfo.Account,
                };
                memberRow.AddChidren(btnMemberMail);
//                Button btnMemberName = new Button()
//                {
//                    X = Application.GetRealWidth(64),
//                    Y = Application.GetRealWidth(10),
//                    //Width = Application.GetRealWidth(300),
//                    Height = Application.GetRealWidth(24),
//                    TextAlignment = TextAlignment.CenterLeft,
//                    TextColor = CSS_Color.FirstLevelTitleColor,
//                    TextSize = CSS_FontSize.TextFontSize,
//                    Text = mInfo.UserName,
//                };
//                memberRow.AddChidren(btnMemberName);
                Button btnChoose = new Button()
                {
                    X = Application.GetRealWidth(331),
                    Gravity = Gravity.CenterVertical,
                    Width = Application.GetMinRealAverage(28),
                    Height = Application.GetMinRealAverage(28),
                    UnSelectedImagePath = "Public/ChooseIcon.png",
                    SelectedImagePath = "Public/ChooseOnIcon.png",
                    IsSelected = true,
                };
                memberRow.AddChidren(btnChoose);
//                Button btnMemberMail = new Button()
//                {
//                    X = Application.GetRealWidth(64),
//                    Y = btnMemberName.Bottom,
//                    //Width = Application.GetRealWidth(300),
//                    Height = Application.GetRealWidth(21),
//                    TextAlignment = TextAlignment.CenterLeft,
//                    TextColor = CSS_Color.PromptingColor1,
//                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
//                    Text = mInfo.Account,
//                };
//                memberRow.AddChidren(btnMemberMail);
                if (memberList.Count > index)
                {
                    memberRow.AddChidren(new Button()
                    {
                        Y = Application.GetRealHeight(64),
                        Gravity = Gravity.CenterHorizontal,
                        Width = Application.GetRealWidth(343),
                        Height = Application.GetRealHeight(1),
                        BackgroundColor = CSS_Color.DividingLineColor,
                    });
                }
                index++;
//                Button btnChoose = new Button()
//                {
//                    X = Application.GetRealWidth(331),
//                    Gravity = Gravity.CenterVertical,
//                    Width = Application.GetMinRealAverage(28),
//                    Height = Application.GetMinRealAverage(28),
//                    UnSelectedImagePath = "Public/ChooseIcon.png",
//                    SelectedImagePath = "Public/ChooseOnIcon.png",
//                    IsSelected = true,
//                };
//                memberRow.AddChidren(btnChoose);
                var eventHandler = LoadEvent_ChangeSharedList(btnChoose, mInfo);
                btnChoose.MouseUpEventHandler = eventHandler;
                btnMemberName.MouseUpEventHandler = eventHandler;
                btnMemberMail.MouseUpEventHandler = eventHandler;
            }
        }
    }
}
//                if (memberList.Count > index)
//                {
//                    memberRow.AddChidren(new Button()
//                    {
//                        Y = Application.GetRealHeight(64),
//                        Gravity = Gravity.CenterHorizontal,
//                        Width = Application.GetRealWidth(343),
//                        Height = Application.GetRealHeight(1),
//                        BackgroundColor = CSS_Color.DividingLineColor,
//                    });
//                }
//                index++;
//                var eventHandler = LoadEvent_ChangeSharedList(btnChoose, mInfo);
//                btnChoose.MouseUpEventHandler = eventHandler;
//                btnMemberName.MouseUpEventHandler = eventHandler;
//                btnMemberMail.MouseUpEventHandler = eventHandler;
//            }
//        }
//    }
//}