Imports IntraSell_DLL

Public Class ucRoute
    Property PLZ As String
    Property Ort As String
    Property Adresse As String

    Sub RouteNach(_PLZ As String, _Ort As String, _Adresse As String)
        PLZ = _PLZ
        If PLZ.Contains("_") Then
            PLZ = PLZ.Split("_")(1)
        End If
        If PLZ.Contains("A-") Then
            PLZ = PLZ.Remove("A-")
        End If

        Ort = _Ort
        Adresse = _Adresse
    End Sub

    Sub Route()
        Try
            Dim route_from = Uri.EscapeDataString(VarValue_Default("Firma_Strasse", "Landstr.1") & "," & _
                                                         VarValue_Default("Firma_PLZ", "4020") & " " & _
                                                         VarValue_Default("Firma_Ort", "Linz") & ",Austria")

            Dim route_to = Uri.EscapeDataString(Adresse & "," & PLZ & " " & Ort & ",Austria")
            Dim url_GoogleMaps = "http://www.google.com/maps/dir/?origin=" & route_from & "&destination=" & route_to & "&travelmode=driving"
            'url = "https://www.bing.com/maps?rtp=~pos.rycz2z4tpkxm_555%20NE%2055th%20St,Redmond,WA_Pizza%20Parlor_425-555-5555"
            Dim url_Bing = "http://bing.com/maps/default.aspx?rtp=adr.One%Riedmarkstrasse%20,%20Engerwitzdorf,%204209~adr.Taubenmarkt%20,Linz,%204020&rtop=0~1~0"
            url_Bing = String.Format("http://bing.com/maps/default.aspx?rtp=adr.{0}~adr.{1}&rtop=0~1~0", route_from, route_to)

            If CheckBoxGoogleMaps.Checked Then
                url_Bing = url_GoogleMaps
            End If

            TextBoxURL.Text = url_Bing
            WebBrowser1.Navigate(url_Bing)
        Catch ex As Exception

        End Try
    End Sub

    Private Sub CheckBoxGoogleMaps_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBoxGoogleMaps.CheckedChanged
        Route()
    End Sub
End Class
