New file |
| | |
| | | using Shared.Phone.UserCenter;
|
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | |
|
| | | namespace Shared.Phone.MainPage
|
| | | {
|
| | | /// <summary>
|
| | | /// 选择本地设备图片的界面
|
| | | /// </summary>
|
| | | public class SelectLocalDeviceImageForm : EditorCommonForm
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 结束选择的事件(图片名字)
|
| | | /// </summary>
|
| | | public Action<string> FinishSelectEvent = null;
|
| | | /// <summary>
|
| | | /// 当前选择的图标控件
|
| | | /// </summary>
|
| | | private PicViewControl selectContr = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 画面显示(底层会固定调用此方法,借以完成画面创建)
|
| | | /// </summary>
|
| | | public void ShowForm()
|
| | | {
|
| | | //初始化中部信息
|
| | | this.InitMiddleFrame();
|
| | | //设置头部信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.SelectIcon));
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化中部信息
|
| | | /// </summary>
|
| | | private void InitMiddleFrame()
|
| | | {
|
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | //列表控件
|
| | | var listView = new VerticalListControl();
|
| | | listView.Height = bodyFrameLayout.Height;
|
| | | bodyFrameLayout.AddChidren(listView);
|
| | |
|
| | | int space = this.GetPictrueRealSize(46);
|
| | | int backWidth = (listView.Width - ControlCommonResourse.XXLeft * 2 - space * 3) / 4;
|
| | | //防止误差,分两步计算
|
| | | int iconWidth = backWidth - this.GetPictrueRealSize(43) - this.GetPictrueRealSize(43);
|
| | |
|
| | | //一共28张图片
|
| | | FrameLayout frameRow = null;
|
| | | for (int i = 0; i < 28; i++)
|
| | | {
|
| | | //4个一组
|
| | | if (i % 4 == 0)
|
| | | {
|
| | | //行控件
|
| | | frameRow = new FrameLayout();
|
| | | frameRow.Height = backWidth + Application.GetRealHeight(58);
|
| | | listView.AddChidren(frameRow);
|
| | | }
|
| | | //背景
|
| | | var frameBack = new FrameLayoutStatuControl();
|
| | | frameBack.UseClickStatu = false;
|
| | | frameBack.Height = backWidth;
|
| | | frameBack.Width = backWidth;
|
| | | frameBack.Radius = (uint)backWidth / 2;
|
| | | frameBack.BackgroundColor = UserCenterColor.Current.White;
|
| | | frameBack.X = ControlCommonResourse.XXLeft + (i % 4) * (backWidth + space);
|
| | | frameBack.Y = Application.GetRealHeight(58);
|
| | | frameRow.AddChidren(frameBack);
|
| | |
|
| | | //图片
|
| | | var btnIcon = new PicViewControl(iconWidth, iconWidth, false);
|
| | | btnIcon.UnSelectedImagePath = $"FunctionIcon/{i + 1}Icon.png";
|
| | | btnIcon.SelectedImagePath = $"FunctionIcon/{i + 1}IconSelected.png";
|
| | | btnIcon.Gravity = Gravity.Center;
|
| | | frameBack.AddChidren(btnIcon, ChidrenBindMode.BindEvent);
|
| | |
|
| | | frameBack.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | btnIcon.IsSelected = !btnIcon.IsSelected;
|
| | | if (this.selectContr != null && this.selectContr.UnSelectedImagePath != btnIcon.UnSelectedImagePath)
|
| | | {
|
| | | //取消掉前一个
|
| | | this.selectContr.IsSelected = false;
|
| | | }
|
| | | this.selectContr = btnIcon;
|
| | | };
|
| | | }
|
| | |
|
| | | //确定
|
| | | var btnSave = new BottomClickButton();
|
| | | btnSave.TextID = R.MyInternationalizationString.uConfirm1;
|
| | | bodyFrameLayout.AddChidren(btnSave);
|
| | | btnSave.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (this.selectContr != null && this.selectContr.IsSelected == true)
|
| | | {
|
| | | //调用回调函数
|
| | | this.FinishSelectEvent?.Invoke(this.selectContr.UnSelectedImagePath);
|
| | | }
|
| | | this.CloseForm();
|
| | | };
|
| | |
|
| | | //调整桌布高度
|
| | | listView.AdjustRealHeightByBottomButton(Application.GetRealHeight(23));
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 界面关闭___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 界面关闭
|
| | | /// </summary>
|
| | | public override void CloseFormBefore()
|
| | | {
|
| | | this.FinishSelectEvent = null;
|
| | |
|
| | | base.CloseFormBefore();
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|