private static void RenderCacheTypes(FilterList list, StringBuilder builder) { if (list.Contains(FilterList.KEY_CACHETYPE)) { builder.Append(Catalog.GetString("<b>Cache Types: </b>")); bool isFirst = false; foreach (string type in (List <String>)list.GetCriteria(FilterList.KEY_CACHETYPE)) { if (!isFirst) { isFirst = true; } else { builder.Append(", "); } builder.Append(Catalog.GetString(Geocache.GetCTypeString((Geocache.CacheType)Enum.Parse(typeof(Geocache.CacheType), type)))); } builder.Append("\n"); } }
/// <summary> /// Updates all info panes with the current cache information /// </summary> /// <param name="val"> /// A geocache object <see cref="CacheLog"/> /// </param> private void UpdateCacheInfo(CacheLog val) { Geocache cache = m_caches[val.CacheCode]; StringBuilder builder = new StringBuilder(); builder.Append("<b>"); builder.Append(cache.Name); builder.Append(":"); builder.Append(cache.CacheName); if (!String.IsNullOrEmpty(cache.PlacedBy)) { builder.Append(Catalog.GetString(" by ")); builder.Append(cache.PlacedBy); } builder.Append("</b><br/>"); builder.Append(Geocache.GetCTypeString(cache.TypeOfCache)); builder.Append("<br/><br/>"); builder.Append(cache.ShortDesc); builder.Append("<br/><br/>"); builder.Append(cache.LongDesc); cacheDesc.HTML = builder.ToString(); List <CacheLog> logs = m_Win.App.CacheStore.GetCacheLogs(cache.Name); builder = new StringBuilder(); foreach (CacheLog log in logs) { builder.Append(log.toHTML()); } cacheLog.HTML = builder.ToString(); mapView.ClearCaches(); mapView.AddMarker(cache, false); List <Waypoint> children = m_Win.App.CacheStore.GetChildWaypoints(new string[] { cache.Name }); ListStore cmodel = waypointCombo.Model as ListStore; m_waypoints.Clear(); cmodel.Clear(); waypointCombo.AppendText(cache.Name); cacheNotes.SetCache(cache); firstToFindCheck.Toggled -= OnFTFCheck; firstToFindCheck.Active = cache.FTF; firstToFindCheck.Toggled += OnFTFCheck; if (val.LogStatus == "Found it") { firstToFindCheck.Sensitive = true; } else { firstToFindCheck.Sensitive = false; } logChoice.Changed -= OnLogTypeChange; SetLogChoice(); logChoice.Changed += OnLogTypeChange; m_waypoints.Add(cache.Name, cache); foreach (Waypoint pt in children) { waypointCombo.AppendText(pt.Name); m_waypoints.Add(pt.Name, pt); } waypointCombo.Active = 0; }
void HandleM_printBeginPrint(object o, BeginPrintArgs args) { string contents; double height; // Get the Context of the Print Operation PrintContext context = args.Context; // Get the Height of the Context height = context.Height; StringBuilder builder = new StringBuilder(); // From the FontSize and the Height of the Page determine the Lines available per page m_linesPerPage = (int)Math.Floor(height / (m_fontSize + 0.5)) - 4; int charsPerLine = 80; contents = Utilities.HTMLtoText(m_cache.LongDesc); contents = GLib.Markup.EscapeText(contents); builder.Append("<b>"); builder.Append(Utilities.getCoordString(m_cache.Lat, m_cache.Lon)); builder.Append("</b>\n"); builder.Append(Geocache.GetCTypeString(m_cache.TypeOfCache)); builder.Append("\n"); builder.Append(Catalog.GetString("<b>A cache by:</b>")); builder.Append(" "); builder.Append(m_cache.PlacedBy); builder.Append("\t"); builder.Append(Catalog.GetString("<b>Hidden on:</b>")); builder.Append(" "); builder.Append(m_cache.Time.ToShortDateString()); builder.Append("\n"); builder.Append(Catalog.GetString("<b>Cache Size:</b>")); builder.Append(" "); builder.Append(m_cache.Container); builder.Append("\t"); builder.Append(Catalog.GetString("<b>Difficulty:</b>")); builder.Append(" "); builder.Append(m_cache.Difficulty.ToString("0.0")); builder.Append("\t"); builder.Append(Catalog.GetString("<b>Terrain:</b>")); builder.Append(" "); builder.Append(m_cache.Difficulty.ToString("0.0")); builder.Append("\n\n"); if (!String.IsNullOrEmpty(m_cache.ShortDesc)) { builder.Append(Catalog.GetString("<b>Short Description:</b>")); builder.Append("\n\n"); WordWrapText(HTMLtoPango(m_cache.ShortDesc), builder, charsPerLine); builder.Append("\n\n"); } builder.Append(Catalog.GetString("<b>Long Description:</b>")); builder.Append("\n\n"); WordWrapText(HTMLtoPango(m_cache.LongDesc), builder, charsPerLine); builder.Append("\n\n"); if (!String.IsNullOrEmpty(m_cache.Notes)) { builder.Append(Catalog.GetString("<b>Notes:</b>")); builder.Append("\n\n"); builder.Append(GLib.Markup.EscapeText(m_cache.Notes)); builder.Append("\n\n"); } if (!String.IsNullOrEmpty(m_cache.Hint)) { builder.Append(Catalog.GetString("<b>Hint:</b>")); builder.Append("\n\n"); string hint = Utilities.HTMLtoText(m_cache.Hint); hint = GLib.Markup.EscapeText(hint); WordWrapText(hint, builder, charsPerLine); } contents = builder.ToString(); // Split the Content into seperate lines m_Lines = contents.Split('\n'); // Get the Number of lines m_numLines = m_Lines.Length; // Calculate the Number of Pages by how many lines there are and how many lines are available per page m_numPages = (m_numLines - 1) / m_linesPerPage + 1; // Tell the Print Operation how many pages there are m_print.NPages = m_numPages; }
public void UpdateCache() { m_cache.Name = codeEntry.Text; m_cache.Desc = descriptionEntry.Buffer.Text; m_cache.Symbol = "Geocache"; if (m_cache.TypeOfCache != Geocache.CacheType.GENERIC) { m_cache.Type = "Geocache|" + Geocache.GetCTypeString(m_cache.TypeOfCache); } try { m_cache.URL = new Uri(urlEntry.Text); } catch { m_cache.URL = null; } m_cache.URLName = urlNameEntry.Text; m_cache.Lat = coordEntry.Latitude; m_cache.Lon = coordEntry.Longitude; m_cache.CacheName = nameEntry.Text; m_cache.ShortDesc = shortDescEntry.Buffer.Text; m_cache.LongDesc = longDescEntry.Buffer.Text; m_cache.Hint = hintEntry.Buffer.Text; m_cache.PlacedBy = placedByEntry.Text; m_cache.CacheOwner = ownerEntry.Text; m_cache.OwnerID = ownerIDEntry.Text; m_cache.CacheID = cacheIDEntry.Text; m_cache.User1 = udata1Entry.Text; m_cache.User2 = uData2Entry.Text; m_cache.User3 = uData3Entry.Text; m_cache.User4 = uData4Entry.Text; m_cache.Difficulty = 1f; if (diffEntry.Active == 1) { m_cache.Difficulty = 1.5f; } else if (diffEntry.Active == 2) { m_cache.Difficulty = 2f; } else if (diffEntry.Active == 3) { m_cache.Difficulty = 2.5f; } else if (diffEntry.Active == 4) { m_cache.Difficulty = 3f; } else if (diffEntry.Active == 5) { m_cache.Difficulty = 3.5f; } else if (diffEntry.Active == 6) { m_cache.Difficulty = 4f; } else if (diffEntry.Active == 7) { m_cache.Difficulty = 4.5f; } else if (diffEntry.Active == 8) { m_cache.Difficulty = 5f; } m_cache.Terrain = 1f; if (terrEntry.Active == 1) { m_cache.Terrain = 1.5f; } else if (terrEntry.Active == 2) { m_cache.Terrain = 2f; } else if (terrEntry.Active == 3) { m_cache.Terrain = 2.5f; } else if (terrEntry.Active == 4) { m_cache.Terrain = 3f; } else if (terrEntry.Active == 5) { m_cache.Terrain = 3.5f; } else if (terrEntry.Active == 6) { m_cache.Terrain = 4f; } else if (terrEntry.Active == 7) { m_cache.Terrain = 4.5f; } else if (terrEntry.Active == 8) { m_cache.Terrain = 5f; } switch (typeEntry.Active) { case 7: m_cache.TypeOfCache = Geocache.CacheType.APE; break; case 13: m_cache.TypeOfCache = Geocache.CacheType.CITO; break; case 4: m_cache.TypeOfCache = Geocache.CacheType.EARTH; break; case 5: m_cache.TypeOfCache = Geocache.CacheType.EVENT; break; case 6: m_cache.TypeOfCache = Geocache.CacheType.LETTERBOX; break; case 8: m_cache.TypeOfCache = Geocache.CacheType.MAZE; break; case 14: m_cache.TypeOfCache = Geocache.CacheType.MEGAEVENT; break; case 3: m_cache.TypeOfCache = Geocache.CacheType.MULTI; break; case 2: m_cache.TypeOfCache = Geocache.CacheType.MYSTERY; break; case 9: m_cache.TypeOfCache = Geocache.CacheType.REVERSE; break; case 1: m_cache.TypeOfCache = Geocache.CacheType.TRADITIONAL; break; case 10: m_cache.TypeOfCache = Geocache.CacheType.VIRTUAL; break; case 11: m_cache.TypeOfCache = Geocache.CacheType.WEBCAM; break; case 12: m_cache.TypeOfCache = Geocache.CacheType.WHERIGO; break; default: m_cache.TypeOfCache = Geocache.CacheType.GENERIC; break; } }