using System;
|
using Shared;
|
using Shared.R;
|
using Shared.Common;
|
using System.Collections.Generic;
|
|
namespace Shared.Phone.Device.Logic
|
{
|
public class SecurityMode : FrameLayout
|
{
|
public SecurityMode()
|
{
|
Tag = "Logic";
|
}
|
/// <summary>
|
/// 标记是否编辑
|
/// </summary>
|
public bool IsDeviceEditor;
|
Dictionary<string, object> actionsInfo = new Dictionary<string, object>();
|
|
public void Show()
|
{
|
|
#region 最上面的布局代码
|
TopView view = new TopView();
|
this.AddChidren(view.TopRowView());
|
view.toptitleNameBtn.TextID = MyInternationalizationString.securitymode;
|
view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); };
|
#endregion
|
|
var middle = new FrameLayout();
|
middle.Y = view.topRowLayout.Bottom;
|
middle.Height = Application.GetRealHeight(Method.H - 184);
|
middle.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
|
this.AddChidren(middle);
|
|
LogicView.SaveView saveView = new LogicView.SaveView();
|
saveView.frameLayout.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
|
saveView.frameLayout.Y = middle.Height - Application.GetRealHeight(260);
|
middle.AddChidren(saveView.Show());
|
|
|
|
#region ----(在家/离家)布防 撤防 胁迫撤防----
|
#region 在家布防
|
|
FunView athomeView = new FunView();
|
athomeView.iconBtn.UnSelectedImagePath = "ZigeeLogic/athome.png";
|
athomeView.funnameBtn.TextID = MyInternationalizationString.logicathomegarrison;
|
athomeView.funnextBtn.Width = Application.GetMinRealAverage(60);
|
athomeView.funnextBtn.Height = Application.GetMinRealAverage(60);
|
athomeView.funnextBtn.UnSelectedImagePath = "ZigeeLogic/selected.png";
|
athomeView.funnextBtn.Visible = false;
|
middle.AddChidren(athomeView.FunFrameView());
|
|
|
|
#endregion
|
|
#region 离家布防
|
|
|
FunView leaveView= new FunView();
|
leaveView.funFrameLayout.Y = athomeView.funFrameLayout.Bottom;
|
leaveView.iconBtn.UnSelectedImagePath = "ZigeeLogic/leavehome.png";
|
leaveView.funnameBtn.TextID = MyInternationalizationString.logicremovehomegarrison;
|
leaveView.funnextBtn.Width = Application.GetMinRealAverage(60);
|
leaveView.funnextBtn.Height = Application.GetMinRealAverage(60);
|
leaveView.funnextBtn.UnSelectedImagePath = "ZigeeLogic/selected.png";
|
leaveView.funnextBtn.Visible = false;
|
middle.AddChidren(leaveView.FunFrameView());
|
|
|
#endregion
|
|
#region 撤防
|
|
FunView withdrawalView= new FunView();
|
withdrawalView.funFrameLayout.Y = leaveView.funFrameLayout.Bottom;
|
withdrawalView.iconBtn.UnSelectedImagePath = "ZigeeLogic/withdrawal.png";
|
withdrawalView.funnameBtn.TextID = MyInternationalizationString.withdrawal;
|
withdrawalView.funnextBtn.Width = Application.GetMinRealAverage(60);
|
withdrawalView.funnextBtn.Height = Application.GetMinRealAverage(60);
|
withdrawalView.funnextBtn.UnSelectedImagePath = "ZigeeLogic/selected.png";
|
withdrawalView.funnextBtn.Visible = false;
|
middle.AddChidren(withdrawalView.FunFrameView());
|
|
#endregion
|
|
#region 胁迫撤防
|
|
FunView urgentwithdView = new FunView();
|
urgentwithdView.funFrameLayout.Y = withdrawalView.funFrameLayout.Bottom;
|
urgentwithdView.funFrameLayout.Height = Application.GetRealHeight(160 + 20);//最后一行增加20高度;
|
urgentwithdView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor; ///改变最后功能快线条颜色
|
urgentwithdView.iconBtn.UnSelectedImagePath = "ZigeeLogic/withdrawal.png";
|
urgentwithdView.funnameBtn.TextID = MyInternationalizationString.urgentwithdrawal;
|
urgentwithdView.funnextBtn.Width = Application.GetMinRealAverage(60);
|
urgentwithdView.funnextBtn.Height = Application.GetMinRealAverage(60);
|
urgentwithdView.funnextBtn.UnSelectedImagePath = "ZigeeLogic/selected.png";
|
urgentwithdView.funnextBtn.Visible = false;
|
middle.AddChidren(urgentwithdView.FunFrameView());
|
#endregion
|
|
#endregion
|
|
///在家布防点击事件
|
athomeView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
athomeView.funnextBtn.Visible = true;
|
leaveView.funnextBtn.Visible = false;
|
withdrawalView.funnextBtn.Visible = false;
|
urgentwithdView.funnextBtn.Visible = false;
|
};
|
|
|
///离家布防点击事件
|
leaveView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
athomeView.funnextBtn.Visible = false;
|
leaveView.funnextBtn.Visible = true;
|
withdrawalView.funnextBtn.Visible = false;
|
urgentwithdView.funnextBtn.Visible = false;
|
};
|
|
|
///撤防点击事件
|
withdrawalView.clickviewBtn.MouseUpEventHandler+= (seder, e) =>
|
{
|
athomeView.funnextBtn.Visible = false;
|
leaveView.funnextBtn.Visible = false;
|
withdrawalView.funnextBtn.Visible = true;
|
urgentwithdView.funnextBtn.Visible = false;
|
|
};
|
|
|
///胁迫撤防点击事件
|
urgentwithdView.clickviewBtn.MouseUpEventHandler += (seder, e) =>
|
{
|
athomeView.funnextBtn.Visible = false;
|
leaveView.funnextBtn.Visible = false;
|
withdrawalView.funnextBtn.Visible = false;
|
urgentwithdView.funnextBtn.Visible = true;
|
};
|
|
|
if (IsDeviceEditor)
|
{
|
foreach (var actions in Common.Logic.CurrentLogic.Actions)
|
{
|
if (actions["LinkType"].ToString() == "6")
|
{
|
|
if (actions["SecuritySetting"].ToString() == "0")
|
{
|
if (actions["Password"].ToString() == "888888")
|
{
|
athomeView.funnextBtn.Visible = false;
|
leaveView.funnextBtn.Visible = false;
|
withdrawalView.funnextBtn.Visible = false;
|
urgentwithdView.funnextBtn.Visible = true;
|
}
|
else
|
{
|
athomeView.funnextBtn.Visible = false;
|
leaveView.funnextBtn.Visible = false;
|
withdrawalView.funnextBtn.Visible = true;
|
urgentwithdView.funnextBtn.Visible = false;
|
}
|
|
}
|
else if (actions["SecuritySetting"].ToString() == "1")
|
{
|
if (actions["SecurityModeId"].ToString() == "1")
|
{
|
|
athomeView.funnextBtn.Visible = true;
|
leaveView.funnextBtn.Visible = false;
|
withdrawalView.funnextBtn.Visible = false;
|
urgentwithdView.funnextBtn.Visible = false;
|
}
|
else
|
{
|
athomeView.funnextBtn.Visible = false;
|
leaveView.funnextBtn.Visible = true;
|
withdrawalView.funnextBtn.Visible = false;
|
urgentwithdView.funnextBtn.Visible = false;
|
|
}
|
}
|
break;
|
|
}
|
|
}
|
|
}
|
|
saveView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
if (!athomeView.funnextBtn.Visible && !leaveView.funnextBtn.Visible && !withdrawalView.funnextBtn.Visible && !urgentwithdView.funnextBtn.Visible)
|
{
|
|
var alert = new UserCenter.ShowMsgControl(UserCenter.ShowMsgType.Normal,
|
Language.StringByID(MyInternationalizationString.securitytip),
|
Language.StringByID(MyInternationalizationString.confrim));
|
alert.Show();
|
return;
|
}
|
|
if (actionsInfo.ContainsKey("LinkType"))
|
{
|
actionsInfo.Remove("LinkType");
|
}
|
if (actionsInfo.ContainsKey("CheckIASStatus"))
|
{
|
actionsInfo.Remove("CheckIASStatus");
|
}
|
if (actionsInfo.ContainsKey("IsDelayStart"))
|
{
|
actionsInfo.Remove("IsDelayStart");
|
}
|
|
actionsInfo.Add("LinkType", 6);
|
actionsInfo.Add("CheckIASStatus", 0);
|
actionsInfo.Add("IsDelayStart", 0);
|
|
if (actionsInfo.ContainsKey("Password"))
|
{
|
actionsInfo.Remove("Password");
|
}
|
if (actionsInfo.ContainsKey("SecuritySetting"))
|
{
|
actionsInfo.Remove("SecuritySetting");
|
}
|
if (actionsInfo.ContainsKey("SecurityModeId"))
|
{
|
actionsInfo.Remove("SecurityModeId");
|
}
|
///在家布防
|
if (athomeView.funnextBtn.Visible)
|
{
|
actionsInfo.Add("SecuritySetting", "1");
|
actionsInfo.Add("SecurityModeId", "1");
|
actionsInfo.Add("Password", "666666");
|
|
}
|
///离家布防
|
if (leaveView.funnextBtn.Visible)
|
{
|
actionsInfo.Add("SecuritySetting", "1");
|
actionsInfo.Add("SecurityModeId", "2");
|
actionsInfo.Add("Password", "666666");
|
|
}
|
///撤防
|
if (withdrawalView.funnextBtn.Visible)
|
{
|
actionsInfo.Add("SecuritySetting", "0");
|
actionsInfo.Add("SecurityModeId", "0");
|
actionsInfo.Add("Password", "999999");
|
|
}
|
///紧迫撤防
|
if (urgentwithdView.funnextBtn.Visible)
|
{
|
actionsInfo.Add("SecuritySetting", "0");
|
actionsInfo.Add("SecurityModeId", "0");
|
actionsInfo.Add("Password", "888888");
|
|
}
|
LogicIfon.AddSecurityactions(actionsInfo);
|
this.RemoveFromParent();
|
var logicCommunalPage = new LogicCommunalPage();
|
UserView.HomePage.Instance.AddChidren(logicCommunalPage);
|
UserView.HomePage.Instance.PageIndex += 1;
|
logicCommunalPage.Show(() => { });
|
|
|
};
|
}
|
|
|
}
|
}
|