<?xml version="1.0" encoding="utf-8"?>
<PFScript xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<IsBound>false</IsBound>
<BindPath />
<ScriptLanguage>VB</ScriptLanguage>
<References>
<string>MapPoint.dll</string>
</References>
<Source>Imports System


Imports PhoneFrontObject
Imports Microsoft.VisualBasic

Public Class AreaInfo
Public Sub New(ByVal n As String, ByVal lt As String, ByVal ln As String)
name = n
latitude = lt
longitude = ln
End Sub

Public Function GetName()
Return name
End Function

Public Sub GetLatLong(ByRef lt As String, ByRef ln As String)
lt = latitude
ln = longitude
End Sub

Private name As String
Private latitude As String
Private longitude As String
Public Sub dump()
Console.WriteLine(name + " " + latitude + " " + longitude)
End Sub
End Class

Public Class Chunkette
Public Sub New(ByVal chunkname As String)
name_ = chunkname
a1 = New AreaInfo() {}
End Sub

Public Sub AddAreaInfo(ByVal area As String, ByVal lat As String, ByVal lon As String)
ReDim Preserve a1(a1.GetUpperBound(0) + 1)
a1(a1.GetUpperBound(0)) = New AreaInfo(area, lat, lon)
End Sub

Public Function GetName()
Return name_
End Function

Public Sub GetLatLong(ByVal index As Int16, ByRef lt As String, ByRef ln As String)
a1(index).GetLatLong(lt, ln)
End Sub

Private name_ As String
Private a1 As AreaInfo()

Public Sub dump()
Console.WriteLine(name_)
Dim i As AreaInfo

For Each i In a1
i.dump()
Next
End Sub

Public Sub BuildArray(ByRef arr As String())

arr = New String() {}

Dim i As AreaInfo
For Each i In a1
ReDim Preserve arr(arr.GetUpperBound(0) + 1)
arr(arr.GetUpperBound(0)) = New String(i.GetName())
Next

End Sub

End Class

