wjc
2022-10-17 cd8cdf7eb281af3b7a5f2b61bd21f1aa0adf7524
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
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",
                };
 
        }
    }
}