HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2019-09-30 404cdc88627f942df7944af04ee05b9d527752d6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
using System;
using System.Collections.Generic;
using System.Text;
 
namespace Shared.Phone.UserCenter
{
    /// <summary>
    /// 特殊的输入框,初始状态和输入完成后,字体变为灰色,输入时为黑色
    /// </summary>
    public class TextInputExControl : TextInputBase
    {
        #region ■ 变量声明___________________________
 
        /// <summary>
        /// 输入结束的事件
        /// </summary>
        public Action FinishInputEvent = null;
        /// <summary>
        /// 文本是否为黑色字体
        /// </summary>
        private bool IsTextBlack = false;
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 特殊的输入框,初始状态和输入完成后,字体变为灰色,输入时为黑色
        /// </summary>
        /// <param name="i_Width">宽度</param>
        /// <param name="i_Height">高度</param>
        /// <param name="real">是否计算真实值</param>
        public TextInputExControl(int i_Width, int i_Height, bool real = false)
        {
            this.InitSize(i_Width, i_Height, real);
            this.TextColor = UserCenterColor.Current.TextGrayColor3;
 
            this.TextChangeEventHandler += this.TextChangeEvent;
            this.EditorEnterAction += this.EditorEnterEvent;
        }
 
        /// <summary>
        /// 特殊的输入框,初始状态和输入完成后,字体变为灰色,输入时为黑色
        /// </summary>
        /// <param name="i_Width">宽度</param>
        /// <param name="real">是否计算真实值</param>
        public TextInputExControl(int i_Width, bool real = false)
        {
            this.InitSize(i_Width, real);
            this.TextColor = UserCenterColor.Current.TextGrayColor3;
 
            this.TextChangeEventHandler += this.TextChangeEvent;
            this.EditorEnterAction += this.EditorEnterEvent;
        }
 
        #endregion
 
        #region ■ 输入事件___________________________
 
        /// <summary>
        /// 输入完成事件
        /// </summary>
        /// <param name="view"></param>
        private void EditorEnterEvent(View view)
        {
            this.TextColor = UserCenterColor.Current.TextGrayColor3;
            this.IsTextBlack = false;
            this.FinishInputEvent?.Invoke();
        }
 
        /// <summary>
        /// 值改变事件
        /// </summary>
        /// <param name="view"></param>
        /// <param name="value"></param>
        private void TextChangeEvent(View view, string value)
        {
            if (this.IsTextBlack == true || this.Foucs == false)
            {
                return;
            }
            this.IsTextBlack = true;
            this.TextColor = UserCenterColor.Current.TextColor1;
        }
 
        #endregion
 
        #region ■ 一般方法___________________________
 
        /// <summary>
        /// 控件销毁
        /// </summary>
        public override void RemoveFromParent()
        {
            this.FinishInputEvent = null;
 
            base.RemoveFromParent();
        }
 
        #endregion
    }
}