Public Class AreaMap
Public Sub New()
areas_ = New Chunkette() {}
AddChunkName("As..Bl")
AddAreaInfo("ASHLAND", "52.01738207897", "-0.730730095426344")
AddAreaInfo("ATTERBURY", "52.0530820672119", "-0.706384001530729")
AddAreaInfo("BANCROFT", "52.0539499345162", "-0.788032039186508")
AddAreaInfo("BANCROFT PARK", "52.054069298774", "-0.799696376884553")
AddAreaInfo("BEANHILL", "52.0175070534213", "-0.742384669782257")
AddAreaInfo("BLAKELANDS", "52.075033151798", "-0.740769000914645")
AddAreaInfo("BLEAK HALL", "52.0176308751963", "-0.754039328550041")
AddAreaInfo("BLETCHLEY", "51.9959346115866", "-0.74298915152133")
AddAreaInfo("BLUE BRIDGE", "52.0612602034784", "-0.799503651832278")
AddChunkName("Bo..Br")
AddAreaInfo("BOLBECK PARK", "52.0678424223646", "-0.740971255786758")
AddAreaInfo("BRADVILLE", "52.0611408085155", "-0.787837441965636")
AddAreaInfo("BRADWELL", "52.0467590511674", "-0.788226554894992")
AddAreaInfo("BRADWELL ABBEY", "52.04687838473", "-0.799889021208107")
AddAreaInfo("BRADWELL COMMON", "52.0466385636673", "-0.776564170049043")
AddAreaInfo("BRINKLOW", "52.031251908377", "-0.683690564743947")
AddAreaInfo("BROOKFURLONG", "52.0529534696135", "-0.694720337872305")
AddAreaInfo("BROUGHTON", "52.0529534696135", "-0.694720337872305")
AddAreaInfo("BROWNS WOOD", "52.0168706547914", "-0.684112657747255")
AddChunkName("Ca..Do")
AddAreaInfo("CALDECOTTE", "52.0098095654837", "-0.695975933591754")
AddAreaInfo("CAMPBELL PARK", "52.0462701777288", "-0.741577512145995")
AddAreaInfo("CENTRAL BLETCHLEY", "51.9958097334855", "-0.731340176552357")
AddAreaInfo("CENTRAL M K", "52.0393260918102", "-0.765100042761984")
AddAreaInfo("COFFEE HALL", "52.024697848584", "-0.742183007108183")
AddAreaInfo("CONNIBURROW", "52.0465169222482", "-0.764901867453457")
AddAreaInfo("CROWNHILL", "52.032496528622", "-0.800274067848547")
AddAreaInfo("DENBIGH EAST", "52.0028744624429", "-0.719486145739189")
AddAreaInfo("DENBIGH HALL", "52.0104400388118", "-0.754239039522409")
AddAreaInfo("DENBIGH NORTH", "52.0101913065434", "-0.7309335409317")
AddAreaInfo("DENBIGH WEST", "52.0030005247153", "-0.731136901291279")
AddAreaInfo("DOWNHEAD PARK", "52.0606516835422", "-0.74117342591794")
AddAreaInfo("DOWNS BARN", "52.0534609353303", "-0.741375511355321")
AddChunkName("Ea..Fu")
AddAreaInfo("EAGLESTONE", "52.0318886343559", "-0.741981259975421")
AddAreaInfo("EAGLESTONE WEST", "52.024697848584", "-0.742183007108183")
AddAreaInfo("ELFIELD PARK", "52.0176308751963", "-0.754039328550041")
AddAreaInfo("EMERSON VALLEY", "52.0034932529642", "-0.777740766680931")
AddAreaInfo("FAR BLETCHLEY", "51.996180912405", "-0.766287353493238")
AddAreaInfo("FENNY LOCK", "52.0027472481252", "-0.707835476066117")
AddAreaInfo("FENNY STRATFORD", "51.9956837036155", "-0.719691286634742")
AddAreaInfo("FISHERMEAD", "52.0390794107375", "-0.741779428337021")
AddAreaInfo("FOX MILNE", "52.0532095107107", "-0.718047752186325")
AddAreaInfo("FULLERS SLADE", "52.0472294616077", "-0.834876901117953")
AddAreaInfo("FURZTON", "52.0105626763566", "-0.765891914584328")
AddAreaInfo("FURZTON LAKE", "52.0177535442758", "-0.76569407094834")
AddChunkName("Gi..Kn")
AddAreaInfo("GIFFARD PARK", "52.0678424223646", "-0.740971255786758")
AddAreaInfo("GRANBY", "52.0103162488677", "-0.742586248044559")
AddAreaInfo("GRANGEFARM", "52.0254236750264", "-0.812123407660562")
AddAreaInfo("GREAT HOLM", "52.032496528622", "-0.800274067848547")
AddAreaInfo("GREAT LINFORD", "52.0680893573456", "-0.764306843142515")
AddAreaInfo("GREENLEYS", "52.0543045645128", "-0.82302529368339")
AddAreaInfo("HAZELEY", "52.0182326932613", "-0.812313861218358")
AddAreaInfo("HEELANDS", "52.0538294160242", "-0.776367783000947")
AddAreaInfo("HODGE", "52.0469965643364", "-0.811551568205155")
AddAreaInfo("KENTS HILL", "52.031381559993", "-0.695348530085895")
AddAreaInfo("KENTS HILL PARK", "52.0243193699782", "-0.707213936470663")
AddAreaInfo("KILN FARM", "52.0471135899683", "-0.823214195102871")
AddAreaInfo("KINGSMEAD", "52.0037327043179", "-0.801043194357323")
AddAreaInfo("KINGSTON", "52.0384425210056", "-0.683479385642542")
AddAreaInfo("KNOWLHILL", "52.0250659504378", "-0.777152837874567")
AddChunkName("Le..No")
AddAreaInfo("LEADENHALL", "52.0248217022", "-0.753839533947255")
AddAreaInfo("LINFORD WOOD", "52.0537077433166", "-0.764703609111502")
AddAreaInfo("LOUGHTON", "52.0323772564205", "-0.788615341956033")
AddAreaInfo("LOUGHTON LODGE", "52.039568158469", "-0.788420989136406")
AddAreaInfo("MEDBOURNE", "52.0181146351521", "-0.800658792112251")
AddAreaInfo("MIDDLETON", "52.0458914070353", "-0.706591615640455")
AddAreaInfo("MILTON KEYNES VILLAGE", "52.0458914070353", "-0.706591615640455")
AddAreaInfo("MONKSTON", "52.0315100584187", "-0.707006583062114")
AddAreaInfo("MONKSTON PARK", "52.0316374036342", "-0.718664722890523")
AddAreaInfo("MOUNTFARM", "52.0100652118582", "-0.719280918964719")
AddAreaInfo("NEATH HILL", "52.060775696516", "-0.752839304848966")
AddAreaInfo("NETHERFIELD", "52.01738207897", "-0.730730095426344")
AddAreaInfo("NEW BRADWELL", "52.0684510988434", "-0.799310846006365")
AddAreaInfo("NEWLANDS", "52.05333580009", "-0.729711589055674")
AddAreaInfo("NORTHFIELD", "52.0530820672119", "-0.706384001530729")
AddChunkName("Oa..Ro")
AddAreaInfo("OAKGROVE", "52.0388281154038", "-0.71845915212292")
AddAreaInfo("OAKHILL", "52.0182326932613", "-0.812313861218358")
AddAreaInfo("OLD BLETCHLEY", "51.9959346115866", "-0.74298915152133")
AddAreaInfo("OLDBROOK", "52.0320125198232", "-0.75363965566757")
AddAreaInfo("OLD FARM PARK", "52.0167399172525", "-0.672458517169767")
AddAreaInfo("OLD WOLVERTON", "52.0686864856413", "-0.822647253316526")
AddAreaInfo("OPEN UNIVERSITY", "52.0243193699782", "-0.707213936470663")
AddAreaInfo("OXLEY PARK", "52.0109236744057", "-0.800851033464755")
AddAreaInfo("PEARTREE BRIDGE", "52.0317635956198", "-0.73032294878901")
AddAreaInfo("PENNYLAND", "52.0606516835422", "-0.74117342591794")
AddAreaInfo("PINEHAM", "52.0602727179677", "-0.706176300423932")
AddAreaInfo("REDMOOR", "52.0175070534213", "-0.742384669782257")
AddAreaInfo("ROOKSLEY", "52.0394477019508", "-0.776760474846872")
AddChunkName("Sh..St")
AddAreaInfo("SHENLEY BROOK END", "52.0108044941722", "-0.789197912336511")
AddAreaInfo("SHENLEY CHURCH END", "52.0251863450217", "-0.788809613399122")
AddAreaInfo("SHENLEY LODGE", "52.0178750606408", "-0.777348896195765")
AddAreaInfo("SHENLEY WOOD", "52.0181146351521", "-0.800658792112251")
AddAreaInfo("SIMPSON", "52.0172559518617", "-0.719075606263622")
AddAreaInfo("SNELSHALL EAST", "51.9820406802573", "-0.78997353567997")
AddAreaInfo("SNELSHALL WEST", "51.9820406802573", "-0.78997353567997")
AddAreaInfo("SPRINGFIELD", "52.0390794107375", "-0.741779428337021")
AddAreaInfo("STACEY BUSHES", "52.054069298774", "-0.799696376884553")
AddAreaInfo("STANTONBURY", "52.0608985550156", "-0.764505267689929")
AddAreaInfo("STANTONBURY FIELDS", "52.0608985550156", "-0.764505267689929")
AddAreaInfo("STONEBRIDGE", "52.0612602034784", "-0.799503651832278")
AddAreaInfo("STONY STRATFORD", "52.0545352130947", "-0.846354527127708")
AddChunkName("Ta..Tw")
AddAreaInfo("TATTENHOE", "51.9964226059182", "-0.789585886309876")
AddAreaInfo("TATTENHOE PARK", "51.9821597380036", "-0.801619194722015")
AddAreaInfo("THE BOWL", "52.0177535442758", "-0.76569407094834")
AddAreaInfo("TILBROOK", "52.0096800138339", "-0.684323571747362")
AddAreaInfo("TINKERS BRIDGE", "52.0172559518617", "-0.719075606263622")
AddAreaInfo("TONGWELL", "52.0677172227367", "-0.729303588828225")
AddAreaInfo("TOWERGATE", "52.031251908377", "-0.683690564743947")
AddAreaInfo("TWO MILE ASH", "52.0398056105636", "-0.811742261198323")
AddChunkName("Wa..Wi")
AddAreaInfo("WALNUT TREE", "52.0170002397526", "-0.695766886642848")
AddAreaInfo("WALTON", "52.017128672116", "-0.707421203075374")
AddAreaInfo("WALTON HALL", "52.0243193699782", "-0.707213936470663")
AddAreaInfo("WALTON PARK", "52.0099379648317", "-0.707628382924466")
AddAreaInfo("WATER EATON", "51.9813021577236", "-0.720101310979757")
AddAreaInfo("WAVENDON GATE", "52.0240612863057", "-0.683901655429145")
AddAreaInfo("WEST ASHLAND", "52.0101913065434", "-0.7309335409317")
AddAreaInfo("WEST BLETCHLEY", "52.0032491930463", "-0.754438666910806")
AddAreaInfo("WEST ROOKSLEY", "52.039568158469", "-0.788420989136406")
AddAreaInfo("WESTCROFT", "52.0037327043179", "-0.801043194357323")
AddAreaInfo("WILLEN", "52.0604001942485", "-0.717841922921514")
AddAreaInfo("WILLEN LAKE", "52.0532095107107", "-0.718047752186325")
AddAreaInfo("WILLEN PARK", "52.0605265161132", "-0.729507631680813")
AddAreaInfo("WINTERHILL", "52.0321352520023", "-0.765298135083233")
AddChunkName("Wo..Wy")
AddAreaInfo("WOLVERTON", "52.0613784438916", "-0.811169942472653")
AddAreaInfo("WOLVERTON MILL", "52.0616114609964", "-0.834502762938018")
AddAreaInfo("WOLVERTON MILL EAST", "52.0616114609964", "-0.834502762938018")
AddAreaInfo("WOLVERTON MILL SOUTH", "52.0544204659574", "-0.834689871216744")
AddAreaInfo("WOODHILL", "52.0110417021648", "-0.812504235053032")
AddAreaInfo("WOOLSTONE", "52.0389543398436", "-0.730119247562297")
AddAreaInfo("WOUGHTON ON THE GREEN", "52.0317635956198", "-0.73032294878901")
AddAreaInfo("WOUGHTON PARK", "52.0244466824536", "-0.718870207588151")
AddAreaInfo("WYMBUSH", "52.0396874613461", "-0.800081584847822")
End Sub
Private Sub AddChunkName(ByVal x As String)
ReDim Preserve areas_(areas_.GetUpperBound(0) + 1)
areas_(areas_.GetUpperBound(0)) = New Chunkette(x)
'Console.WriteLine(areas_.GetUpperBound(0))
End Sub

