public void UpdateView(MapUpdateReason reason) { Core.DebugLog(Framework.Data.DebugLogLevel.Info, OwnerPlugin, null, string.Format("GMap: UpdateView({0})", reason)); if (radioButtonActive.Checked && (_activeMapType != MapType.SingleGeocache || reason== MapUpdateReason.MapSettingsChanged)) { _activeMapType = MapType.SingleGeocache; DisplayHtml(_defaultSingleGeocachehtml.Replace("<!-- %SingleGeocache.js% -->", setIcons(_defaultSingleGeocachejs))); reason = MapUpdateReason.Init; } else if (radioButtonSelected.Checked && (_activeMapType != MapType.SelectedGeocaches || reason == MapUpdateReason.MapSettingsChanged)) { _activeMapType = MapType.SelectedGeocaches; DisplayHtml(_defaultMultipleGeocachehtml.Replace("<!-- %MultipleGeocache.js% -->", setIcons(_defaultMultipleGeocachejs))); reason = MapUpdateReason.Init; } else if (radioButtonAll.Checked && (_activeMapType != MapType.Allgeocaches || reason == MapUpdateReason.MapSettingsChanged)) { _activeMapType = MapType.Allgeocaches; DisplayHtml(_defaultMultipleGeocachehtml.Replace("<!-- %MultipleGeocache.js% -->", setIcons(_defaultMultipleGeocachejs))); reason = MapUpdateReason.Init; } if (_webpageLoaded) { switch (_activeMapType) { case MapType.SingleGeocache: break; case MapType.Allgeocaches: if (reason == MapUpdateReason.Init || reason == MapUpdateReason.DataChanged) { addGeocachesToMap((from Framework.Data.Geocache wp in Core.Geocaches select wp).OrderBy(x=>x.Code).ToList()); if (PluginSettings.Instance.AddSelectedMarkers) { markSelectedGeocaches((from Framework.Data.Geocache wp in Core.Geocaches select wp).OrderBy(x => x.Code).ToList()); } } else if (reason == MapUpdateReason.SelectedChanged) { if (PluginSettings.Instance.AddSelectedMarkers) { markSelectedGeocaches((from Framework.Data.Geocache wp in Core.Geocaches select wp).OrderBy(x => x.Code).ToList()); } } break; case MapType.SelectedGeocaches: if (reason == MapUpdateReason.Init || reason == MapUpdateReason.DataChanged || reason == MapUpdateReason.SelectedChanged) { addGeocachesToMap(Utils.DataAccess.GetSelectedGeocaches(Core.Geocaches)); } break; } //and always do: if (Core.ActiveGeocache == null) { executeScript(string.Format("setGeocache('','','', {0}, {1},'')", Core.CenterLocation.Lat.ToString(CultureInfo.InvariantCulture), Core.CenterLocation.Lon.ToString(CultureInfo.InvariantCulture))); addWaypointsToMap(null); } else { if (Core.ActiveGeocache.ContainsCustomLatLon) { executeScript(string.Format("setGeocache('gapp://{0}', '{1}','{2}', {3}, {4}, '{5}')", Utils.ImageSupport.Instance.GetImagePath(Core, Framework.Data.ImageSize.Medium, Core.ActiveGeocache.GeocacheType).Replace('\\', '/'), Core.ActiveGeocache.Code, HttpUtility.HtmlEncode(Core.ActiveGeocache.Name), ((double)Core.ActiveGeocache.CustomLat).ToString(CultureInfo.InvariantCulture), ((double)Core.ActiveGeocache.CustomLon).ToString(CultureInfo.InvariantCulture), string.Format("gct{0}IconC", Core.ActiveGeocache.GeocacheType.ID.ToString().Replace("-", "_")))); } else { executeScript(string.Format("setGeocache('gapp://{0}', '{1}','{2}', {3}, {4}, '{5}')", Utils.ImageSupport.Instance.GetImagePath(Core, Framework.Data.ImageSize.Medium, Core.ActiveGeocache.GeocacheType).Replace('\\','/'), Core.ActiveGeocache.Code, HttpUtility.HtmlEncode(Core.ActiveGeocache.Name), Core.ActiveGeocache.Lat.ToString(CultureInfo.InvariantCulture), Core.ActiveGeocache.Lon.ToString(CultureInfo.InvariantCulture), string.Format("gct{0}Icon", Core.ActiveGeocache.GeocacheType.ID.ToString().Replace("-", "_")))); } addWaypointsToMap(Utils.DataAccess.GetWaypointsFromGeocache(Core.Waypoints,Core.ActiveGeocache.Code)); } } }
public void UpdateView(MapUpdateReason reason) { Core.DebugLog(Framework.Data.DebugLogLevel.Info, OwnerPlugin, null, string.Format("GMap: UpdateView({0})", reason)); if (radioButtonActive.Checked && (_activeMapType != MapType.SingleGeocache || reason == MapUpdateReason.MapSettingsChanged)) { _activeMapType = MapType.SingleGeocache; DisplayHtml(_defaultSingleGeocachehtml.Replace("<!-- %SingleGeocache.js% -->", setIcons(_defaultSingleGeocachejs))); reason = MapUpdateReason.Init; } else if (radioButtonSelected.Checked && (_activeMapType != MapType.SelectedGeocaches || reason == MapUpdateReason.MapSettingsChanged)) { _activeMapType = MapType.SelectedGeocaches; DisplayHtml(_defaultMultipleGeocachehtml.Replace("<!-- %MultipleGeocache.js% -->", setIcons(_defaultMultipleGeocachejs))); reason = MapUpdateReason.Init; } else if (radioButtonAll.Checked && (_activeMapType != MapType.Allgeocaches || reason == MapUpdateReason.MapSettingsChanged)) { _activeMapType = MapType.Allgeocaches; DisplayHtml(_defaultMultipleGeocachehtml.Replace("<!-- %MultipleGeocache.js% -->", setIcons(_defaultMultipleGeocachejs))); reason = MapUpdateReason.Init; } if (_webpageLoaded) { switch (_activeMapType) { case MapType.SingleGeocache: break; case MapType.Allgeocaches: if (reason == MapUpdateReason.Init || reason == MapUpdateReason.DataChanged) { addGeocachesToMap((from Framework.Data.Geocache wp in Core.Geocaches select wp).OrderBy(x => x.Code).ToList()); if (PluginSettings.Instance.AddSelectedMarkers) { markSelectedGeocaches((from Framework.Data.Geocache wp in Core.Geocaches select wp).OrderBy(x => x.Code).ToList()); } } else if (reason == MapUpdateReason.SelectedChanged) { if (PluginSettings.Instance.AddSelectedMarkers) { markSelectedGeocaches((from Framework.Data.Geocache wp in Core.Geocaches select wp).OrderBy(x => x.Code).ToList()); } } break; case MapType.SelectedGeocaches: if (reason == MapUpdateReason.Init || reason == MapUpdateReason.DataChanged || reason == MapUpdateReason.SelectedChanged) { addGeocachesToMap(Utils.DataAccess.GetSelectedGeocaches(Core.Geocaches)); } break; } //and always do: if (Core.ActiveGeocache == null) { executeScript(string.Format("setGeocache('','','', {0}, {1},'')", Core.CenterLocation.Lat.ToString(CultureInfo.InvariantCulture), Core.CenterLocation.Lon.ToString(CultureInfo.InvariantCulture))); addWaypointsToMap(null); } else { if (Core.ActiveGeocache.ContainsCustomLatLon) { executeScript(string.Format("setGeocache('gapp://{0}', '{1}','{2}', {3}, {4}, '{5}')", Utils.ImageSupport.Instance.GetImagePath(Core, Framework.Data.ImageSize.Medium, Core.ActiveGeocache.GeocacheType).Replace('\\', '/'), Core.ActiveGeocache.Code, HttpUtility.HtmlEncode(Core.ActiveGeocache.Name), ((double)Core.ActiveGeocache.CustomLat).ToString(CultureInfo.InvariantCulture), ((double)Core.ActiveGeocache.CustomLon).ToString(CultureInfo.InvariantCulture), string.Format("gct{0}IconC", Core.ActiveGeocache.GeocacheType.ID.ToString().Replace("-", "_")))); } else { executeScript(string.Format("setGeocache('gapp://{0}', '{1}','{2}', {3}, {4}, '{5}')", Utils.ImageSupport.Instance.GetImagePath(Core, Framework.Data.ImageSize.Medium, Core.ActiveGeocache.GeocacheType).Replace('\\', '/'), Core.ActiveGeocache.Code, HttpUtility.HtmlEncode(Core.ActiveGeocache.Name), Core.ActiveGeocache.Lat.ToString(CultureInfo.InvariantCulture), Core.ActiveGeocache.Lon.ToString(CultureInfo.InvariantCulture), string.Format("gct{0}Icon", Core.ActiveGeocache.GeocacheType.ID.ToString().Replace("-", "_")))); } addWaypointsToMap(Utils.DataAccess.GetWaypointsFromGeocache(Core.Waypoints, Core.ActiveGeocache.Code)); } } }
public void UpdateView(MapUpdateReason reason) { Core.DebugLog(Framework.Data.DebugLogLevel.Info, OwnerPlugin, null, string.Format("GMap: UpdateView({0})", reason)); timer1.Enabled = false; if (radioButtonActive.Checked && (_activeMapType != MapType.SingleGeocache || reason== MapUpdateReason.MapSettingsChanged)) { _activeMapType = MapType.SingleGeocache; DisplayHtml(_defaultSingleGeocachehtml.Replace("<!-- %SingleGeocache.js% -->", setIcons(_defaultSingleGeocachejs))); reason = MapUpdateReason.Init; } else if (radioButtonSelected.Checked && (_activeMapType != MapType.SelectedGeocaches || reason == MapUpdateReason.MapSettingsChanged)) { _activeMapType = MapType.SelectedGeocaches; DisplayHtml(_defaultMultipleGeocachehtml.Replace("<!-- %MultipleGeocache.js% -->", setIcons(_defaultMultipleGeocachejs))); reason = MapUpdateReason.Init; } else if (radioButtonAll.Checked && (_activeMapType != MapType.Allgeocaches || reason == MapUpdateReason.MapSettingsChanged)) { _activeMapType = MapType.Allgeocaches; DisplayHtml(_defaultMultipleGeocachehtml.Replace("<!-- %MultipleGeocache.js% -->", setIcons(_defaultMultipleGeocachejs))); reason = MapUpdateReason.Init; } if (webBrowser1.ReadyState == WebBrowserReadyState.Complete) { switch (_activeMapType) { case MapType.SingleGeocache: break; case MapType.Allgeocaches: if (reason == MapUpdateReason.Init || reason == MapUpdateReason.DataChanged) { addGeocachesToMap((from Framework.Data.Geocache wp in Core.Geocaches select wp).ToList()); } timer1.Enabled = true; break; case MapType.SelectedGeocaches: if (reason == MapUpdateReason.Init || reason == MapUpdateReason.DataChanged || reason == MapUpdateReason.SelectedChanged) { addGeocachesToMap(Utils.DataAccess.GetSelectedGeocaches(Core.Geocaches)); } timer1.Enabled = true; break; } //and always do: if (Core.ActiveGeocache == null) { executeScript("setGeocache", new object[] { "", "", "", Core.CenterLocation.Lat, Core.CenterLocation.Lon, "" }); addWaypointsToMap(null); } else { if (Core.ActiveGeocache.ContainsCustomLatLon) { executeScript("setGeocache", new object[] { Utils.ImageSupport.Instance.GetImagePath(Core, Framework.Data.ImageSize.Medium, Core.ActiveGeocache.GeocacheType), Core.ActiveGeocache.Code, HttpUtility.HtmlEncode(Core.ActiveGeocache.Name), Core.ActiveGeocache.CustomLat, Core.ActiveGeocache.CustomLon, string.Format("gct{0}IconC", Core.ActiveGeocache.GeocacheType.ID.ToString().Replace("-", "_")) }); } else { executeScript("setGeocache", new object[] { Utils.ImageSupport.Instance.GetImagePath(Core, Framework.Data.ImageSize.Medium, Core.ActiveGeocache.GeocacheType), Core.ActiveGeocache.Code, HttpUtility.HtmlEncode(Core.ActiveGeocache.Name), Core.ActiveGeocache.Lat, Core.ActiveGeocache.Lon, string.Format("gct{0}Icon", Core.ActiveGeocache.GeocacheType.ID.ToString().Replace("-", "_")) }); } addWaypointsToMap(Utils.DataAccess.GetWaypointsFromGeocache(Core.Waypoints,Core.ActiveGeocache.Code)); } } }