using System; using System.Collections.Generic; using System.Text; namespace Shared.Phone.UserCenter.Safety { /// /// 各防区的设置内容的菜单界面 /// public class SectorsSettionMenuForm : UserCenterCommonForm { /// /// 列表控件 /// private VerticalScrolViewLayout listView = null; /// /// 防区ID /// private int zoonID = 0; /// /// 防区名字 /// private string SectorsName = string.Empty; /// /// 画面显示(底层会固定调用此方法,借以完成画面创建) /// /// 防区名字 /// 防区ID public void ShowForm(string i_SectorsName, int i_zoonID) { this.zoonID = i_zoonID; this.SectorsName = i_SectorsName; //设置头部信息 base.SetTitleText(SectorsName); //初始化中部信息 this.InitMiddleFrame(); } /// /// 初始化中部信息 /// private void InitMiddleFrame() { listView = new VerticalScrolViewLayout(); listView.Height = bodyFrameLayout.Height; bodyFrameLayout.AddChidren(listView); //初始化【传感器设置】行 this.InitSensorSettionRow(); //初始化【报警目标设置】行 this.InitAlarmTargetRow(); //出入防区的时候才显示 if (zoonID == 3) { //初始化【延时设置】行 this.InitDelayedSettionRow(); } //初始化【信息通知】的行 this.InitInformationPushRow(); } /// /// 初始化【传感器设置】行 /// private void InitSensorSettionRow() { var rowLayout = new StatuRowLayout(); listView.AddChidren(rowLayout); //传感器设置 var txName = new RowCenterView(false); txName.TextID = R.MyInternationalizationString.uSensorSettion; rowLayout.AddChidren(txName); rowLayout.AddRightIconControl(); rowLayout.MouseUpEvent += (sender, e) => { var form = new SensorDeviceSettionListForm(); //出入防区 string title = Language.StringByID(R.MyInternationalizationString.uInAndOutSectors); this.AddForm(form, this.SectorsName, this.zoonID); }; } /// /// 初始化【报警目标设置】行 /// private void InitAlarmTargetRow() { var rowLayout = new StatuRowLayout(); listView.AddChidren(rowLayout); //报警目标设置 var txName = new RowCenterView(false); txName.TextID = R.MyInternationalizationString.uAlarmTargetSettion; rowLayout.AddChidren(txName); rowLayout.AddRightIconControl(); rowLayout.MouseUpEvent += (sender, e) => { var form = new AlarmTargetSettionForm(); this.AddForm(form, this.zoonID); }; } /// /// 初始化【延时设置】行 /// private void InitDelayedSettionRow() { var rowLayout = new StatuRowLayout(); listView.AddChidren(rowLayout); //延时设置 var txName = new RowCenterView(false); txName.TextID = R.MyInternationalizationString.uDelayedSettion; rowLayout.AddChidren(txName); rowLayout.AddRightIconControl(); rowLayout.MouseUpEvent += (sender, e) => { var form = new DelayedSettionMainForm(); this.AddForm(form); }; } /// /// 初始化【信息通知】的行 /// /// private void InitInformationPushRow() { var rowLayout = new RowLayout(); rowLayout.Height = ControlCommonResourse.ListViewRowHeight; listView.AddChidren(rowLayout); //信息推送 var txtMsg = new RowCenterView(false); rowLayout.AddChidren(txtMsg); string msg = Language.StringByID(R.MyInternationalizationString.uInformationPush); //if (this.zoonID >= 3) //{ // msg += "(" + Language.StringByID(R.MyInternationalizationString.uOtherSectors) + ")"; //} txtMsg.Text = msg; //开关图标 var btnSwicth = new SwichControl(); rowLayout.AddChidren(btnSwicth); btnSwicth.IsSelected = Common.LocalSafeguard.Current.GetGarrisonInformationPushStatu(this.zoonID) == 0; btnSwicth.MouseUpEventHandler += (sender, e) => { //设置信息通知的状态 this.SetInformationPush(btnSwicth); }; } /// /// 设置信息推送的状态 /// /// private async void SetInformationPush(SwichControl btnswich) { //获取状态 int statu = Common.LocalSafeguard.Current.GetGarrisonInformationPushStatu(this.zoonID) == 0 ? 1 : 0; //执行修改 var result = await Common.LocalSafeguard.Current.SetGarrisonInformationPushStatu(this.zoonID, statu); if (result == false) { return; } Application.RunOnMainThread(() => { btnswich.IsSelected = !btnswich.IsSelected; }); } } }