using System;
|
using System.Collections.Generic;
|
using Shared;
|
namespace HDL_ON.UI.UI2.Intelligence.Automation
|
{
|
public class ChooseIocate : FrameLayout
|
{
|
public ChooseIocate()
|
{
|
Tag = "Logic";
|
}
|
/// <summary>
|
/// 地理围栏View
|
/// </summary>
|
/// <param name="valueStr">进入(arrive)或者离开(leave)</param>
|
/// <param name="strname"></param>
|
/// <param name="latitude">纬度</param>
|
/// <param name="longitude">经度</param>
|
/// <param name="r">半径(默认500米)</param>
|
public void Show(double latitude, double longitude, int r, Action<string> action)
|
{
|
LogicView.TopView topView = new LogicView.TopView();
|
this.AddChidren(topView.FLayoutView());
|
topView.clickBackBtn.MouseUpEventHandler += (e, sen) =>
|
{
|
RemoveFromParent();
|
};
|
topView.topNameBtn.Text = "选择定位位置";
|
|
FrameLayout viewLayout = new FrameLayout
|
{
|
Y = Application.GetRealHeight(64),
|
Width = Application.GetRealWidth(LogicView.TextSize.view375),
|
Height = Application.GetRealHeight(LogicView.TextSize.view667 - 64),
|
BackgroundColor = CSS.CSS_Color.viewMiddle,
|
};
|
this.AddChidren(viewLayout);
|
|
//当前的经纬度
|
LogicView.SelectTypeView lonlatView = new LogicView.SelectTypeView();
|
lonlatView.btnIcon.Visible = false;
|
lonlatView.btnNextIcon.Visible = false;
|
lonlatView.btnText.X = Application.GetRealWidth(16);
|
lonlatView.btnLine.X = Application.GetRealWidth(16);
|
lonlatView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
|
lonlatView.btnText.Text = "当前的经纬度";
|
lonlatView.btnState.Visible = true;
|
lonlatView.btnState.IsMoreLines = true;
|
lonlatView.btnState.Height = Application.GetRealHeight(25);
|
lonlatView.btnState.Text =latitude.ToString() +"\r\n"+ longitude.ToString();
|
viewLayout.AddChidren(lonlatView.FLayoutView());
|
|
|
//在该位置范围时
|
LogicView.SelectTypeView locateView = new LogicView.SelectTypeView();
|
locateView.frameLayout.Y = lonlatView.frameLayout.Bottom;
|
locateView.btnIcon.Visible = false;
|
lonlatView.btnNextIcon.Visible = false;
|
locateView.btnText.X = Application.GetRealWidth(16);
|
locateView.btnLine.X = Application.GetRealWidth(16);
|
locateView.btnLine.Width = Application.GetRealWidth(375 - 16 - 16);
|
locateView.btnText.Text = "在该位置范围时";
|
locateView.btnState.Visible = true;
|
locateView.btnState.Text = this.queryItem(r.ToString());
|
viewLayout.AddChidren(locateView.FLayoutView());
|
|
///保存View
|
LogicView.SaveView saveView = new LogicView.SaveView();
|
saveView.frameLayout.Y = locateView.frameLayout.Bottom + Application.GetRealHeight(100);
|
saveView.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(24), HDLUtils.RectCornerTopLeft | HDLUtils.RectCornerTopRight);
|
viewLayout.AddChidren(saveView.FLayoutView());
|
locateView.btnClick.MouseUpEventHandler += (sen, e) =>
|
{
|
|
PublicInterface weekView = new PublicInterface();
|
weekView.SingleSelectionShow(this, this.getList(), Language.StringByID(StringId.cyclic), locateView.btnState.Text
|
, (value) =>
|
{
|
//显示选中数据
|
locateView.btnState.Text = value;
|
|
});
|
|
};
|
saveView.btnClick.MouseUpEventHandler += (sender, e) =>
|
{
|
action(locateView.btnState.Text);
|
};
|
}
|
|
private string queryItem(string value)
|
{
|
|
var item = this.getList().Find((o) => o.Contains(value));
|
if (item == null)
|
{
|
return "";
|
}
|
return item;
|
}
|
private List<string> getList()
|
{
|
return new List<string> {
|
"100m",
|
"200m",
|
"500m",
|
"1000m",
|
"2000m",
|
"5000m",
|
};
|
|
}
|
}
|
}
|