old mode 100755
new mode 100644
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | |
|
| | | namespace Shared.Phone.UserCenter
|
| | | {
|
| | | /// <summary>
|
| | | /// 安防管理主页的控件
|
| | | /// </summary>
|
| | | public class SafetyMasterControl : FrameLayout
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 在家布防
|
| | | /// </summary>
|
| | | private GarrisonControl btnAthomeGarrison = null;
|
| | | /// <summary>
|
| | | /// 离家布防
|
| | | /// </summary>
|
| | | private GarrisonControl btnRemovehomeGarrison = null;
|
| | | /// <summary>
|
| | | /// 撤防
|
| | | /// </summary>
|
| | | private GarrisonControl btnReGarrisonGarrison = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化
|
| | | /// </summary>
|
| | | public SafetyMasterControl()
|
| | | {
|
| | | this.Gravity = Gravity.CenterHorizontal;
|
| | | this.Width = Application.GetRealWidth(964);
|
| | | this.Height = Application.GetRealHeight(340);
|
| | | this.Radius = (uint)Application.GetMinRealAverage(20);
|
| | | this.BackgroundColor = UserCenterColor.Current.White;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化控件
|
| | | /// </summary>
|
| | | public void InitControl()
|
| | | {
|
| | | this.btnAthomeGarrison = null;
|
| | | this.btnReGarrisonGarrison = null;
|
| | | this.btnRemovehomeGarrison = null;
|
| | |
|
| | | //右上圆角背景
|
| | | var btnTopRight = new NormalViewControl(50, 50, true);
|
| | | btnTopRight.BackgroundColor = UserCenterColor.Current.White;
|
| | | btnTopRight.Radius = (uint)Application.GetMinRealAverage(6);
|
| | | this.AddChidren(btnTopRight);
|
| | | btnTopRight.X = this.Width - btnTopRight.Width;
|
| | |
|
| | | //左下圆角背景
|
| | | var btnBottomRight = new NormalViewControl(50, 50, true);
|
| | | btnBottomRight.BackgroundColor = UserCenterColor.Current.White;
|
| | | btnBottomRight.Radius = (uint)Application.GetMinRealAverage(6);
|
| | | this.AddChidren(btnBottomRight);
|
| | | btnBottomRight.Y = this.Height - btnBottomRight.Height;
|
| | |
|
| | | //设置有内部防区
|
| | | if (HdlSafeguardLogic.Current.IsHadInternalDefenseArea() == true)
|
| | | {
|
| | | //在家布防
|
| | | btnAthomeGarrison = new GarrisonControl();
|
| | | this.AddChidren(btnAthomeGarrison);
|
| | | btnAthomeGarrison.InitControl(GarrisonMode.AtHome);
|
| | | btnAthomeGarrison.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (btnAthomeGarrison.btnIcon.IsSelected == false)
|
| | | {
|
| | | this.SetSafetyGarrisonModeInAtHome();
|
| | | }
|
| | | };
|
| | | //离家布防
|
| | | btnRemovehomeGarrison = new GarrisonControl();
|
| | | btnRemovehomeGarrison.X = btnAthomeGarrison.Right + Application.GetRealWidth(32);
|
| | | this.AddChidren(btnRemovehomeGarrison);
|
| | | btnRemovehomeGarrison.InitControl(GarrisonMode.RemoveHome);
|
| | | btnRemovehomeGarrison.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (btnRemovehomeGarrison.btnIcon.IsSelected == false)
|
| | | {
|
| | | this.SetSafetyGarrisonModeInRemoveHome();
|
| | | }
|
| | | };
|
| | | //撤防
|
| | | btnReGarrisonGarrison = new GarrisonControl();
|
| | | btnReGarrisonGarrison.X = btnRemovehomeGarrison.Right + Application.GetRealWidth(32);
|
| | | this.AddChidren(btnReGarrisonGarrison);
|
| | | btnReGarrisonGarrison.InitControl(GarrisonMode.RemoveGarrison);
|
| | | btnReGarrisonGarrison.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | this.RemoveSafetyGarrisonMode();
|
| | | };
|
| | | }
|
| | | else
|
| | | {
|
| | | //布防
|
| | | btnAthomeGarrison = new GarrisonControl();
|
| | | btnAthomeGarrison.X = Application.GetRealWidth(166);
|
| | | this.AddChidren(btnAthomeGarrison);
|
| | | btnAthomeGarrison.InitControl(GarrisonMode.AtHome);
|
| | | btnAthomeGarrison.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | if (btnAthomeGarrison.btnIcon.IsSelected == false)
|
| | | {
|
| | | this.SetSafetyGarrisonModeInAtHome();
|
| | | }
|
| | | };
|
| | | //撤防
|
| | | btnReGarrisonGarrison = new GarrisonControl();
|
| | | btnReGarrisonGarrison.X = btnAthomeGarrison.Right + Application.GetRealWidth(32);
|
| | | this.AddChidren(btnReGarrisonGarrison);
|
| | | btnReGarrisonGarrison.InitControl(GarrisonMode.RemoveGarrison);
|
| | | btnReGarrisonGarrison.ButtonClickEvent += (sender, e) =>
|
| | | {
|
| | | this.RemoveSafetyGarrisonMode();
|
| | | };
|
| | | }
|
| | | //根据布防模式,设置图标的选择状态
|
| | | this.SetIconStatuByGarrisonMode(HdlSafeguardLogic.Current.NowGarrisonMode);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | |
| | | namespace Shared.Phone.UserCenter |
| | | { |
| | | /// <summary> |
| | | /// 安防管理主页的控件 |
| | | /// </summary> |
| | | public class SafetyMasterControl : NormalFrameLayout |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 在家布防 |
| | | /// </summary> |
| | | private GarrisonControl btnAthomeGarrison = null; |
| | | /// <summary> |
| | | /// 离家布防 |
| | | /// </summary> |
| | | private GarrisonControl btnRemovehomeGarrison = null; |
| | | /// <summary> |
| | | /// 撤防 |
| | | /// </summary> |
| | | private GarrisonControl btnReGarrisonGarrison = null; |
| | | /// <summary> |
| | | /// 桌布控件 |
| | | /// </summary> |
| | | private FrameLayout frameTable = null; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 初始化 |
| | | /// </summary> |
| | | public SafetyMasterControl() |
| | | { |
| | | this.Gravity = Gravity.CenterHorizontal; |
| | | this.Width = Application.GetRealWidth(964); |
| | | this.Height = Application.GetRealHeight(340); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化控件 |
| | | /// </summary> |
| | | public void InitControl() |
| | | { |
| | | this.btnAthomeGarrison = null; |
| | | this.btnReGarrisonGarrison = null; |
| | | this.btnRemovehomeGarrison = null; |
| | | |
| | | this.frameTable = new FrameLayout(); |
| | | frameTable.Height = this.Height; |
| | | frameTable.Width = this.Width; |
| | | frameTable.Radius = (uint)Application.GetRealHeight(58); |
| | | frameTable.BackgroundColor = UserCenterColor.Current.White; |
| | | this.AddChidren(frameTable); |
| | | |
| | | //右上圆角背景 |
| | | var btnTopRight = new NormalViewControl(150, 60, true); |
| | | btnTopRight.BackgroundColor = UserCenterColor.Current.White; |
| | | btnTopRight.RadiusEx = 17; |
| | | this.AddChidren(btnTopRight); |
| | | btnTopRight.X = this.Width - btnTopRight.Width; |
| | | |
| | | //左下圆角背景 |
| | | var btnBottomRight = new NormalViewControl(150, 60, true); |
| | | btnBottomRight.BackgroundColor = UserCenterColor.Current.White; |
| | | btnBottomRight.RadiusEx = 17; |
| | | this.AddChidren(btnBottomRight); |
| | | btnBottomRight.Y = this.Height - btnBottomRight.Height; |
| | | |
| | | //设置有内部防区 |
| | | if (HdlSafeguardLogic.Current.IsHadInternalDefenseArea() == true) |
| | | { |
| | | //在家布防 |
| | | btnAthomeGarrison = new GarrisonControl(); |
| | | frameTable.AddChidren(btnAthomeGarrison); |
| | | btnAthomeGarrison.InitControl(GarrisonMode.AtHome); |
| | | btnAthomeGarrison.ButtonClickEvent += (sender, e) => |
| | | { |
| | | if (btnAthomeGarrison.btnIcon.IsSelected == false) |
| | | { |
| | | this.SetSafetyGarrisonModeInAtHome(); |
| | | } |
| | | }; |
| | | //离家布防 |
| | | btnRemovehomeGarrison = new GarrisonControl(); |
| | | btnRemovehomeGarrison.X = btnAthomeGarrison.Right + Application.GetRealWidth(32); |
| | | frameTable.AddChidren(btnRemovehomeGarrison); |
| | | btnRemovehomeGarrison.InitControl(GarrisonMode.RemoveHome); |
| | | btnRemovehomeGarrison.ButtonClickEvent += (sender, e) => |
| | | { |
| | | if (btnRemovehomeGarrison.btnIcon.IsSelected == false) |
| | | { |
| | | this.SetSafetyGarrisonModeInRemoveHome(); |
| | | } |
| | | }; |
| | | //撤防 |
| | | btnReGarrisonGarrison = new GarrisonControl(); |
| | | btnReGarrisonGarrison.X = btnRemovehomeGarrison.Right + Application.GetRealWidth(32); |
| | | frameTable.AddChidren(btnReGarrisonGarrison); |
| | | btnReGarrisonGarrison.InitControl(GarrisonMode.RemoveGarrison); |
| | | btnReGarrisonGarrison.ButtonClickEvent += (sender, e) => |
| | | { |
| | | this.RemoveSafetyGarrisonMode(); |
| | | }; |
| | | } |
| | | else |
| | | { |
| | | //布防 |
| | | btnAthomeGarrison = new GarrisonControl(); |
| | | btnAthomeGarrison.X = Application.GetRealWidth(166); |
| | | frameTable.AddChidren(btnAthomeGarrison); |
| | | btnAthomeGarrison.InitControl(GarrisonMode.AtHome); |
| | | btnAthomeGarrison.ButtonClickEvent += (sender, e) => |
| | | { |
| | | if (btnAthomeGarrison.btnIcon.IsSelected == false) |
| | | { |
| | | this.SetSafetyGarrisonModeInAtHome(); |
| | | } |
| | | }; |
| | | //撤防 |
| | | btnReGarrisonGarrison = new GarrisonControl(); |
| | | btnReGarrisonGarrison.X = btnAthomeGarrison.Right + Application.GetRealWidth(32); |
| | | frameTable.AddChidren(btnReGarrisonGarrison); |
| | | btnReGarrisonGarrison.InitControl(GarrisonMode.RemoveGarrison); |
| | | btnReGarrisonGarrison.ButtonClickEvent += (sender, e) => |
| | | { |
| | | this.RemoveSafetyGarrisonMode(); |
| | | }; |
| | | } |
| | | //根据布防模式,设置图标的选择状态 |
| | | this.SetIconStatuByGarrisonMode(HdlSafeguardLogic.Current.NowGarrisonMode); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 布防撤防___________________________ |
| | |
|
| | | /// <summary>
|
| | | /// 在家布防
|
| | | /// </summary> |
| | | private async void SetSafetyGarrisonModeInAtHome()
|
| | | {
|
| | | //打开进度条
|
| | | ProgressBar.Show(string.Empty);
|
| | | //在家布防
|
| | | GarrisonMode mode = await HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.AtHome);
|
| | | //关闭进度条
|
| | | ProgressBar.Close();
|
| | | if (mode == GarrisonMode.None)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | //根据布防模式,设置图标的选择状态
|
| | | this.SetIconStatuByGarrisonMode(mode);
|
| | | if (mode == GarrisonMode.RemoveGarrison)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | //如果设置有内部防区
|
| | | string msg = string.Empty;
|
| | | if (HdlSafeguardLogic.Current.IsHadInternalDefenseArea() == true)
|
| | | |
| | | {
|
| | | //在家布防设置成功
|
| | | msg = Language.StringByID(R.MyInternationalizationString.uSetAtHomeGarrisonSuccess);
|
| | | }
|
| | | else
|
| | | {
|
| | | //布防设置成功
|
| | | msg = Language.StringByID(R.MyInternationalizationString.uSetGarrisonSuccess);
|
| | | }
|
| | |
|
| | | if (UserCenterResourse.DicActionForm.ContainsKey("SafetyManagementMainForm") == true)
|
| | | {
|
| | | //添加布防上报的行控件
|
| | | var form = (Safety.SafetyManagementMainForm)UserCenterResourse.DicActionForm["SafetyManagementMainForm"];
|
| | | form?.AddSafeguardLogPushRow(null);
|
| | | }
|
| | | else
|
| | | {
|
| | | var control = new ShowMsgControl(ShowMsgType.Tip, msg);
|
| | | control.Show();
|
| | | }
|
| | | });
|
| | | /// <summary> |
| | | /// 在家布防 |
| | | /// </summary> |
| | | private async void SetSafetyGarrisonModeInAtHome() |
| | | { |
| | | //打开进度条 |
| | | ProgressBar.Show(string.Empty); |
| | | //在家布防 |
| | | GarrisonMode mode = await HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.AtHome); |
| | | //关闭进度条 |
| | | ProgressBar.Close(); |
| | | if (mode == GarrisonMode.None) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | //根据布防模式,设置图标的选择状态 |
| | | this.SetIconStatuByGarrisonMode(mode); |
| | | if (mode == GarrisonMode.RemoveGarrison) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | //如果设置有内部防区 |
| | | string msg = string.Empty; |
| | | if (HdlSafeguardLogic.Current.IsHadInternalDefenseArea() == true) |
| | | { |
| | | //在家布防设置成功 |
| | | msg = Language.StringByID(R.MyInternationalizationString.uSetAtHomeGarrisonSuccess); |
| | | } |
| | | else |
| | | { |
| | | //布防设置成功 |
| | | msg = Language.StringByID(R.MyInternationalizationString.uSetGarrisonSuccess); |
| | | } |
| | | var control = new ShowMsgControl(ShowMsgType.Tip, msg); |
| | | control.Show(); |
| | | }); |
| | | } |
| | | |
| | | /// <summary>
|
| | | /// 离家布防
|
| | | /// <summary> |
| | | /// 离家布防 |
| | | /// </summary> |
| | | private async void SetSafetyGarrisonModeInRemoveHome()
|
| | | {
|
| | | //打开进度条
|
| | | ProgressBar.Show(string.Empty);
|
| | | //离家布防
|
| | | GarrisonMode mode = await HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.RemoveHome);
|
| | | //关闭进度条
|
| | | ProgressBar.Close();
|
| | |
|
| | | if (mode == GarrisonMode.None)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | //根据布防模式,设置图标的选择状态
|
| | | this.SetIconStatuByGarrisonMode(mode);
|
| | | if (mode == GarrisonMode.RemoveGarrison)
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (UserCenterResourse.DicActionForm.ContainsKey("SafetyManagementMainForm") == true)
|
| | | {
|
| | | //添加布防上报的行控件
|
| | | var form = (Safety.SafetyManagementMainForm)UserCenterResourse.DicActionForm["SafetyManagementMainForm"];
|
| | | form?.AddSafeguardLogPushRow(null);
|
| | | }
|
| | | else
|
| | | {
|
| | | //离家布防设置成功
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetRemoveHomeGarrisonSuccess);
|
| | | var control = new ShowMsgControl(ShowMsgType.Tip, msg);
|
| | | control.Show();
|
| | | }
|
| | | });
|
| | | private async void SetSafetyGarrisonModeInRemoveHome() |
| | | { |
| | | //打开进度条 |
| | | ProgressBar.Show(string.Empty); |
| | | //离家布防 |
| | | GarrisonMode mode = await HdlSafeguardLogic.Current.SetSafetyGarrisonByModel(GarrisonMode.RemoveHome); |
| | | //关闭进度条 |
| | | ProgressBar.Close(); |
| | | |
| | | if (mode == GarrisonMode.None) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | //根据布防模式,设置图标的选择状态 |
| | | this.SetIconStatuByGarrisonMode(mode); |
| | | if (mode == GarrisonMode.RemoveGarrison) |
| | | { |
| | | return; |
| | | } |
| | | //离家布防设置成功 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uSetRemoveHomeGarrisonSuccess); |
| | | var control = new ShowMsgControl(ShowMsgType.Tip, msg); |
| | | control.Show(); |
| | | }); |
| | | } |
| | | |
| | | /// <summary>
|
| | | /// 撤防
|
| | | /// <summary> |
| | | /// 撤防 |
| | | /// </summary> |
| | | private async void RemoveSafetyGarrisonMode()
|
| | | {
|
| | | //打开进度条
|
| | | ProgressBar.Show(string.Empty);
|
| | | //撤防
|
| | | var result = await HdlSafeguardLogic.Current.RemoveSafetyGarrison(GarrisonMode.RemoveGarrison, false);
|
| | | //关闭进度条
|
| | | ProgressBar.Close();
|
| | |
|
| | | if (result == -1)
|
| | | {
|
| | | return;
|
| | | }
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | //根据布防模式,设置图标的选择状态
|
| | | this.SetIconStatuByGarrisonMode(GarrisonMode.RemoveGarrison);
|
| | |
|
| | | if (UserCenterResourse.DicActionForm.ContainsKey("SafetyManagementMainForm") == true)
|
| | | {
|
| | | //添加布防上报的行控件
|
| | | var form = (Safety.SafetyManagementMainForm)UserCenterResourse.DicActionForm["SafetyManagementMainForm"];
|
| | | form?.AddSafeguardLogPushRow(null);
|
| | | }
|
| | | else
|
| | | {
|
| | | //离家布防设置成功
|
| | | string msg = Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonSuccess);
|
| | | var control = new ShowMsgControl(ShowMsgType.Tip, msg);
|
| | | control.Show();
|
| | | }
|
| | | });
|
| | | private async void RemoveSafetyGarrisonMode() |
| | | { |
| | | //打开进度条 |
| | | ProgressBar.Show(string.Empty); |
| | | //撤防 |
| | | var result = await HdlSafeguardLogic.Current.RemoveSafetyGarrison(GarrisonMode.RemoveGarrison, false); |
| | | //关闭进度条 |
| | | ProgressBar.Close(); |
| | | |
| | | if (result == -1) |
| | | { |
| | | return; |
| | | } |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | //根据布防模式,设置图标的选择状态 |
| | | this.SetIconStatuByGarrisonMode(GarrisonMode.RemoveGarrison); |
| | | |
| | | //离家布防设置成功 |
| | | string msg = Language.StringByID(R.MyInternationalizationString.uRemoveGarrisonSuccess); |
| | | var control = new ShowMsgControl(ShowMsgType.Tip, msg); |
| | | control.Show(); |
| | | }); |
| | | } |
| | | |
| | | /// <summary>
|
| | | /// 根据布防模式,设置图标的选择状态
|
| | | /// </summary>
|
| | | /// <summary> |
| | | /// 根据布防模式,设置图标的选择状态 |
| | | /// </summary> |
| | | /// <param name="mode"></param> |
| | | public void SetIconStatuByGarrisonMode(GarrisonMode mode)
|
| | | {
|
| | | //在家布防
|
| | | if (mode == GarrisonMode.AtHome)
|
| | | {
|
| | | this.btnAthomeGarrison?.SetActionStatu(true);
|
| | | this.btnRemovehomeGarrison?.SetActionStatu(false);
|
| | | this.btnReGarrisonGarrison?.SetActionStatu(false);
|
| | | }
|
| | | //离家布防
|
| | | else if (mode == GarrisonMode.RemoveHome)
|
| | | {
|
| | | this.btnAthomeGarrison?.SetActionStatu(false);
|
| | | this.btnRemovehomeGarrison?.SetActionStatu(true);
|
| | | this.btnReGarrisonGarrison?.SetActionStatu(false);
|
| | | }
|
| | | //撤防 |
| | | else
|
| | | {
|
| | | this.btnAthomeGarrison?.SetActionStatu(false);
|
| | | this.btnRemovehomeGarrison?.SetActionStatu(false);
|
| | | this.btnReGarrisonGarrison?.SetActionStatu(true);
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 设置布防按钮的可视状态
|
| | | public void SetIconStatuByGarrisonMode(GarrisonMode mode) |
| | | { |
| | | //在家布防 |
| | | if (mode == GarrisonMode.AtHome) |
| | | { |
| | | this.btnAthomeGarrison?.SetActionStatu(true); |
| | | this.btnRemovehomeGarrison?.SetActionStatu(false); |
| | | this.btnReGarrisonGarrison?.SetActionStatu(false); |
| | | } |
| | | //离家布防 |
| | | else if (mode == GarrisonMode.RemoveHome) |
| | | { |
| | | this.btnAthomeGarrison?.SetActionStatu(false); |
| | | this.btnRemovehomeGarrison?.SetActionStatu(true); |
| | | this.btnReGarrisonGarrison?.SetActionStatu(false); |
| | | } |
| | | //撤防 |
| | | else |
| | | { |
| | | this.btnAthomeGarrison?.SetActionStatu(false); |
| | | this.btnRemovehomeGarrison?.SetActionStatu(false); |
| | | this.btnReGarrisonGarrison?.SetActionStatu(true); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 设置布防按钮的可视状态 |
| | | /// </summary> |
| | | public void SetButtonVisible()
|
| | | {
|
| | | //设置有内部防区
|
| | | if (HdlSafeguardLogic.Current.IsHadInternalDefenseArea() == true
|
| | | && btnRemovehomeGarrison != null)
|
| | | {
|
| | | //没必要再初始化界面
|
| | | return;
|
| | | }
|
| | | Application.RunOnMainThread(() =>
|
| | | {
|
| | | //清空全部控件
|
| | | this.RemoveAll();
|
| | | //重新初始化控件
|
| | | this.InitControl();
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 封装控件___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 封装的布防控件
|
| | | /// </summary>
|
| | | private class GarrisonControl : FrameLayoutControl
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 背景控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnBack = null;
|
| | | /// <summary>
|
| | | /// 图标控件
|
| | | /// </summary>
|
| | | public IconViewControl btnIcon = null;
|
| | | /// <summary>
|
| | | /// 文本控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnText = null;
|
| | | /// <summary>
|
| | | /// 选择状态的背景色
|
| | | /// </summary>
|
| | | private uint selectBackColor = 0;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 封装的布防控件
|
| | | /// </summary>
|
| | | public GarrisonControl()
|
| | | {
|
| | | //关闭状态显示
|
| | | this.UseClickStatu = false;
|
| | | this.Gravity = Gravity.CenterVertical;
|
| | | this.Width = Application.GetRealWidth(300);
|
| | | this.Height = Application.GetRealHeight(216);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化控件
|
| | | /// </summary>
|
| | | /// <param name="garrison">防区模式</param>
|
| | | public void InitControl(GarrisonMode garrison)
|
| | | {
|
| | | //移除底层事件
|
| | | this.RemoveBaseClickEvent();
|
| | |
|
| | | //背景
|
| | | int backHeight = Application.GetMinRealAverage(132);
|
| | | btnBack = new NormalViewControl(backHeight, backHeight, false);
|
| | | btnBack.Gravity = Gravity.CenterHorizontal;
|
| | | btnBack.Radius = (uint)backHeight;
|
| | | btnBack.BackgroundColor = UserCenterColor.Current.BodyFrameLayout;
|
| | | this.AddChidren(btnBack, ChidrenBindMode.BindEventOnly);
|
| | |
|
| | | //图标
|
| | | btnIcon = new IconViewControl(81);
|
| | | btnIcon.Y = Application.GetRealHeight(26);
|
| | | btnIcon.Gravity = Gravity.CenterHorizontal;
|
| | | this.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly);
|
| | |
|
| | | //文本
|
| | | btnText = new NormalViewControl(this.Width, Application.GetRealHeight(58), false);
|
| | | btnText.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | btnText.Y = Application.GetRealHeight(158);
|
| | | btnText.TextAlignment = TextAlignment.Center;
|
| | | this.AddChidren(btnText, ChidrenBindMode.NotBind);
|
| | |
|
| | | if (garrison == GarrisonMode.AtHome)
|
| | | {
|
| | | this.selectBackColor = 0xffffa200;
|
| | | btnIcon.UnSelectedImagePath = "Safeguard/ProtectionAtHome.png";
|
| | | btnIcon.SelectedImagePath = "Safeguard/ProtectionAtHomeSelected.png";
|
| | |
|
| | | //设置有内部防区
|
| | | if (HdlSafeguardLogic.Current.IsHadInternalDefenseArea() == true)
|
| | | {
|
| | | btnText.TextID = R.MyInternationalizationString.uAtHomeGarrison;
|
| | | }
|
| | | else
|
| | | {
|
| | | btnText.TextID = R.MyInternationalizationString.uGarrison;
|
| | | }
|
| | | }
|
| | | else if (garrison == GarrisonMode.RemoveHome)
|
| | | {
|
| | | this.selectBackColor = 0xff35b87f;
|
| | | btnIcon.UnSelectedImagePath = "Safeguard/ProtectionRemoveHome.png";
|
| | | btnIcon.SelectedImagePath = "Safeguard/ProtectionRemoveHomeSelected.png";
|
| | | btnText.TextID = R.MyInternationalizationString.uRemoveHomeGarrison;
|
| | | }
|
| | | else if (garrison == GarrisonMode.RemoveGarrison)
|
| | | {
|
| | | this.selectBackColor = 0xff4a90e2;
|
| | | btnIcon.UnSelectedImagePath = "Safeguard/WithdrawGarrison.png";
|
| | | btnIcon.SelectedImagePath = "Safeguard/WithdrawGarrisonSelected.png";
|
| | | btnText.TextID = R.MyInternationalizationString.uWithdrawGarrison;
|
| | | }
|
| | | }
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 设置控件的激活状态
|
| | | /// </summary>
|
| | | /// <param name="actionStatu">设置控件的激活状态 true:激活状态(选中) false:非激活状态</param>
|
| | | public void SetActionStatu(bool actionStatu)
|
| | | {
|
| | | if (actionStatu == true)
|
| | | {
|
| | | btnIcon.IsSelected = true;
|
| | | btnBack.BackgroundColor = selectBackColor;
|
| | | btnText.TextColor = selectBackColor;
|
| | | }
|
| | | else
|
| | | {
|
| | | btnIcon.IsSelected = false;
|
| | | btnBack.BackgroundColor = UserCenterColor.Current.BodyFrameLayout;
|
| | | btnText.TextColor = UserCenterColor.Current.TextGrayColor3;
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|
| | | public void SetButtonVisible() |
| | | { |
| | | //设置有内部防区 |
| | | if (HdlSafeguardLogic.Current.IsHadInternalDefenseArea() == true |
| | | && btnRemovehomeGarrison != null) |
| | | { |
| | | //没必要再初始化界面 |
| | | return; |
| | | } |
| | | HdlThreadLogic.Current.RunMain(() => |
| | | { |
| | | //清空全部控件 |
| | | this.RemoveAll(); |
| | | //重新初始化控件 |
| | | this.InitControl(); |
| | | }); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 封装控件___________________________ |
| | | |
| | | /// <summary> |
| | | /// 封装的布防控件 |
| | | /// </summary> |
| | | private class GarrisonControl : FrameLayoutStatuControl |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 背景控件 |
| | | /// </summary> |
| | | private NormalViewControl btnBack = null; |
| | | /// <summary> |
| | | /// 图标控件 |
| | | /// </summary> |
| | | public IconViewControl btnIcon = null; |
| | | /// <summary> |
| | | /// 文本控件 |
| | | /// </summary> |
| | | private NormalViewControl btnText = null; |
| | | /// <summary> |
| | | /// 选择状态的背景色 |
| | | /// </summary> |
| | | private uint selectBackColor = 0; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 封装的布防控件 |
| | | /// </summary> |
| | | public GarrisonControl() |
| | | { |
| | | //关闭状态显示 |
| | | this.UseClickStatu = false; |
| | | this.Gravity = Gravity.CenterVertical; |
| | | this.Width = Application.GetRealWidth(300); |
| | | this.Height = Application.GetRealHeight(216); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化控件 |
| | | /// </summary> |
| | | /// <param name="garrison">防区模式</param> |
| | | public void InitControl(GarrisonMode garrison) |
| | | { |
| | | //移除底层事件 |
| | | this.RemoveBaseClickEvent(); |
| | | |
| | | //背景 |
| | | int backHeight = this.GetPictrueRealSize(132); |
| | | btnBack = new NormalViewControl(backHeight, backHeight, false); |
| | | btnBack.Gravity = Gravity.CenterHorizontal; |
| | | btnBack.Radius = (uint)backHeight / 2; |
| | | btnBack.BackgroundColor = UserCenterColor.Current.BodyFrameLayout; |
| | | this.AddChidren(btnBack, ChidrenBindMode.BindEvent); |
| | | |
| | | //图标 |
| | | btnIcon = new IconViewControl(81); |
| | | btnIcon.Y = Application.GetRealHeight(26); |
| | | btnIcon.Gravity = Gravity.CenterHorizontal; |
| | | this.AddChidren(btnIcon, ChidrenBindMode.BindEvent); |
| | | |
| | | //文本 |
| | | btnText = new NormalViewControl(this.Width, Application.GetRealHeight(58), false); |
| | | btnText.TextColor = UserCenterColor.Current.TextGrayColor3; |
| | | btnText.Y = Application.GetRealHeight(158); |
| | | btnText.TextAlignment = TextAlignment.Center; |
| | | this.AddChidren(btnText, ChidrenBindMode.NotBind); |
| | | |
| | | if (garrison == GarrisonMode.AtHome) |
| | | { |
| | | this.selectBackColor = 0xffffa200; |
| | | btnIcon.UnSelectedImagePath = "Safeguard/ProtectionAtHome.png"; |
| | | btnIcon.SelectedImagePath = "Safeguard/ProtectionAtHomeSelected.png"; |
| | | |
| | | //设置有内部防区 |
| | | if (HdlSafeguardLogic.Current.IsHadInternalDefenseArea() == true) |
| | | { |
| | | btnText.TextID = R.MyInternationalizationString.uAtHomeGarrison; |
| | | } |
| | | else |
| | | { |
| | | btnText.TextID = R.MyInternationalizationString.uGarrison; |
| | | } |
| | | } |
| | | else if (garrison == GarrisonMode.RemoveHome) |
| | | { |
| | | this.selectBackColor = 0xff35b87f; |
| | | btnIcon.UnSelectedImagePath = "Safeguard/ProtectionRemoveHome.png"; |
| | | btnIcon.SelectedImagePath = "Safeguard/ProtectionRemoveHomeSelected.png"; |
| | | btnText.TextID = R.MyInternationalizationString.uRemoveHomeGarrison; |
| | | } |
| | | else if (garrison == GarrisonMode.RemoveGarrison) |
| | | { |
| | | this.selectBackColor = 0xff4a90e2; |
| | | btnIcon.UnSelectedImagePath = "Safeguard/WithdrawGarrison.png"; |
| | | btnIcon.SelectedImagePath = "Safeguard/WithdrawGarrisonSelected.png"; |
| | | btnText.TextID = R.MyInternationalizationString.uWithdrawGarrison; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 设置控件的激活状态 |
| | | /// </summary> |
| | | /// <param name="actionStatu">设置控件的激活状态 true:激活状态(选中) false:非激活状态</param> |
| | | public void SetActionStatu(bool actionStatu) |
| | | { |
| | | if (actionStatu == true) |
| | | { |
| | | btnIcon.IsSelected = true; |
| | | btnBack.BackgroundColor = selectBackColor; |
| | | btnText.TextColor = selectBackColor; |
| | | } |
| | | else |
| | | { |
| | | btnIcon.IsSelected = false; |
| | | btnBack.BackgroundColor = UserCenterColor.Current.BodyFrameLayout; |
| | | btnText.TextColor = UserCenterColor.Current.TextGrayColor3; |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |