-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMapboxView.Events.cs
221 lines (199 loc) · 7.21 KB
/
MapboxView.Events.cs
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
namespace MapboxMaui;
using System.Windows.Input;
partial class MapboxView
{
public event EventHandler<CameraChangedEventArgs> CameraChanged;
public static readonly BindableProperty CameraChangedCommandProperty = BindableProperty.Create(
nameof(CameraChangedCommand),
typeof(ICommand),
typeof(MapboxView)
);
public ICommand CameraChangedCommand
{
get => (ICommand)GetValue(CameraChangedCommandProperty);
set => SetValue(CameraChangedCommandProperty, value);
}
internal void InvokeCameraChanged(CameraOptions options)
{
CameraChanged?.Invoke(this, new CameraChangedEventArgs(options));
if (CameraChangedCommand?.CanExecute(options) == true)
{
CameraChangedCommand.Execute(options);
}
}
public event EventHandler<IndicatorAccuracyRadiusChangedEventArgs> IndicatorAccuracyRadiusChanged;
public static readonly BindableProperty IndicatorAccuracyRadiusChangedCommandProperty = BindableProperty.Create(
nameof(IndicatorAccuracyRadiusChangedCommand),
typeof(ICommand),
typeof(MapboxView)
);
public ICommand IndicatorAccuracyRadiusChangedCommand
{
get => (ICommand)GetValue(IndicatorAccuracyRadiusChangedCommandProperty);
set => SetValue(IndicatorAccuracyRadiusChangedCommandProperty, value);
}
internal void InvokeIndicatorAccuracyRadiusChanged(double radius)
{
IndicatorAccuracyRadiusChanged?.Invoke(this, new IndicatorAccuracyRadiusChangedEventArgs(radius));
if (IndicatorAccuracyRadiusChangedCommand?.CanExecute(radius) == true)
{
IndicatorAccuracyRadiusChangedCommand.Execute(radius);
}
}
public event EventHandler<IndicatorBearingChangedEventArgs> IndicatorBearingChanged;
public static readonly BindableProperty IndicatorBearingChangedCommandProperty = BindableProperty.Create(
nameof(IndicatorBearingChangedCommand),
typeof(ICommand),
typeof(MapboxView)
);
public ICommand IndicatorBearingChangedCommand
{
get => (ICommand)GetValue(IndicatorBearingChangedCommandProperty);
set => SetValue(IndicatorBearingChangedCommandProperty, value);
}
internal void InvokeIndicatorBearingChanged(double bearing)
{
IndicatorBearingChanged?.Invoke(this, new IndicatorBearingChangedEventArgs(bearing));
if (IndicatorBearingChangedCommand?.CanExecute(bearing) == true)
{
IndicatorBearingChangedCommand.Execute(bearing);
}
}
public event EventHandler<IndicatorPositionChangedEventArgs> IndicatorPositionChanged;
public static readonly BindableProperty IndicatorPositionChangedCommandProperty = BindableProperty.Create(
nameof(IndicatorPositionChangedCommand),
typeof(ICommand),
typeof(MapboxView)
);
public ICommand IndicatorPositionChangedCommand
{
get => (ICommand)GetValue(IndicatorPositionChangedCommandProperty);
set => SetValue(IndicatorPositionChangedCommandProperty, value);
}
internal void InvokeIndicatorPositionChanged(IPosition position)
{
IndicatorPositionChanged?.Invoke(this, new IndicatorPositionChangedEventArgs(position));
if (IndicatorPositionChangedCommand?.CanExecute(position) == true)
{
IndicatorPositionChangedCommand.Execute(position);
}
}
public event EventHandler<MapTappedEventArgs> MapTapped;
public static readonly BindableProperty CommandProperty = BindableProperty.Create(
nameof(Command),
typeof(ICommand),
typeof(MapboxView)
);
public ICommand Command
{
get => (ICommand)GetValue(CommandProperty);
set => SetValue(CommandProperty, value);
}
internal void InvokeMapTapped(MapTappedPosition point)
{
MapTapped?.Invoke(this, new MapTappedEventArgs(point));
if (Command?.CanExecute(point) == true)
{
Command.Execute(point);
}
}
public event EventHandler<MapTappedEventArgs> MapLongTapped;
internal void InvokeMapLongTapped(MapTappedPosition position)
{
MapLongTapped?.Invoke(this, new MapTappedEventArgs(position));
if (LongTapCommand?.CanExecute(position) == true)
{
LongTapCommand.Execute(position);
}
}
public static readonly BindableProperty LongTapCommandProperty = BindableProperty.Create(
nameof(LongTapCommand),
typeof(ICommand),
typeof(MapboxView)
);
public ICommand LongTapCommand
{
get => (ICommand)GetValue(LongTapCommandProperty);
set => SetValue(LongTapCommandProperty, value);
}
public event EventHandler MapReady;
internal void InvokeMapReady()
{
MapReady?.Invoke(this, EventArgs.Empty);
if (MapReadyCommand?.CanExecute(null) == true)
{
MapReadyCommand.Execute(null);
}
}
public static readonly BindableProperty MapReadyCommandProperty = BindableProperty.Create(
nameof(MapReadyCommand),
typeof(ICommand),
typeof(MapboxView),
default(ICommand)
);
public ICommand MapReadyCommand
{
get => (ICommand)GetValue(MapReadyCommandProperty);
set => SetValue(MapReadyCommandProperty, value);
}
public event EventHandler StyleLoaded;
internal void InvokeStyleLoaded()
{
StyleLoaded?.Invoke(this, EventArgs.Empty);
if (StyleLoadedCommand?.CanExecute(null) == true)
{
StyleLoadedCommand.Execute(null);
}
}
public static readonly BindableProperty StyleLoadedCommandProperty = BindableProperty.Create(
nameof(StyleLoadedCommand),
typeof(ICommand),
typeof(MapboxView),
default(ICommand)
);
public ICommand StyleLoadedCommand
{
get => (ICommand)GetValue(StyleLoadedCommandProperty);
set => SetValue(StyleLoadedCommandProperty, value);
}
public event EventHandler MapLoaded;
public static readonly BindableProperty MapLoadedCommandProperty = BindableProperty.Create(
nameof(MapLoadedCommand),
typeof(ICommand),
typeof(MapboxView),
default(ICommand)
);
public ICommand MapLoadedCommand
{
get => (ICommand)GetValue(MapLoadedCommandProperty);
set => SetValue(MapLoadedCommandProperty, value);
}
internal void InvokeMapLoaded()
{
MapLoaded?.Invoke(this, EventArgs.Empty);
if (MapLoadedCommand?.CanExecute(null) == true)
{
MapLoadedCommand.Execute(null);
}
}
public event EventHandler MapLoadingError;
public static readonly BindableProperty MapLoadingErrorCommandProperty = BindableProperty.Create(
nameof(MapLoadingErrorCommand),
typeof(ICommand),
typeof(MapboxView),
default(ICommand)
);
public ICommand MapLoadingErrorCommand
{
get => (ICommand)GetValue(MapLoadingErrorCommandProperty);
set => SetValue(MapLoadingErrorCommandProperty, value);
}
internal void InvokeMapLoadingError()
{
MapLoadingError?.Invoke(this, EventArgs.Empty);
if (MapLoadingErrorCommand?.CanExecute(null) == true)
{
MapLoadingErrorCommand.Execute(null);
}
}
}