黄学彪
2019-11-25 5727cf0b9b54da0a191dd1e23cb5abf21320fbff
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
using System;
using Shared.Common;
 
namespace Shared.Phone.Device.CommonForm
{
    public class CustomAlert : FrameLayout
    {
        /// <summary>
        /// CancleBtn
        /// </summary>
        public Button CancleBtn;
        /// <summary>
        /// ComfrimBtn
        /// </summary>
        public Button ComfrimBtn;
        /// <summary>
        /// ResultEventHandler
        /// </summary>
        public Action<bool> ResultEventHandler;
 
        public CustomAlert()
        {
            Width = Application.GetRealWidth(1080);
            Height = Application.GetRealHeight(1920);
        }
 
        /// <summary>
        /// Show
        /// </summary>
        /// <param name="tip"></param>
        /// <param name="message"></param>
        /// <param name="cancle"></param>
        /// <param name="comfirm"></param>
        public void Show(string tip,string message,string cancle,string comfirm)
        {
            var tipBackGround = new FrameLayout
            {
                BackgroundColor = ZigbeeColor.Current.GXCDailogBackGroundColor
            };
            AddChidren(tipBackGround);
 
            var tipView = new FrameLayout
            {
                Height = Application.GetRealHeight(478),
                Width = Application.GetRealWidth(792),
                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
                Radius = (uint)Application.GetRealHeight(30),
                Gravity = Gravity.Center
            };
            tipBackGround.AddChidren(tipView);
 
            var tipBtn = new Button
            {
                Y=Application.GetRealHeight(69),
                Width=Application.GetRealWidth(500),
                Height=Application.GetRealHeight(63),
                Gravity=Gravity.CenterHorizontal,
                TextColor=ZigbeeColor.Current.GXCTextBlackColor,
                TextSize=15,
                Text=tip
            };
            tipView.AddChidren(tipBtn);
 
            var messageBtn = new Button
            {
                Y = Application.GetRealHeight(180),
                Width = Application.GetRealWidth(674),
                Height = Application.GetRealHeight(140),
                Gravity = Gravity.CenterHorizontal,
                TextColor = ZigbeeColor.Current.GXCTextGrayColor,
                TextSize = 15,
                Text = message,
                IsMoreLines=true
            };
            tipView.AddChidren(messageBtn);
 
            CancleBtn = new Button
            {
                Y = Application.GetRealHeight(351),
                Width = Application.GetRealWidth(396),
                Height = Application.GetRealHeight(127),
                TextColor = ZigbeeColor.Current.GXCTextGrayColor,
                TextSize = 15,
                BackgroundColor=ZigbeeColor.Current.GXCButtonUnSelectedColor3,
                Text = cancle
            };
            tipView.AddChidren(CancleBtn);
 
            ComfrimBtn = new Button
            {
                X = Application.GetRealWidth(396),
                Y = Application.GetRealHeight(351),
                Width = Application.GetRealWidth(396),
                Height = Application.GetRealHeight(127),
                TextColor = ZigbeeColor.Current.GXCTextGrayColor,
                TextSize = 15,
                BackgroundColor = ZigbeeColor.Current.GXCButtonBlackSelectedColor,
                Text = comfirm
            };
            tipView.AddChidren(ComfrimBtn);
 
            CancleBtn.MouseUpEventHandler = (sender, e) =>
            {
                RemoveFromParent();
                ResultEventHandler?.Invoke(false);
            };
 
            ComfrimBtn.MouseUpEventHandler = (sender, e) =>
            {
                RemoveFromParent();
                ResultEventHandler?.Invoke(true);
            };
        }
        /// <summary>
        /// Show
        /// </summary>
        /// <param name="message"></param>
        public void Show(string message)
        {
            Show(Language.StringByID(R.MyInternationalizationString.TIP), message, Language.StringByID(R.MyInternationalizationString.Cancel), Language.StringByID(R.MyInternationalizationString.Confrim));
        }
 
    }
}