// Constructor public UI_OnlineGoogleMap() { InitializeComponent(); InitializeTrackingImages(); //NOTE: Redundans omkring application bar buttons og handlinger, f.eks. changeFloor InitializeMenu(); mWebMapCommon = new Map2DOnline(webBrowserOnline); mWebMapCommon.OnTitleChange += (source, titleArgs) => this.ApplicationTitle.Text = titleArgs.Title; mWebMapCommon.OnIsTrackingChange += (source, irrelevantArgs) => { if (mWebMapCommon.IsTrackingPosition) { trackImg.Source = imgTrackingOn; } else { trackImg.Source = imgTrackingOff; } }; mWebMapCommon.OnNoBuildingFound += (sender, args) => { StringBuilder sb = new StringBuilder(); sb.Append("No building found. \n"); sb.Append("This may be caused by three things: \n"); sb.Append("1) A connection problem. Please check that you have connectivity\n"); sb.Append("2) An invalid Mac address. Please check the menu item 'set mac address'\n"); sb.Append("3) No Wi-Fi sniffer infrastructure is present. In this case, please contact the appropriate building administrator"); Dispatcher.BeginInvoke(() => { MessageBox.Show(sb.ToString()); mWebMapCommon.setProvider(Map2DOnline.ProviderStatus.USE_NONE); }); }; mWebMapCommon.OnProviderChange += (sender, args) => { switch (mWebMapCommon.mProviderStatus) { case Map2DOnline.ProviderStatus.USE_GPS: menuProvider.IconUri = new Uri(Globals.IconUri_ProviderGps, UriKind.Relative); break; case Map2DOnline.ProviderStatus.USE_WIFI: menuProvider.IconUri = new Uri(Globals.IconUri_ProviderWifi, UriKind.Relative); break; case Map2DOnline.ProviderStatus.USE_NONE: menuProvider.IconUri = new Uri(Globals.IconUri_ProviderNone, UriKind.Relative); break; } }; }
public UI_OnlineBingMap() { InitializeComponent(); ApplicationTitle.Text = Globals.AppName; InitializeTrackingImages(); //NOTE: Redundans omkring application bar buttons og handlinger, f.eks. changeFloor InitializeMenu(); InitializeMap(); InitializeWifiProgressIndicator(); mWebMapCommon = new Map2DOnline(); mWebMapCommon.OnTitleChange += (source, titleArgs) => this.ApplicationTitle.Text = titleArgs.Title; mWebMapCommon.OnCenterChange += (sender, coordinateArgs) => graphMap.Center = new GeoCoordinate(coordinateArgs.Latitude, coordinateArgs.Longitude); mWebMapCommon.OnVisibleVerticesChange += (sender, visibleVerticesArgs) => { IEnumerable <Vertex> vertices = visibleVerticesArgs.VisibleVertices; if (vertices == null) { return; } foreach (Vertex v in vertices) { AddVertexPin(v); } }; mWebMapCommon.OnClearOverlayChange += (sender, args) => { ClearOverlays(); }; mWebMapCommon.OnIsTrackingChange += (source, irrelevantArgs) => { if (mWebMapCommon.IsTrackingPosition) { trackImg.Source = imgTrackingOn; } else { trackImg.Source = imgTrackingOff; } }; mWebMapCommon.OnGpsPositionChange += (object sender, GeoPositionChangedEventArgs <GeoCoordinate> args) => { UI_UpdateCurrentPosition(args.Position.Location.Latitude, args.Position.Location.Longitude); }; mWebMapCommon.OnPositionEstimateChange += (sender, positionEstimateArgs) => { //Update the UI (invoked from a background thread - hence Dispatch.Invoke Dispatcher.BeginInvoke( () => { UI_UpdateCurrentPosition(positionEstimateArgs.Location.Latitude, positionEstimateArgs.Location.Longitude); } ); }; mWebMapCommon.OnNoBuildingFound += (sender, args) => { StringBuilder sb = new StringBuilder(); sb.Append("No building found. \n"); sb.Append("This may be caused by three things: \n"); sb.Append("1) A connection problem. Please check that you have connectivity\n"); sb.Append("2) An invalid Mac address. Please check the menu item 'set mac address'\n"); sb.Append("3) No Wi-Fi sniffer infrastructure is present. In this case, please contact the appropriate building administrator"); Dispatcher.BeginInvoke(() => { MessageBox.Show(sb.ToString()); wifiProgressIndicator.IsVisible = false; mWebMapCommon.setProvider(Map2DOnline.ProviderStatus.USE_NONE); }); }; mWebMapCommon.OnProviderChange += (sender, args) => { switch (mWebMapCommon.mProviderStatus) { case Map2DOnline.ProviderStatus.USE_GPS: menuProvider.IconUri = new Uri(Globals.IconUri_ProviderGps, UriKind.Relative); break; case Map2DOnline.ProviderStatus.USE_WIFI: wifiProgressIndicator.IsVisible = true; menuProvider.IconUri = new Uri(Globals.IconUri_ProviderWifi, UriKind.Relative); break; case Map2DOnline.ProviderStatus.USE_NONE: menuProvider.IconUri = new Uri(Globals.IconUri_ProviderNone, UriKind.Relative); break; } }; mWebMapCommon.setProvider(Map2DOnline.ProviderStatus.USE_NONE); }
public UI_OnlineBingMap() { InitializeComponent(); ApplicationTitle.Text = Globals.AppName; InitializeTrackingImages(); //NOTE: Redundans omkring application bar buttons og handlinger, f.eks. changeFloor InitializeMenu(); InitializeMap(); InitializeWifiProgressIndicator(); mWebMapCommon = new Map2DOnline(); mWebMapCommon.OnTitleChange += (source, titleArgs) => this.ApplicationTitle.Text = titleArgs.Title; mWebMapCommon.OnCenterChange += (sender, coordinateArgs) => graphMap.Center = new GeoCoordinate(coordinateArgs.Latitude, coordinateArgs.Longitude); mWebMapCommon.OnVisibleVerticesChange += (sender, visibleVerticesArgs) => { IEnumerable<Vertex> vertices = visibleVerticesArgs.VisibleVertices; if (vertices == null) return; foreach (Vertex v in vertices) { AddVertexPin(v); } }; mWebMapCommon.OnClearOverlayChange += (sender, args) => { ClearOverlays(); }; mWebMapCommon.OnIsTrackingChange += (source, irrelevantArgs) => { if (mWebMapCommon.IsTrackingPosition) { trackImg.Source = imgTrackingOn; } else { trackImg.Source = imgTrackingOff; } }; mWebMapCommon.OnGpsPositionChange += (object sender, GeoPositionChangedEventArgs<GeoCoordinate> args) => { UI_UpdateCurrentPosition(args.Position.Location.Latitude, args.Position.Location.Longitude); }; mWebMapCommon.OnPositionEstimateChange += (sender, positionEstimateArgs) => { //Update the UI (invoked from a background thread - hence Dispatch.Invoke Dispatcher.BeginInvoke( () => { UI_UpdateCurrentPosition(positionEstimateArgs.Location.Latitude, positionEstimateArgs.Location.Longitude); } ); }; mWebMapCommon.OnNoBuildingFound += (sender, args) => { StringBuilder sb = new StringBuilder(); sb.Append("No building found. \n"); sb.Append("This may be caused by three things: \n"); sb.Append("1) A connection problem. Please check that you have connectivity\n"); sb.Append("2) An invalid Mac address. Please check the menu item 'set mac address'\n"); sb.Append("3) No Wi-Fi sniffer infrastructure is present. In this case, please contact the appropriate building administrator"); Dispatcher.BeginInvoke(() => { MessageBox.Show(sb.ToString()); wifiProgressIndicator.IsVisible = false; mWebMapCommon.setProvider(Map2DOnline.ProviderStatus.USE_NONE); }); }; mWebMapCommon.OnProviderChange += (sender, args) => { switch (mWebMapCommon.mProviderStatus) { case Map2DOnline.ProviderStatus.USE_GPS: menuProvider.IconUri = new Uri(Globals.IconUri_ProviderGps, UriKind.Relative); break; case Map2DOnline.ProviderStatus.USE_WIFI: wifiProgressIndicator.IsVisible = true; menuProvider.IconUri = new Uri(Globals.IconUri_ProviderWifi, UriKind.Relative); break; case Map2DOnline.ProviderStatus.USE_NONE: menuProvider.IconUri = new Uri(Globals.IconUri_ProviderNone, UriKind.Relative); break; } }; mWebMapCommon.setProvider(Map2DOnline.ProviderStatus.USE_NONE); }