Skip to content

Commit 20a1871

Browse files
committed
- Add global usings
1 parent 6bed053 commit 20a1871

File tree

18 files changed

+75
-77
lines changed

18 files changed

+75
-77
lines changed

build.cake

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Task("example")
2929

3030
Information($"\n>> Generate >> {name}ExampleInfo.cs");
3131
FileWriteText($@"{exampleFolderPath}/{name}ExampleInfo.cs", $@"namespace MapboxMauiQs;
32+
3233
class {name}ExampleInfo : IExampleInfo
3334
{{
3435
public string Group => ""{group ?? "None"}"";
@@ -38,10 +39,7 @@ class {name}ExampleInfo : IExampleInfo
3839
}}");
3940

4041
Information($"\n>> Generate >> {name}ExamplePage.cs");
41-
FileWriteText($"{exampleFolderPath}/{name}Example.cs", $@"{"using"} System;
42-
{"using"} MapboxMaui;
43-
{"using"} iOSPage = Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.Page;
44-
namespace MapboxMauiQs;
42+
FileWriteText($"{exampleFolderPath}/{name}Example.cs", $@"namespace MapboxMauiQs;
4543
4644
public class {name}Example : ContentPage, IExamplePage, IQueryAttributable
4745
{{
@@ -54,18 +52,24 @@ public class {name}Example : ContentPage, IExamplePage, IQueryAttributable
5452
Content = map = new MapboxView();
5553
5654
map.MapReady += Map_MapReady;
55+
map.MapLoaded += Map_MapLoaded;
5756
}}
5857
58+
public void ApplyQueryAttributes(IDictionary<string, object> query)
59+
{{
60+
info = query[""example""] as IExampleInfo;
61+
62+
Title = info?.Title;
63+
}}
64+
5965
private void Map_MapReady(object sender, EventArgs e)
6066
{{
6167
// Setup Map here
6268
}}
6369
64-
public void ApplyQueryAttributes(IDictionary<string, object> query)
70+
private void Map_MapLoaded(object sender, EventArgs e)
6571
{{
66-
info = query[""example""] as IExampleInfo;
67-
68-
Title = info?.Title;
72+
// Setup Styles, Annotations, etc here
6973
}}
7074
}}");
7175
});

src/qs/MapboxMauiQs/Examples/01.AddMarkersSymbol/AddMarkersSymbolExample.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
using System.Text.Json;
2-
using GeoJSON.Text.Feature;
3-
using MapboxMaui;
4-
using MapboxMaui.Expressions;
5-
using MapboxMaui.Styles;
6-
using iOSPage = Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.Page;
71
namespace MapboxMauiQs;
82

93
public class AddMarkersSymbolExample : ContentPage, IExamplePage, IQueryAttributable

src/qs/MapboxMauiQs/Examples/02.AddOneMarkerSymbol/AddOneMarkerSymbolExample.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
using MapboxMaui;
2-
using MapboxMaui.Annotations;
3-
using MapboxMaui.Styles;
4-
using iOSPage = Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.Page;
51
namespace MapboxMauiQs;
62

73
public class AddOneMarkerSymbolExample : ContentPage, IExamplePage, IQueryAttributable

src/qs/MapboxMauiQs/Examples/09.BasicMap/BasicMapExample.xaml.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using MapboxMaui;
2-
using iOSPage = Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.Page;
3-
4-
namespace MapboxMauiQs;
1+
namespace MapboxMauiQs;
52

63
public partial class BasicMapExample : ContentPage, IExamplePage, IQueryAttributable
74
{

src/qs/MapboxMauiQs/Examples/10.BuildingExtrusions/BuildingExtrusionsExample.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
using MapboxMaui;
2-
using MapboxMaui.Expressions;
3-
using MapboxMaui.Styles;
4-
using iOSPage = Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.Page;
51
namespace MapboxMauiQs;
62

73
public class BuildingExtrusionsExample : ContentPage, IExamplePage, IQueryAttributable

src/qs/MapboxMauiQs/Examples/13.CircleAnnotation/CircleAnnotationExample.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
using System;
2-
using MapboxMaui;
3-
using MapboxMaui.Annotations;
4-
using MapboxMaui.Styles;
5-
using iOSPage = Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.Page;
61
namespace MapboxMauiQs;
72

83
public class CircleAnnotationExample : ContentPage, IExamplePage, IQueryAttributable
@@ -35,7 +30,7 @@ private void Map_MapLoaded(object sender, EventArgs e)
3530

3631
var circleAnnotation = new CircleAnnotation(
3732
new GeoJSON.Text.Geometry.Point(
38-
new GeoJSON.Text.Geometry.Position(center.X, center.Y)
33+
new Position(center.X, center.Y)
3934
)
4035
)
4136
{
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
namespace MapboxMauiQs;
2+
3+
public class CustomPointAnnotationExample : ContentPage, IExamplePage, IQueryAttributable
4+
{
5+
MapboxView map;
6+
IExampleInfo info;
7+
8+
public CustomPointAnnotationExample()
9+
{
10+
iOSPage.SetUseSafeArea(this, false);
11+
Content = map = new MapboxView();
12+
13+
map.MapReady += Map_MapReady;
14+
}
15+
16+
private void Map_MapReady(object sender, EventArgs e)
17+
{
18+
var centerLocation = new Point(40.7128, -74.0060);
19+
var cameraOptions = new CameraOptions
20+
{
21+
Center = centerLocation,
22+
Zoom = 9,
23+
};
24+
25+
map.CameraOptions = cameraOptions;
26+
map.MapboxStyle = MapboxStyle.MAPBOX_STREETS;
27+
}
28+
29+
public void ApplyQueryAttributes(IDictionary<string, object> query)
30+
{
31+
info = query["example"] as IExampleInfo;
32+
33+
Title = info?.Title;
34+
}
35+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace MapboxMauiQs;
2+
class CustomPointAnnotationExampleInfo : IExampleInfo
3+
{
4+
public string Group => "Annotations";
5+
public string Title => "Add Point Annotations";
6+
public string Subtitle => "Show point annotations on a map";
7+
public string PageRoute => typeof(CustomPointAnnotationExample).FullName;
8+
}

src/qs/MapboxMauiQs/Examples/20.CustomStyleURL/CustomStyleURLExample.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using System;
2-
using MapboxMaui;
3-
using iOSPage = Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.Page;
4-
5-
namespace MapboxMauiQs;
1+
namespace MapboxMauiQs;
62

73
public class CustomStyleURLExample : ContentPage, IExamplePage, IQueryAttributable
84
{

src/qs/MapboxMauiQs/Examples/23.DebugMap/DebugMapExample.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
using System;
2-
using MapboxMaui;
3-
using iOSPage = Microsoft.Maui.Controls.PlatformConfiguration.iOSSpecific.Page;
41
namespace MapboxMauiQs;
52

63
public class DebugMapExample : ContentPage, IExamplePage, IQueryAttributable

0 commit comments

Comments
 (0)