| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | | namespace HDL_ON.UI.UI2.FuntionControlView.ArmCenter |
| | | namespace HDL_ON.UI |
| | | { |
| | | public class ArmCenterPage : FrameLayout |
| | | { |
| | | /// <summary> |
| | | /// 主窗体 |
| | | /// </summary> |
| | | FrameLayout bodyView; |
| | | public static ArmCenterPage bodyView; |
| | | /// <summary> |
| | | /// 自定义布防区域 |
| | | /// </summary> |
| | | HorizontalScrolViewLayout customDeploymentView; |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | FrameLayout alarmIconBgView; |
| | | //安防状态背景图 |
| | | Button btnArmTipIcon; |
| | | /// <summary> |
| | | /// 安防警报图标 |
| | | /// </summary> |
| | | Button btnInalarmIcon; |
| | | /// <summary> |
| | | /// 当前布防名称 |
| | | /// </summary> |
| | | Button btnDefenseName; |
| | | |
| | | /// <summary> |
| | | /// 撤防区域 |
| | | /// </summary> |
| | | FrameLayout disarmView; |
| | | |
| | | /// <summary> |
| | | /// 布防接口 |
| | | /// </summary> |
| | | SecurityAlarm InDefenseMode = null; |
| | | /// <summary> |
| | | /// 自定义布防控件列表 |
| | | /// </summary> |
| | | List<ArmDiyView> armDiyViewList = new List<ArmDiyView>(); |
| | | |
| | | |
| | | Action refreshAction = null; |
| | | |
| | | public ArmCenterPage(Action action) |
| | | { |
| | | refreshAction = action; |
| | | bodyView = this; |
| | | } |
| | | public ArmCenterPage() |
| | | { |
| | | bodyView = this; |
| | | } |
| | | |
| | | public void LoadPage() |
| | | public void LoadPage(bool addNav = true) |
| | | { |
| | | Action skipAction = () => { |
| | | |
| | | }; |
| | | |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.Setting)).LoadTopView_ArmCenter(skipAction); |
| | | |
| | | if (addNav) |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.SecurityCenter)).LoadTopView_ArmCenter(skipAction); |
| | | } |
| | | VerticalScrolViewLayout contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Height = Application.GetRealHeight(603), |
| | | Y = addNav? Application.GetRealHeight(64):0, |
| | | Height = Application.GetRealHeight(667 - 64), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | ScrollEnabled = false, |
| | | }; |
| | |
| | | Height =Application.GetRealWidth(32), |
| | | }); |
| | | |
| | | //安防状态背景图 |
| | | Button btnArmTipIcon = new Button() |
| | | alarmIconBgView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(198), |
| | | Height = Application.GetRealWidth(198), |
| | | }; |
| | | contentView.AddChidren(alarmIconBgView); |
| | | |
| | | btnArmTipIcon = new Button() |
| | | { |
| | | //Gravity = Gravity.CenterHorizontal, |
| | | //Width = Application.GetRealWidth(198), |
| | | //Height = Application.GetRealWidth(198), |
| | | UnSelectedImagePath = "FunctionIcon/ArmCenter/NoDefenseBigIcon.png", |
| | | SelectedImagePath = "FunctionIcon/ArmCenter/InDefenseBigIcon.png", |
| | | }; |
| | | contentView.AddChidren(btnArmTipIcon); |
| | | alarmIconBgView.AddChidren(btnArmTipIcon); |
| | | |
| | | btnInalarmIcon = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(198), |
| | | Height = Application.GetRealWidth(198), |
| | | UnSelectedImagePath = "FunctionIcon/ArmCenter/InAlarmBigIcon.png", |
| | | }; |
| | | btnInalarmIcon.MouseUpEventHandler = (sender, e) => { |
| | | if(InDefenseMode!= null) |
| | | { |
| | | Action action = () => |
| | | { |
| | | InDefenseMode.alarm = false; |
| | | Control.Ins.ControlSecurity(InDefenseMode, "enable"); |
| | | }; |
| | | new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.ClearTheSecurityAlarmTip, action); |
| | | |
| | | } |
| | | }; |
| | | |
| | | btnDefenseName = new Button() |
| | | { |
| | | Y = Application.GetRealWidth(117), |
| | | Height = Application.GetRealHeight(81), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | alarmIconBgView.AddChidren(btnDefenseName); |
| | | |
| | | contentView.AddChidren(new Button() |
| | | { |
| | | Height = Application.GetRealWidth(16), |
| | | }); |
| | | |
| | | |
| | | #region 撤防区域 |
| | | Button btnDisarm; |
| | | disarmView = new FrameLayout() |
| | | { |
| | | Height = 0, |
| | | }; |
| | | contentView.AddChidren(disarmView); |
| | | |
| | | btnDisarm = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(10), |
| | | Width = Application.GetRealWidth(148), |
| | | Height = Application.GetRealHeight(40), |
| | | BackgroundColor = CSS_Color.MainColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | TextID = StringId.chefang,// = "撤防", |
| | | Radius = (uint)Application.GetRealWidth(20), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | }; |
| | | disarmView.AddChidren(btnDisarm); |
| | | |
| | | btnDisarm.MouseUpEventHandler = (sender, e) => { |
| | | if(InDefenseMode!= null) |
| | | { |
| | | Control.Ins.ControlSecurity(InDefenseMode, "disable"); |
| | | } |
| | | }; |
| | | |
| | | #endregion |
| | | |
| | | #region 自定义布防 |
| | | //自定义布防标题 |
| | | Button btnCustomDeploymentTitle = new Button() |
| | | { |
| | |
| | | }; |
| | | contentView.AddChidren(btnCustomDeploymentTitle); |
| | | |
| | | HorizontalScrolViewLayout customDeploymentView = new HorizontalScrolViewLayout() |
| | | customDeploymentView = new HorizontalScrolViewLayout() |
| | | { |
| | | X = Application.GetRealWidth(23), |
| | | Height = Application.GetRealWidth(80), |
| | | ScrollEnabled = false, |
| | | }; |
| | | contentView.AddChidren(customDeploymentView); |
| | | |
| | | |
| | | #endregion |
| | | |
| | | contentView.AddChidren(new Button() |
| | | { |
| | | Height = Application.GetRealHeight(20), |
| | | }); |
| | | |
| | | |
| | | |
| | | #region 固定布防区域 |
| | | /* |
| | | var fixedDeploymentView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(133), |
| | | }; |
| | | contentView.AddChidren(fixedDeploymentView); |
| | | |
| | | Button btnFixedDeploymentTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(24), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | IsBold = true, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextID = StringId.FixedDeployment, |
| | | }; |
| | | fixedDeploymentView.AddChidren(btnFixedDeploymentTitle); |
| | | |
| | | Button btnFixedDeploymentTip = new Button() |
| | | { |
| | | X = Application.GetRealWidth(24), |
| | | Y = btnFixedDeploymentTitle.Bottom, |
| | | Height = Application.GetRealWidth(19), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextColor = CSS_Color.MainColor, |
| | | TextID = StringId.UndoDefenseDoesNotAffect |
| | | }; |
| | | fixedDeploymentView.AddChidren(btnFixedDeploymentTip); |
| | | |
| | | var fixedDeploymentTypeView = new HorizontalScrolViewLayout() |
| | | { |
| | | Y = btnFixedDeploymentTip.Bottom + Application.GetRealHeight(15), |
| | | Height = Application.GetRealHeight(80), |
| | | ScrollEnabled = false, |
| | | }; |
| | | fixedDeploymentView.AddChidren(fixedDeploymentTypeView); |
| | | |
| | | fixedDeploymentTypeView.AddChidren(new Button() |
| | | { |
| | | Width = Application.GetRealWidth(24), |
| | | }); |
| | | |
| | | |
| | | |
| | | //灾害报警 |
| | | var disasterAlarmView = new FixedArmView("FunctionIcon/ArmCenter/DisasterAlarmIcon.png", Language.StringByID(StringId.DisasterDefense), Language.StringByID(StringId.Defense24Hour)); |
| | | EventHandler<MouseEventArgs> disasterAlarmViewClick = (sender, e) => { |
| | | var disasterAlarm = FunctionList.List.securities.Find((obj) => obj.type == "all_day"); |
| | | if (disasterAlarm == null) |
| | | { |
| | | disasterAlarm = new SecurityAlarm() { name = "alldaydefense", type = "all_day" }; |
| | | } |
| | | else |
| | | { |
| | | disasterAlarm = disasterAlarm.RefeshData(); |
| | | } |
| | | var addDefensePage = new AddAlarmDeploymentPage(disasterAlarm, null); |
| | | MainPage.BasePageView.AddChidren(addDefensePage); |
| | | addDefensePage.LoadPage(Language.StringByID(StringId.DisasterDefense)); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | disasterAlarmView.SetClick(disasterAlarmViewClick); |
| | | fixedDeploymentTypeView.AddChidren(disasterAlarmView); |
| | | |
| | | fixedDeploymentTypeView.AddChidren(new Button() |
| | | { |
| | | Width = Application.GetRealWidth(30), |
| | | }); |
| | | |
| | | //防盗报警 |
| | | var burglarAlarmView = new FixedArmView("FunctionIcon/ArmCenter/BurglarAlarmIcon.png", Language.StringByID(StringId.BurglarAlarm), Language.StringByID(StringId.AlarmMute)); |
| | | EventHandler<MouseEventArgs> burglarAlarmViewClick = (sender, e) => { |
| | | var burglarAlarm = FunctionList.List.securities.Find((obj) => obj.type == "mute"); |
| | | if (burglarAlarm == null) |
| | | { |
| | | burglarAlarm = new SecurityAlarm() { name = "mutedefense", type = "mute" }; |
| | | } |
| | | else |
| | | { |
| | | burglarAlarm = burglarAlarm.RefeshData(); |
| | | } |
| | | var addDefensePage = new AddAlarmDeploymentPage(burglarAlarm, null); |
| | | MainPage.BasePageView.AddChidren(addDefensePage); |
| | | addDefensePage.LoadPage(Language.StringByID(StringId.BurglarAlarm)); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | disasterAlarmView.SetClick(disasterAlarmViewClick); |
| | | fixedDeploymentTypeView.AddChidren(burglarAlarmView); |
| | | */ |
| | | #endregion |
| | | |
| | | |
| | | iniCustomDeploymentView(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化报警状态 |
| | | /// </summary> |
| | | /// <param name="inAlarm"></param> |
| | | public void InitAlarmStatus(bool inAlarm) |
| | | { |
| | | try |
| | | { |
| | | if (inAlarm) |
| | | { |
| | | if (btnInalarmIcon.Parent == null) |
| | | { |
| | | alarmIconBgView.AddChidren(btnInalarmIcon); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (btnInalarmIcon.Parent != null) |
| | | { |
| | | btnInalarmIcon.RemoveFromParent(); |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化自定义布防区域 |
| | | /// </summary> |
| | | private void iniCustomDeploymentView() |
| | | { |
| | | customDeploymentView.RemoveAll(); |
| | | armDiyViewList.Clear(); |
| | | foreach (var mode in FunctionList.List.securities) |
| | | { |
| | | var armDiyView = new ArmDiyView("FunctionIcon/ArmCenter/AtHomeDefenseIcon.png", "FunctionIcon/ArmCenter/AtHomeDefenseIconOn.png", |
| | | mode.name,mode.sid); |
| | | customDeploymentView.AddChidren(armDiyView); |
| | | EventHandler<MouseEventArgs> event2 = (sender, e) => |
| | | { |
| | | ShowArmDialog(mode); |
| | | }; |
| | | armDiyView.SetClickEvent(event2); |
| | | if (mode.status == "enable") |
| | | { |
| | | armDiyView.LightingView(true); |
| | | InDefenseMode = mode; |
| | | |
| | | ///刷新界面 |
| | | LoadEvent_RefreshSecurityStatus(InDefenseMode); |
| | | } |
| | | armDiyViewList.Add(armDiyView); |
| | | } |
| | | |
| | | if (FunctionList.List.securities.Count < 4) |
| | | { |
| | | var view = new ArmDiyView("FunctionIcon/ArmCenter/AddDefenseIcon.png", "FunctionIcon/ArmCenter/AddDefenseIcon.png", |
| | | Language.StringByID(StringId.Custom),"customSid"); |
| | | customDeploymentView.AddChidren(view); |
| | | EventHandler<MouseEventArgs> event1 = (sender, e) => |
| | | { |
| | | Action addDefenseRefreshAction = () => |
| | | { |
| | | iniCustomDeploymentView(); |
| | | }; |
| | | |
| | | var addDefensePage = new AddAlarmDeploymentPage(new SecurityAlarm(), addDefenseRefreshAction); |
| | | MainPage.BasePageView.AddChidren(addDefensePage); |
| | | addDefensePage.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | view.SetClickEvent(event1); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void ShowArmDialog(SecurityAlarm alarm) |
| | | { |
| | | Dialog dialog = new Dialog(); |
| | | |
| | | FrameLayout contentView = new FrameLayout(); |
| | | dialog.AddChidren(contentView); |
| | | contentView.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | VerticalScrolViewLayout optinView = new VerticalScrolViewLayout() { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(515), |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(88), |
| | | Radius = (uint)Application.GetRealHeight(13), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | contentView.AddChidren(optinView); |
| | | |
| | | Button btnOpen = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.OpenArm |
| | | }; |
| | | optinView.AddChidren(btnOpen); |
| | | |
| | | optinView.AddChidren(new Button() { |
| | | Height = 1, |
| | | BackgroundColor = CSS_Color.DividingLineColor |
| | | }); |
| | | |
| | | Button btnCheckModify = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextID = StringId.CheckModify, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | }; |
| | | optinView.AddChidren(btnCheckModify); |
| | | |
| | | |
| | | Button btnCancel = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = optinView.Bottom + Application.GetRealHeight(8), |
| | | Width = Application.GetRealWidth(343), |
| | | Height = Application.GetRealHeight(44), |
| | | Radius = (uint)Application.GetRealHeight(13), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | TextID = StringId.Cancel, |
| | | TextColor = CSS_Color.WarningColor, |
| | | IsBold = true, |
| | | }; |
| | | contentView.AddChidren(btnCancel); |
| | | |
| | | dialog.Show(); |
| | | |
| | | if(alarm.status == "enable") |
| | | { |
| | | btnOpen.TextColor = CSS_Color.PromptingColor1; |
| | | btnOpen.Text = Language.StringByID(StringId.AlreadyOpened).Trim() ; |
| | | } |
| | | |
| | | btnOpen.MouseUpEventHandler = (sender, e) => { |
| | | string controlStatus = alarm.status == "disable" ? "enable" : "disable"; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | Control.Ins.ControlSecurity(alarm, controlStatus); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | |
| | | btnCheckModify.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | Action refreshAction = () => |
| | | { |
| | | iniCustomDeploymentView(); |
| | | }; |
| | | |
| | | alarm = alarm.RefeshData(); |
| | | var armSetPage = new AddAlarmDeploymentPage(alarm,refreshAction); |
| | | MainPage.BasePageView.AddChidren(armSetPage); |
| | | armSetPage.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | btnCancel.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | } |
| | | |
| | | public static void LoadEvent_RefreshSecurityStatus(SecurityAlarm updataTemp) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | try |
| | | { |
| | | if (bodyView != null) |
| | | { |
| | | bodyView.refreshAction?.Invoke(); |
| | | |
| | | //布防 |
| | | if (updataTemp.status == "enable") |
| | | { |
| | | bodyView.InDefenseMode = updataTemp; |
| | | foreach (var tempView in bodyView.armDiyViewList) |
| | | { |
| | | tempView.LightingView(false); |
| | | if (tempView.sid == updataTemp.sid) |
| | | { |
| | | tempView.LightingView(updataTemp.status == "enable"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //撤防 |
| | | if(bodyView.InDefenseMode.sid == updataTemp.sid) |
| | | { |
| | | foreach (var tempView in bodyView.armDiyViewList) |
| | | { |
| | | tempView.LightingView(false); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //foreach(var tempView in bodyView.armDiyViewList) |
| | | //{ |
| | | // tempView.LightingView(false); |
| | | // if(tempView.sid == updataTemp.sid) |
| | | // { |
| | | // tempView.LightingView(updataTemp.status == "enable"); |
| | | // } |
| | | //} |
| | | |
| | | //没有布防的情况 |
| | | if (bodyView.InDefenseMode ==null|| bodyView.InDefenseMode.status == "disable") |
| | | { |
| | | bodyView.disarmView.Height = 0; |
| | | bodyView.btnArmTipIcon.IsSelected = false; |
| | | bodyView.btnDefenseName.Text = ""; |
| | | } |
| | | else |
| | | { |
| | | bodyView.disarmView.Height = Application.GetRealHeight(68); |
| | | bodyView.btnArmTipIcon.IsSelected = true; |
| | | bodyView.btnDefenseName.Text = bodyView.InDefenseMode.name; |
| | | } |
| | | bodyView.InitAlarmStatus(bodyView.InDefenseMode.alarm); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"安防界面更新异常:{ex.Message}"); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | |
| | | /// <summary> |
| | | /// 安防自定义控件 |
| | | /// </summary> |
| | | public class ArmDiyView |
| | | public class ArmDiyView : FrameLayout |
| | | { |
| | | public FrameLayout ArmDiyButton; |
| | | |
| | | Button btnIcon; |
| | | Button btnText; |
| | | public string sid; |
| | | /// <summary> |
| | | /// |
| | | /// 自定义布防界面 |
| | | /// </summary> |
| | | /// <param name="IconPath">图片路径</param> |
| | | /// <param name="UnSelectedIconPath">图片路径</param> |
| | | /// <param name="SelectedIconPath">图片路径</param> |
| | | /// <param name="Text">显示文本</param> |
| | | public ArmDiyView(string UnSelectedIconPath, string SelectedIconPath, string Text) |
| | | public ArmDiyView(string UnSelectedIconPath, string SelectedIconPath, string Text,string inSid) |
| | | { |
| | | ArmDiyButton = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(82), |
| | | Height = Application.GetRealWidth(80), |
| | | }; |
| | | sid = inSid; |
| | | this.Width = Application.GetRealWidth(82); |
| | | this.Height = Application.GetRealWidth(80); |
| | | |
| | | Button btnIcon = new Button() |
| | | btnIcon = new Button() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(40), |
| | |
| | | UnSelectedImagePath = UnSelectedIconPath, |
| | | SelectedImagePath = SelectedIconPath, |
| | | }; |
| | | ArmDiyButton.AddChidren(btnIcon); |
| | | this.AddChidren(btnIcon); |
| | | |
| | | Button btnText = new Button() |
| | | btnText = new Button() |
| | | { |
| | | Y = Application.GetRealWidth(40), |
| | | Height = Application.GetRealWidth(41), |
| | |
| | | TextColor = CSS_Color.TextualColor, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | ArmDiyButton.AddChidren(btnText); |
| | | this.AddChidren(btnText); |
| | | } |
| | | |
| | | public void SetClickEvent(EventHandler<MouseEventArgs> eventHandler) |
| | | { |
| | | this.MouseUpEventHandler = eventHandler; |
| | | btnIcon.MouseUpEventHandler = eventHandler; |
| | | btnText.MouseUpEventHandler = eventHandler; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 点亮区域 |
| | | /// </summary> |
| | | public void LightingView(bool seleted) |
| | | { |
| | | btnIcon.IsSelected = seleted; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 固定布防控件 |
| | | /// </summary> |
| | | public class FixedArmView : FrameLayout |
| | | { |
| | | Button btnIcon; |
| | | Button btnTitle; |
| | | Button btnTitleTip; |
| | | |
| | | /// <summary> |
| | | /// 固定布防控件 |
| | | /// </summary> |
| | | /// <param name="iconPath"></param> |
| | | /// <param name="title"></param> |
| | | /// <param name="titleTip"></param> |
| | | public FixedArmView(string iconPath, string title, string titleTip) |
| | | { |
| | | this.Width = Application.GetRealWidth(144); |
| | | this.Height = Application.GetRealHeight(66); |
| | | this.Radius = (uint)Application.GetRealWidth(6); |
| | | this.BorderColor = CSS_Color.MainColor; |
| | | this.BorderWidth = 1; |
| | | |
| | | btnIcon = new Button() |
| | | { |
| | | X = Application.GetRealWidth(15), |
| | | Width = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(24), |
| | | Gravity = Gravity.CenterVertical, |
| | | UnSelectedImagePath = iconPath,// "FunctionIcon/ArmCenter/DisasterAlarmIcon.png", |
| | | }; |
| | | this.AddChidren(btnIcon); |
| | | |
| | | btnTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(55), |
| | | Width = Application.GetRealWidth(89), |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = title, |
| | | IsBold = true, |
| | | }; |
| | | this.AddChidren(btnTitle); |
| | | |
| | | btnTitleTip = new Button() |
| | | { |
| | | X = Application.GetRealWidth(55), |
| | | Y = Application.GetRealHeight(23), |
| | | Width = Application.GetRealWidth(89), |
| | | Height = Application.GetRealHeight(44), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | Text = titleTip, |
| | | IsMoreLines = true, |
| | | }; |
| | | this.AddChidren(btnTitleTip); |
| | | |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 设置点击事件 |
| | | /// </summary> |
| | | /// <param name="handler"></param> |
| | | public void SetClick(EventHandler<MouseEventArgs> handler) |
| | | { |
| | | btnTitleTip.MouseUpEventHandler = btnIcon.MouseUpEventHandler = handler; |
| | | } |
| | | } |
| | | |
| | | } |