using System; 
 | 
using Shared.Common; 
 | 
using Shared.Phone.UserCenter;  
 | 
  
 | 
namespace Shared.Phone.UserCenter.Residence 
 | 
{ 
 | 
    /// <summary>  
 | 
    /// 选择本地房间图片的界面  
 | 
    /// </summary> 
 | 
    public class SelectLocalRoomImageForm : EditorCommonForm 
 | 
    {  
 | 
        #region ■ 变量声明___________________________  
 | 
  
 | 
        /// <summary>  
 | 
        /// 结束选择的事件(图片名字)  
 | 
        /// </summary>  
 | 
        public Action<string> FinishSelectEvent = null;  
 | 
  
 | 
        #endregion  
 | 
  
 | 
        #region ■ 初始化_____________________________  
 | 
  
 | 
        /// <summary>  
 | 
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)  
 | 
        /// </summary>  
 | 
        public void ShowForm()  
 | 
        {  
 | 
            //初始化中部信息  
 | 
            this.InitMiddleFrame();  
 | 
  
 | 
            //设置头部信息  
 | 
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.LocalPicture));  
 | 
        }  
 | 
  
 | 
        /// <summary>  
 | 
        /// 初始化中部信息  
 | 
        /// </summary>  
 | 
        private void InitMiddleFrame()  
 | 
        {  
 | 
            //清空bodyFrame  
 | 
            this.ClearBodyFrame();  
 | 
  
 | 
            //列表控件  
 | 
            var listView = new VerticalListControl();  
 | 
            listView.Height = bodyFrameLayout.Height;  
 | 
            bodyFrameLayout.AddChidren(listView);  
 | 
  
 | 
            int picHeight = this.GetPictrueRealSize(311);  
 | 
            int picWidth = this.GetPictrueRealSize(467);  
 | 
            int leftRightSpace = this.GetPictrueRealSize(58);  
 | 
            int space = listView.Width - leftRightSpace * 2 - picWidth * 2;  
 | 
  
 | 
            //一共14张图片  
 | 
            FrameLayout frameRow = null;  
 | 
            for (int i = 0; i < 22; i++)  
 | 
            {  
 | 
                //图片  
 | 
                var btnIcon = new ImageView();  
 | 
  
 | 
                if (i % 2 == 0)  
 | 
                {  
 | 
                    btnIcon.X = leftRightSpace;  
 | 
  
 | 
                    //行控件  
 | 
                    frameRow = new FrameLayout();  
 | 
                    frameRow.Height = picHeight + Application.GetRealHeight(58);  
 | 
                    listView.AddChidren(frameRow);  
 | 
                }  
 | 
                else  
 | 
                {  
 | 
                    btnIcon.X = leftRightSpace + picWidth + space;  
 | 
                }  
 | 
  
 | 
                btnIcon.Y = Application.GetRealHeight(58);  
 | 
                btnIcon.Width = picWidth;  
 | 
                btnIcon.Height = picHeight;  
 | 
                btnIcon.ImagePath = $"RoomIcon/{i}.jpg";  
 | 
                btnIcon.Radius = (uint)Application.GetRealHeight(17);  
 | 
                frameRow.AddChidren(btnIcon);  
 | 
  
 | 
                //图片遮罩  
 | 
                var btnZhezhao = new FrameLayout();  
 | 
                btnZhezhao.Width = btnIcon.Width;  
 | 
                btnZhezhao.Height = btnIcon.Height;  
 | 
                btnZhezhao.Y = btnIcon.Y;  
 | 
                btnZhezhao.X = btnIcon.X;  
 | 
                btnZhezhao.Radius = (uint)Application.GetRealHeight(17);  
 | 
                btnZhezhao.BackgroundColor = UserCenterColor.Current.PictrueZhezhaoColor;  
 | 
                frameRow.AddChidren(btnZhezhao);  
 | 
                btnZhezhao.MouseUpEventHandler += (sender, e) =>  
 | 
                {  
 | 
                    //结束选择的事件  
 | 
                    this.FinishSelectEvent?.Invoke(btnIcon.ImagePath);  
 | 
                    this.CloseForm();  
 | 
                };  
 | 
                
 | 
            }  
 | 
  
 | 
            //底部间距  
 | 
            var frameTemp = new FrameLayout();  
 | 
            frameTemp.Height = Application.GetRealHeight(58);  
 | 
            listView.AddChidren(frameTemp);  
 | 
        }  
 | 
  
 | 
        #endregion  
 | 
  
 | 
        #region ■ 界面关闭___________________________  
 | 
  
 | 
        /// <summary>  
 | 
        /// 界面关闭  
 | 
        /// </summary>  
 | 
        public override void CloseFormBefore()  
 | 
        {  
 | 
            this.FinishSelectEvent = null;  
 | 
  
 | 
            base.CloseFormBefore();  
 | 
        }  
 | 
  
 | 
        #endregion 
 | 
    } 
 | 
} 
 |