黄学彪
2019-10-10 2ed75b8b337048e5d75e6d9ec8307633134f02fd
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
using System;
using System.Collections.Generic;
using System.Text;
 
namespace Shared.Phone.UserCenter.Safety
{
    /// <summary>
    /// 各防区的设置内容的菜单界面
    /// </summary>
    public class SectorsSettionMenuForm : EditorCommonForm
    {
        #region ■ 变量声明___________________________
 
        /// <summary>
        /// 防区ID
        /// </summary>
        private int zoonID = 0;
        /// <summary>
        /// 防区名字
        /// </summary>
        private string SectorsName = string.Empty;
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 画面显示(底层会固定调用此方法,借以完成画面创建)
        /// </summary>
        /// <param name="i_SectorsName">防区名字</param>
        /// <param name="i_zoonID">防区ID</param>
        public void ShowForm(string i_SectorsName, int i_zoonID)
        {
            this.zoonID = i_zoonID;
            this.SectorsName = i_SectorsName;
 
            //设置头部信息
            base.SetTitleText(SectorsName);
 
            //初始化中部信息
            this.InitMiddleFrame();
        }
 
        /// <summary>
        /// 初始化中部信息
        /// </summary>
        private void InitMiddleFrame()
        {
            //清空bodyFrame
            this.ClearBodyFrame();
 
            var listView = new VerticalListControl(29);
            listView.Y = Application.GetRealHeight(-6);
            listView.Height = zoonID == 3 ? Application.GetRealHeight(639) : Application.GetRealHeight(481);
            listView.BackgroundColor = UserCenterColor.Current.White;
            bodyFrameLayout.AddChidren(listView);
 
            //初始化【传感器设置】行
            var row1 = new FrameRowControl(listView.rowSpace / 2);
            listView.AddChidren(row1);
            row1.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uSensorSettion), 500);
            row1.AddRightArrow();
            row1.AddBottomLine();
            row1.ButtonClickEvent += (sender, e) =>
            {
                var form = new SensorDeviceSettionListForm();
                form.AddForm(this.SectorsName, this.zoonID);
            };
 
            //初始化【报警目标设置】行
            var row2 = new FrameRowControl(listView.rowSpace / 2);
            listView.AddChidren(row2);
            row2.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uAlarmTargetSettion), 500);
            row2.AddRightArrow();
            row2.AddBottomLine();
            row2.ButtonClickEvent += (sender, e) =>
            {
                var form = new AlarmTargetSettionForm();
                form.AddForm(this.zoonID);
            };
 
            //出入防区的时候才显示
            if (zoonID == 3)
            {
                //初始化【延时设置】行
                var row3 = new FrameRowControl(listView.rowSpace / 2);
                listView.AddChidren(row3);
                row3.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uDelayedSettion), 500);
                row3.AddRightArrow();
                row3.AddBottomLine();
                row3.ButtonClickEvent += (sender, e) =>
                {
                    var form = new DelayedSettionMainForm();
                    form.AddForm();
                };
            }
 
            //初始化【信息通知】的行
            var row4 = new FrameRowControl(listView.rowSpace / 2);
            listView.AddChidren(row4);
            row4.AddLeftCaption(Language.StringByID(R.MyInternationalizationString.uInformationPush), 500);
            //开关图标
            var btnSwicth = row4.AddMostRightSwitchIcon();
            btnSwicth.IsSelected = HdlSafeguardLogic.Current.GetGarrisonInformationPushStatu(this.zoonID) == 0;
            btnSwicth.ButtonClickEvent += (sender, e) =>
            {
                //设置信息通知的状态
                this.SetInformationPush(btnSwicth);
            };
        }
 
        #endregion
 
        #region ■ 设置信息推送的状态_________________
 
        /// <summary>
        /// 设置信息推送的状态
        /// </summary>
        /// <param name="btnswich"></param>
        private async void SetInformationPush(MostRightIconControl btnswich)
        {
            //获取状态
            int statu = HdlSafeguardLogic.Current.GetGarrisonInformationPushStatu(this.zoonID) == 0 ? 1 : 0;
 
            //执行修改
            var result = await HdlSafeguardLogic.Current.SetGarrisonInformationPushStatu(this.zoonID, statu);
            if (result == false)
            {
                return;
            }
            Application.RunOnMainThread(() =>
            {
                if (btnswich != null)
                {
                    btnswich.IsSelected = !btnswich.IsSelected;
                }
            });
        }
        #endregion
    }
}