using System;
|
using System.Collections.Generic;
|
using Shared;
|
using Shared.Common;
|
using Shared.Phone.Device;
|
using Shared.R;
|
using ZigBee.Device;
|
using Shared.Phone.Device.Logic.LogicView;
|
|
|
namespace Shared.Phone.Device.Logic
|
{
|
|
public class AddLogicPage : FrameLayout
|
{
|
public AddLogicPage()
|
{
|
Tag = "Logic";
|
}
|
public void Show()
|
{
|
|
#region 界面的布局代码
|
TopView view = new TopView();
|
this.AddChidren(view.TopRowView());
|
view.toptitleNameBtn.TextID = MyInternationalizationString.selection;
|
view.clickBtn.MouseDownEventHandler += (sender, e) => { RemoveFromParent(); };
|
|
var middle = new FrameLayout
|
{
|
Y = view.topRowLayout.Bottom,
|
Height = Application.GetRealHeight(Method.H - 184),
|
BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor,
|
};
|
this.AddChidren(middle);
|
///时间
|
FunView timeView = new FunView();
|
timeView.iconBtn.UnSelectedImagePath = "ZigeeLogic/time.png";
|
timeView.funnameBtn.TextID = MyInternationalizationString.timecondition;
|
middle.AddChidren(timeView.FunFrameView());
|
|
///设备
|
FunView functionView = new FunView();
|
functionView.funFrameLayout.Y = timeView.funFrameLayout.Bottom;
|
functionView.iconBtn.UnSelectedImagePath = "ZigeeLogic/function.png";
|
functionView.funnameBtn.TextID = MyInternationalizationString.device;
|
middle.AddChidren(functionView.FunFrameView());
|
|
///安防
|
FunView securityView = new FunView();
|
securityView.funFrameLayout.Y = functionView.funFrameLayout.Bottom;
|
securityView.iconBtn.UnSelectedImagePath = "ZigeeLogic/security.png";
|
securityView.funnameBtn.TextID = MyInternationalizationString.security;
|
middle.AddChidren(securityView.FunFrameView());
|
|
///地理围栏
|
FunView positionView = new FunView();
|
positionView.funFrameLayout.Y = securityView.funFrameLayout.Bottom;
|
positionView.funFrameLayout.Height = Application.GetRealHeight(160+20);//最后一行增加20高度;
|
positionView.iconBtn.UnSelectedImagePath = "ZigeeLogic/position.png";
|
positionView.funnameBtn.TextID = MyInternationalizationString.location;
|
positionView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBlankBackgroundColor;
|
middle.AddChidren(positionView.FunFrameView());
|
#endregion
|
|
timeView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
TimeView();
|
};
|
functionView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
var roomAndDeviceView = new RoomAndDeviceView();
|
UserView.HomePage.Instance.AddChidren(roomAndDeviceView);
|
UserView.HomePage.Instance.PageIndex += 1;
|
roomAndDeviceView.IfType = LogicView.IfString.Condition_Logic;
|
roomAndDeviceView.Show(Language.StringByID(MyInternationalizationString.devicestate));
|
|
};
|
securityView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
|
this.AddChidren(flMain);
|
SecurityView(flMain, false);
|
};
|
positionView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicViewBackgroundColor };
|
this.AddChidren(flMain);
|
LocationView(flMain, false);
|
};
|
}
|
|
/// <summary>
|
/// 安防条件View
|
/// </summary>
|
/// <param name="flMain">Fl main.</param>
|
/// <param name="edit">If set to <c>true</c> edit.</param>
|
public static void SecurityView(FrameLayout flMain, bool edit)
|
{
|
UserView.HomePage.Instance.ScrollEnabled = false;
|
Dictionary<string, string> SecurityConditionsInfo = new Dictionary<string, string>();
|
#region ---界面布局部分---
|
CompleteView completeView = new CompleteView();
|
flMain.AddChidren(completeView.Show(4));
|
completeView.Btntitle.TextID = MyInternationalizationString.security;
|
EventHandler<MouseEventArgs> clickcancel = (sender, e) =>
|
{
|
UserView.HomePage.Instance.ScrollEnabled = true;
|
flMain.RemoveFromParent();
|
};
|
flMain.MouseUpEventHandler += clickcancel;
|
completeView.Btncancel.MouseUpEventHandler += clickcancel;
|
//在家布防
|
mFunView athomeView = new mFunView();
|
athomeView.frameLayout.Y = Application.GetRealHeight(140 + 20);
|
completeView.Show(4).AddChidren(athomeView.Show());
|
athomeView.titleBtn.TextID = MyInternationalizationString.logicathomegarrison;
|
//离家布防
|
mFunView removeView = new mFunView();
|
removeView.frameLayout.Y = athomeView.frameLayout.Bottom;
|
completeView.Show(4).AddChidren(removeView.Show());
|
removeView.titleBtn.TextID = MyInternationalizationString.logicremovehomegarrison;
|
//撤防
|
mFunView withdrawalView = new mFunView();
|
withdrawalView.frameLayout.Y = removeView.frameLayout.Bottom;
|
completeView.Show(4).AddChidren(withdrawalView.Show());
|
withdrawalView.titleBtn.TextID = MyInternationalizationString.withdrawal;
|
//胁迫撤防
|
mFunView urgentwithdrawalView = new mFunView();
|
urgentwithdrawalView.frameLayout.Y = withdrawalView.frameLayout.Bottom;
|
completeView.Show(4).AddChidren(urgentwithdrawalView.Show());
|
urgentwithdrawalView.titleBtn.TextID = MyInternationalizationString.urgentwithdrawal;
|
urgentwithdrawalView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
|
#endregion
|
athomeView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
|
removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
athomeView.selectedIconBtn.Visible = true;
|
removeView.selectedIconBtn.Visible = false;
|
withdrawalView.selectedIconBtn.Visible = false;
|
urgentwithdrawalView.selectedIconBtn.Visible = false;
|
};
|
removeView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
|
withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
athomeView.selectedIconBtn.Visible = false;
|
removeView.selectedIconBtn.Visible = true;
|
withdrawalView.selectedIconBtn.Visible = false;
|
urgentwithdrawalView.selectedIconBtn.Visible = false;
|
|
};
|
withdrawalView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
|
urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
athomeView.selectedIconBtn.Visible = false;
|
removeView.selectedIconBtn.Visible = false;
|
withdrawalView.selectedIconBtn.Visible = true;
|
urgentwithdrawalView.selectedIconBtn.Visible = false;
|
};
|
urgentwithdrawalView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
|
athomeView.selectedIconBtn.Visible = false;
|
removeView.selectedIconBtn.Visible = false;
|
withdrawalView.selectedIconBtn.Visible = false;
|
urgentwithdrawalView.selectedIconBtn.Visible = true;
|
|
};
|
|
if (edit)
|
{
|
foreach (var securityifon in Common.Logic.CurrentLogic.Conditions)
|
{
|
|
if (securityifon["Type"] == "6")
|
{
|
if (securityifon["EnOrWithdrawMode"] == "0")
|
{
|
if (securityifon["ModeId"] == "1")
|
{
|
athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
|
removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
athomeView.selectedIconBtn.Visible = true;
|
removeView.selectedIconBtn.Visible = false;
|
withdrawalView.selectedIconBtn.Visible = false;
|
urgentwithdrawalView.selectedIconBtn.Visible = false;
|
}
|
else
|
{
|
athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
|
withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
athomeView.selectedIconBtn.Visible = false;
|
removeView.selectedIconBtn.Visible = true;
|
withdrawalView.selectedIconBtn.Visible = false;
|
urgentwithdrawalView.selectedIconBtn.Visible = false;
|
}
|
|
|
}
|
else if (securityifon["EnOrWithdrawMode"] == "1")
|
{
|
athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
|
urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
athomeView.selectedIconBtn.Visible = false;
|
removeView.selectedIconBtn.Visible = false;
|
withdrawalView.selectedIconBtn.Visible = true;
|
urgentwithdrawalView.selectedIconBtn.Visible = false;
|
}
|
else if (securityifon["EnOrWithdrawMode"] == "2")
|
{
|
athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
removeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
withdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
urgentwithdrawalView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
|
athomeView.selectedIconBtn.Visible = false;
|
removeView.selectedIconBtn.Visible = false;
|
withdrawalView.selectedIconBtn.Visible = false;
|
urgentwithdrawalView.selectedIconBtn.Visible = true;
|
}
|
break;
|
}
|
}
|
}
|
completeView.Btncomplete.MouseUpEventHandler += (sender, e) =>
|
{
|
if (!athomeView.selectedIconBtn.Visible && !removeView.selectedIconBtn.Visible && !withdrawalView.selectedIconBtn.Visible && !urgentwithdrawalView.selectedIconBtn.Visible)
|
{
|
return;
|
}
|
UserView.HomePage.Instance.ScrollEnabled = true;
|
if (SecurityConditionsInfo.ContainsKey("Type"))
|
{
|
SecurityConditionsInfo.Remove("Type");
|
}
|
if (SecurityConditionsInfo.ContainsKey("IsValid"))
|
{
|
SecurityConditionsInfo.Remove("IsValid");
|
}
|
if (SecurityConditionsInfo.ContainsKey("ModeId"))
|
{
|
SecurityConditionsInfo.Remove("ModeId");
|
}
|
SecurityConditionsInfo.Add("Type", "6");
|
SecurityConditionsInfo.Add("IsValid", "1");
|
if (SecurityConditionsInfo.ContainsKey("EnOrWithdrawMode"))
|
{
|
SecurityConditionsInfo.Remove("EnOrWithdrawMode");
|
}
|
if (SecurityConditionsInfo.ContainsKey("ModeId"))
|
{
|
SecurityConditionsInfo.Remove("ModeId");
|
}
|
//在家布防
|
if (athomeView.selectedIconBtn.Visible)
|
{
|
|
SecurityConditionsInfo.Add("EnOrWithdrawMode", "0");
|
SecurityConditionsInfo.Add("ModeId", "1");
|
}
|
//离家布防
|
if (removeView.selectedIconBtn.Visible)
|
{
|
|
SecurityConditionsInfo.Add("EnOrWithdrawMode", "0");
|
SecurityConditionsInfo.Add("ModeId", "2");
|
}
|
//撤防
|
if (withdrawalView.selectedIconBtn.Visible)
|
{
|
|
SecurityConditionsInfo.Add("EnOrWithdrawMode", "1");
|
SecurityConditionsInfo.Add("ModeId", "0");
|
}
|
//胁迫撤防
|
if (urgentwithdrawalView.selectedIconBtn.Visible)
|
{
|
|
SecurityConditionsInfo.Add("EnOrWithdrawMode", "2");
|
SecurityConditionsInfo.Add("ModeId", "0");
|
}
|
LogicIfon.AddSecurityconditions(SecurityConditionsInfo);
|
var logicCommunalPage = new LogicCommunalPage();
|
UserView.HomePage.Instance.AddChidren(logicCommunalPage);
|
UserView.HomePage.Instance.PageIndex += 1;
|
logicCommunalPage.Show(() => { });
|
};
|
|
}
|
/// <summary>
|
/// 地理围栏View
|
/// </summary>
|
/// <param name="flMain">Fl main.</param>
|
/// <param name="edit">If set to <c>true</c> edit.</param>
|
public static void LocationView(FrameLayout flMain, bool edit)
|
{
|
UserView.HomePage.Instance.ScrollEnabled = false;
|
Dictionary<string, string> LocationConditionsInfo = new Dictionary<string, string>();
|
#region ------界面布局部分
|
CompleteView completeView = new CompleteView();
|
flMain.AddChidren(completeView.Show(2));
|
completeView.Btntitle.TextID = MyInternationalizationString.location;
|
EventHandler<MouseEventArgs> clickcancel = (sender, e) =>
|
{
|
UserView.HomePage.Instance.ScrollEnabled = true;
|
flMain.RemoveFromParent();
|
};
|
flMain.MouseUpEventHandler += clickcancel;
|
completeView.Btncancel.MouseUpEventHandler += clickcancel;
|
//到达地点
|
mFunView athomeView = new mFunView();
|
athomeView.frameLayout.Y = Application.GetRealHeight(140 + 20);
|
completeView.Show(2).AddChidren(athomeView.Show());
|
athomeView.titleBtn.TextID = MyInternationalizationString.athome;
|
//离开地点
|
mFunView leaveView = new mFunView();
|
leaveView.frameLayout.Y = athomeView.frameLayout.Bottom;
|
completeView.Show(2).AddChidren(leaveView.Show());
|
leaveView.titleBtn.TextID = MyInternationalizationString.leavehome;
|
leaveView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
|
#endregion
|
string strname = "";
|
//到达地点点击事件
|
athomeView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
|
strname = athomeView.titleBtn.Text;
|
leaveView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
|
leaveView.selectedIconBtn.Visible = false;
|
athomeView.selectedIconBtn.Visible = true;
|
};
|
//离开地点点击事件
|
leaveView.clickviewBtn.MouseUpEventHandler += (sender, e) =>
|
{
|
strname = leaveView.titleBtn.Text;
|
leaveView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
|
athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
leaveView.selectedIconBtn.Visible = true;
|
athomeView.selectedIconBtn.Visible = false;
|
};
|
|
double latitude = Config.Instance.Home.Latitude;//纬度
|
double longitude = Config.Instance.Home.Longitude;//经度
|
int r = 500;//半径
|
if (edit)
|
{
|
string guid = "";
|
foreach (var Locationifon in Common.Logic.CurrentLogic.Conditions)
|
{
|
|
if (Locationifon["Type"] == "7")
|
{
|
guid = Locationifon["WhoSiteUId"];
|
if (Locationifon["AtHome"] == "1")
|
{
|
strname = athomeView.titleBtn.Text;
|
leaveView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
|
leaveView.selectedIconBtn.Visible = false;
|
athomeView.selectedIconBtn.Visible = true;
|
}
|
else
|
{
|
strname = leaveView.titleBtn.Text;
|
leaveView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
|
athomeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
leaveView.selectedIconBtn.Visible = true;
|
athomeView.selectedIconBtn.Visible = false;
|
}
|
break;
|
}
|
}
|
|
foreach (var accounts in Common.Logic.CurrentLogic.Accounts)
|
{
|
|
if (accounts["Type"] == "7" && accounts["Account"] == guid)
|
{
|
|
///转换为double类型;
|
latitude = Convert.ToDouble(accounts["Latitude"]) / 1000000.0;
|
longitude = Convert.ToDouble(accounts["Longitude"]) / 1000000.0;
|
r = int.Parse(accounts["Radius"]);
|
break;
|
}
|
}
|
}
|
|
completeView.Btncomplete.MouseUpEventHandler += (sender, e) =>
|
{
|
|
if (!leaveView.selectedIconBtn.Visible && !athomeView.selectedIconBtn.Visible)
|
{
|
///可以提示未选中状态;
|
return;
|
}
|
UserView.HomePage.Instance.ScrollEnabled = true;
|
if (LocationConditionsInfo.ContainsKey("Type"))
|
{
|
LocationConditionsInfo.Remove("Type");
|
}
|
if (LocationConditionsInfo.ContainsKey("IsValid"))
|
{
|
LocationConditionsInfo.Remove("IsValid");
|
}
|
if (LocationConditionsInfo.ContainsKey("WhoSiteUId"))
|
{
|
LocationConditionsInfo.Remove("WhoSiteUId");
|
}
|
LocationConditionsInfo.Add("Type", "7");
|
LocationConditionsInfo.Add("IsValid", "1");
|
LocationConditionsInfo.Add("WhoSiteUId", Config.Instance.Guid);
|
if (leaveView.selectedIconBtn.Visible)
|
{
|
if (LocationConditionsInfo.ContainsKey("AtHome"))
|
{
|
LocationConditionsInfo.Remove("AtHome");
|
}
|
LocationConditionsInfo.Add("AtHome", "0");
|
}
|
else
|
{
|
if (LocationConditionsInfo.ContainsKey("AtHome"))
|
{
|
LocationConditionsInfo.Remove("AtHome");
|
}
|
LocationConditionsInfo.Add("AtHome", "1");
|
}
|
|
#if Android
|
//申请定位权限
|
((BaseActivity)Application.Activity).SetGPSLocationPermission((result1) =>
|
{
|
if (result1 == false) { return; }
|
|
//申请允许程序写入外部存储,如SD卡上写文件
|
((BaseActivity)Application.Activity).SetPermission((result2) =>
|
{
|
if (result2 == false) { return; }
|
//读取电话状态权限
|
((BaseActivity)Application.Activity).SetPermission((result3) =>
|
{
|
if (result3 == false) { return; }
|
|
//调用方法,跳转页面
|
GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
|
{
|
//截取字符串后第6位;
|
//var len = name.Substring(name.Length - 6, 6);
|
|
//点击保存按钮,回调当前选择的纬度,经度,半径范围
|
var latitudW = (int)Math.Truncate(mLatitude * 1000000);
|
var longitudeH = (int)Math.Truncate(mLongitude * 1000000);
|
Dictionary<string, string> accounts = new Dictionary<string, string>();
|
if (accounts.ContainsKey("Account"))
|
{
|
accounts.Remove("Account");
|
}
|
if (accounts.ContainsKey("Type"))
|
{
|
accounts.Remove("Type");
|
}
|
if (accounts.ContainsKey("Latitude"))
|
{
|
accounts.Remove("latitude");
|
}
|
if (accounts.ContainsKey("Longitude"))
|
{
|
accounts.Remove("Longitude");
|
}
|
if (accounts.ContainsKey("Radius"))
|
{
|
accounts.Remove("radius");
|
}
|
accounts.Add("Account", Config.Instance.Guid);
|
accounts.Add("Type", "7");
|
accounts.Add("Latitude", latitudW.ToString());
|
accounts.Add("Longitude", longitudeH.ToString());
|
accounts.Add("Radius", mRadius.ToString());
|
|
LogicIfon.Addaccounts(accounts);
|
LogicIfon.AddLocationconditions(LocationConditionsInfo);
|
|
var logicCommunalPage = new LogicCommunalPage();
|
UserView.HomePage.Instance.AddChidren(logicCommunalPage);
|
UserView.HomePage.Instance.PageIndex += 1;
|
logicCommunalPage.Show(() => { });
|
}, strname, Language.StringByID(R.MyInternationalizationString.uSave), true, latitude, longitude, r);
|
|
}, "android.permission.READ_PHONE_STATE");
|
|
}, "android.permission.WRITE_EXTERNAL_STORAGE");
|
});
|
#endif
|
#if iOS
|
//调用方法,跳转页面
|
GDMapKit.Show((mLatitude, mLongitude, mRadius, name) =>
|
{
|
//截取字符串后第6位;
|
//var len = name.Substring(name.Length - 6, 6);
|
|
//点击保存按钮,回调当前选择的纬度,经度,半径范围
|
var latitudW = (int)Math.Truncate(mLatitude * 1000000);
|
var longitudeH = (int)Math.Truncate(mLongitude * 1000000);
|
Dictionary<string, string> accounts = new Dictionary<string, string>();
|
if (accounts.ContainsKey("Account"))
|
{
|
accounts.Remove("Account");
|
}
|
if (accounts.ContainsKey("Type"))
|
{
|
accounts.Remove("Type");
|
}
|
if (accounts.ContainsKey("Latitude"))
|
{
|
accounts.Remove("latitude");
|
}
|
if (accounts.ContainsKey("Longitude"))
|
{
|
accounts.Remove("Longitude");
|
}
|
if (accounts.ContainsKey("Radius"))
|
{
|
accounts.Remove("radius");
|
}
|
accounts.Add("Account", Config.Instance.Guid);
|
accounts.Add("Type", "7");
|
accounts.Add("Latitude", latitudW.ToString());
|
accounts.Add("Longitude", longitudeH.ToString());
|
accounts.Add("Radius", mRadius.ToString());
|
|
LogicIfon.Addaccounts(accounts);
|
LogicIfon.AddLocationconditions(LocationConditionsInfo);
|
|
var logicCommunalPage = new LogicCommunalPage();
|
UserView.HomePage.Instance.AddChidren(logicCommunalPage);
|
UserView.HomePage.Instance.PageIndex += 1;
|
logicCommunalPage.Show(() => { });
|
}, strname, Language.StringByID(R.MyInternationalizationString.uSave), true, latitude, longitude, r);
|
#endif
|
};
|
}
|
|
/// <summary>
|
/// 时间条件View
|
/// </summary>
|
void TimeView()
|
{
|
|
UserView.HomePage.Instance.ScrollEnabled = false;
|
Dictionary<string, string> SecurityConditionsInfo = new Dictionary<string, string>();
|
#region ------界面布局部分
|
var flMain = new FrameLayout { BackgroundColor = ZigbeeColor.Current.LogicTranslucentColor };
|
this.AddChidren(flMain);
|
CompleteView completeView = new CompleteView();
|
flMain.AddChidren(completeView.Show(2));
|
completeView.Btntitle.TextID = MyInternationalizationString.type;
|
EventHandler<MouseEventArgs> clickcancel = (sender, e) =>
|
{
|
UserView.HomePage.Instance.ScrollEnabled = true;
|
flMain.RemoveFromParent();
|
};
|
flMain.MouseUpEventHandler += clickcancel;
|
completeView.Btncancel.MouseUpEventHandler += clickcancel;
|
|
//立即执行
|
mFunView timepointView = new mFunView();
|
timepointView.frameLayout.Y = Application.GetRealHeight(140 + 20);
|
completeView.Show(2).AddChidren(timepointView.Show());
|
timepointView.titleBtn.TextID = MyInternationalizationString.immediateexecution;
|
//时间范围
|
mFunView timeView = new mFunView();
|
timeView.frameLayout.Y = timepointView.frameLayout.Bottom;
|
completeView.Show(2).AddChidren(timeView.Show());
|
timeView.titleBtn.TextID = MyInternationalizationString.timeframe;
|
timeView.lineBtn.BackgroundColor = ZigbeeColor.Current.LogicBackgroundColor;
|
#endregion
|
//立即执行点击事件
|
timepointView.clickviewBtn.MouseUpEventHandler += (sender, e) => {
|
|
timeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
timepointView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
|
timeView.selectedIconBtn.Visible = false;
|
timepointView.selectedIconBtn.Visible = true;
|
};
|
//时间范围点击事件
|
timeView.clickviewBtn.MouseUpEventHandler += (sender, e) => {
|
timeView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnSelectedColor;
|
timepointView.titleBtn.TextColor = ZigbeeColor.Current.LogicBtnNotSelectedColor;
|
timeView.selectedIconBtn.Visible = true;
|
timepointView.selectedIconBtn.Visible = false;
|
};
|
|
completeView.Btncomplete.MouseUpEventHandler += (sender, e) =>
|
{
|
if (!timepointView.selectedIconBtn.Visible && !timeView.selectedIconBtn.Visible)
|
{
|
///可以提示未选中状态;
|
return;
|
}
|
UserView.HomePage.Instance.ScrollEnabled = true;
|
flMain.RemoveFromParent();
|
if (timepointView.selectedIconBtn.Visible)
|
{
|
|
Dictionary<string, string> timeConditionsInfo = new Dictionary<string, string>();
|
timeConditionsInfo.Add("Type", "0");
|
timeConditionsInfo.Add("IsValid", "1");
|
timeConditionsInfo.Add("DateType", "1");
|
timeConditionsInfo.Add("RemindTime", "0");
|
timeConditionsInfo.Add("EnDelay", "0");
|
timeConditionsInfo.Add("DelayTime", "0");
|
timeConditionsInfo.Add("AdjustTime", "0");
|
|
var timePoint = new TimePoint();
|
UserView.HomePage.Instance.AddChidren(timePoint);
|
UserView.HomePage.Instance.PageIndex += 1;
|
timePoint.Show(timeConditionsInfo);
|
}
|
else
|
{
|
var timePage = new TimePage();
|
UserView.HomePage.Instance.AddChidren(timePage);
|
UserView.HomePage.Instance.PageIndex += 1;
|
timePage.Show();
|
|
}
|
};
|
}
|
|
|
}
|
|
}
|