Public Sub BuildRootArray(ByRef arr As String())

arr = New String() {}

Dim i As Chunkette
For Each i In areas_
ReDim Preserve arr(arr.GetUpperBound(0) + 1)
arr(arr.GetUpperBound(0)) = New String(i.GetName())
Next

End Sub

Public Sub BuildAlphaArray(ByVal i As Int16, ByRef arr As String())
areas_(i).BuildArray(arr)
End Sub

Public Sub GetLatLong(ByVal chunk As Int16, ByVal index As Int16, ByRef lt As String, ByRef ln As String)
areas_(chunk).GetLatLong(index, lt, ln)
End Sub

Private Sub AddAreaInfo(ByVal area As String, ByVal lat As String, ByVal lon As String)
areas_(areas_.GetUpperBound(0)).AddAreaInfo(area, lat, lon)
End Sub

Public Sub dump()
Dim i As Chunkette
For Each i In areas_
i.dump()
Next
End Sub

Private areas_ As Chunkette()
End Class



Public Class PhoneFrontScript

Public Shared Sub Main()

Dim MKMap As AreaMap = New AreaMap
Dim lt As String
Dim ln As String

Dim oMpApp As MapPoint.Application
Dim objLoc As MapPoint.Location

Try
oMpApp = GetObject(, "MapPoint.Application")
Catch ex As System.Exception
oMpApp = New MapPoint.Application()
MKMap.GetLatLong(2, 3, lt, ln) ' CMK!
objLoc = oMpApp.ActiveMap.GetLocation(lt, ln)
objLoc.GoTo
oMpApp.ActiveMap.ZoomIn
oMpApp.ActiveMap.ZoomIn
oMpApp.ActiveMap.ZoomIn
oMpApp.ActiveMap.ZoomIn
oMpApp.ActiveMap.ZoomIn
oMpApp.ActiveMap.ZoomIn
oMpApp.ActiveMap.ZoomIn
End Try

oMpApp.WindowState = 0

oMpApp.Visible = True
oMpApp.UserControl = True

Dim menu As String()
MKMap.BuildRootArray(menu)

Dim chunk As Integer = My.Phone.ShowMenu("Area Key", 0, menu)
if (chunk &lt; 0)
return
end if

MKMap.BuildAlphaArray(chunk , menu)
Dim oom1 As Integer = My.Phone.ShowMenu("Area Names", 0, menu)

if (oom1 &lt; 0)
return
end if

MKMap.GetLatLong(chunk , oom1 , lt, ln)
objLoc = oMpApp.ActiveMap.GetLocation(lt, ln)

Dim objPushpin As MapPoint.Pushpin = oMpApp.ActiveMap.AddPushpin(objLoc, menu(oom1))
' Browse to the pushpin.
objPushpin.GoTo()
' Highlight the pushpin.
objPushpin.Highlight = True

End Sub
End Class


</Source>
</PFScript>