1
wxr
2023-03-31 7e42cc13a14b7de31c9f5d5c61cdf24f3246335d
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
using System;
using System.Collections.Generic;
using Shared.SimpleControl.Phone;
using System.Text;
namespace Shared.SimpleControl.Phone
{
    public class UserTVCustomChannel : FrameLayout
    {
        FrameLayout LongPressFrameLayout = new FrameLayout ();
 
        public void Show (InfraredMode infraredTV)
        {
            #region bodyView
            FrameLayout BodyView = new FrameLayout () { 
                BackgroundColor = SkinStyle.Current.MainColor
            };
            this.AddChidren (BodyView);
 
            VerticalScrolViewLayout tvBodyView = new VerticalScrolViewLayout ();
            BodyView.AddChidren (tvBodyView);
 
            FrameLayout tvRowView = null;
            if (infraredTV.InfraredCustomChannel == null) {
                infraredTV.InfraredCustomChannel = new List<InfraredCustomChannel> ();
            }
            //infraredTV.InfraredCustomChannel.Add (new InfraredCustomChannel () { ChannelName = Language.StringByID(R.MyInternationalizationString.AddButton)});
            for (int index = 0; index <= infraredTV.InfraredCustomChannel.Count; index++) {
                if (index % 2 == 0) {
                    tvRowView = new FrameLayout () {
                        Height = Application.GetRealHeight (250),
                        Width = Application.GetRealWidth (640),
                    };
                    tvBodyView.AddChidren (tvRowView);
                }
 
                var tvView = new FrameLayout () {
                    Width = Application.GetRealWidth (320),
                };
                tvRowView.AddChidren (tvView);
 
                if (index % 2 == 1) {
                    tvView.X = Application.GetRealWidth (320);
                }
 
                if (index == infraredTV.InfraredCustomChannel.Count) {
                    tvView.BackgroundImagePath = "Item/SceneAdd.png";
                    tvView.MouseUpEventHandler += (sender, e) => {
                        var tv3 = new UserTVAddCustomChannel ();
                        tv3.Show ();
                        tv3.Show (infraredTV, MyRefresh);
                    };
                } else {
                    InfraredCustomChannel icc = infraredTV.InfraredCustomChannel [index];
                    var btnBGC = new Button () {
                        UnSelectedImagePath = icc.ChannelIconPath,
                        TextAlignment = TextAlignment.BottomCenter,
                        Text = icc.ChannelName,
                        TextColor = SkinStyle.Current.TextColor1,
                        TextSize = 15,
                        Tag = index,
                    };
                    tvView.AddChidren (btnBGC);
                    btnBGC.MouseUpEventHandler += (sender, e) => {
                        infraredTV.InfraredCustomChannel [int.Parse (btnBGC.Tag.ToString ())].Send ();
                    };
 
                    btnBGC.MouseLongEventHandler += (sender, e) => {
                        Alert alert = new Alert ("",
                                                 Language.StringByID (R.MyInternationalizationString.SureDelete),
                                                 Language.StringByID (R.MyInternationalizationString.Cancel),
                                                 Language.StringByID (R.MyInternationalizationString.Confrim));
                        alert.Show ();
                        alert.ResultEventHandler += (sender2, e2) => {
                            if (e2) {
                                infraredTV.InfraredCustomChannel.Remove (icc);
                                IO.FileUtils.SaveEquipmentMessage (infraredTV, infraredTV.LoopID.ToString ());
                                MyRefresh (infraredTV);
                            }
                        };
                    };
                }
            }
            #endregion
 
 
            FrameLayout bottomNull = new FrameLayout () {
                BackgroundColor = SkinStyle.Current.MainColor,
                Height = Application.GetRealHeight (70),
                Y = Application.GetRealHeight (910),
            };
            AddChidren (bottomNull);
        }
 
        public void MyRefresh (InfraredMode infraredTV )
        {
            this.RemoveAll ();
            Show (infraredTV);
        }
    }
}