public CleanupAssistant(OCMApp app, OCMMainWindow win) { win.CacheList.ApplyQuickFilter(QuickFilter.ALL_FILTER); mgr = new CleanupManager(app.CacheStore, win.CacheList.UnfilteredCaches); m_Win = win; m_App = app; AppendPage(page1); AppendPage(page2); AppendPage(confirm); AppendPage(summaryPage); Title = Catalog.GetString("Cleanup Assistant"); SetPageTitle(page1, Catalog.GetString("Introduction")); SetPageComplete(page1, true); SetPageType(page1, AssistantPageType.Intro); SetPageTitle(page2, Catalog.GetString("Options")); SetPageComplete(page2, true); SetPageType(page2, AssistantPageType.Content); SetPageTitle(confirm, Catalog.GetString("Confirm Cleanup")); SetPageComplete(confirm, true); SetPageType(confirm, AssistantPageType.Confirm); SetPageTitle(summaryPage, Catalog.GetString("Summary")); SetPageComplete(summaryPage, true); SetPageType(summaryPage, AssistantPageType.Summary); WidthRequest = 800; HeightRequest = 500; Modal = true; SetPosition(WindowPosition.Center); this.ShowAll(); this.Cancel += HandleHandleCancel; this.Apply += HandleHandleApply; this.Close += HandleHandleClose; this.Prepare += HandleHandlePrepare; }
public CopyMoveDialog(OCMMainWindow win) { this.Build (); m_Win = win; FileFilter filter = new FileFilter (); filter.Name = "OCM Databases"; filter.AddPattern ("*.ocm"); chooser.AddFilter (filter); chooser.SelectionChanged += HandleChooserSelectionChanged; buttonOk.Sensitive = false; }
public ImportDialog(OCMMainWindow win) { this.Build (); m_Win = win; FileFilter filter = new FileFilter (); filter.Name = "Waypoint Files"; filter.AddPattern ("*.gpx"); filter.AddPattern ("*.loc"); filter.AddPattern ("*.zip"); fileWidget.AddFilter (filter); UpdateBookMarkCombo(); }
/// <summary> /// Main Constructor /// </summary> /// <param name="win"> /// Reference to OCMMainWindow that hosts this dialog <see cref="OCMMainWindow"/> /// </param> public OffLineLogViewer(OCMMainWindow win) { this.Build (); this.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Watch); BuildLogTreeWidget(); m_Win = win; mapView.App = win.App; mapView.HideFindSymbol = true; mapView.Reload(); m_caches = new Dictionary<string, Geocache>(); fnFieldNotesLabel.Text = String.Format(Catalog.GetString("File Location: {0}"), m_Win.App.AppConfig.FieldNotesFile); waypointCombo.Changed += HandleWaypointComboChanged; cacheNotes.MainWin = win; this.ShowAll(); }
public void Start(String targetDB, bool isMove, ModeEnum modeType, OCMMainWindow win) { if (isMove) { Title = Catalog.GetString ("Move Caches..."); copyLabel.Markup = Catalog.GetString ("Moving Geocaches"); } List<Geocache> caches; if (modeType == CopyingProgress.ModeEnum.VISIBLE) { caches = win.CacheList.UnfilteredCaches; } else if (modeType == CopyingProgress.ModeEnum.SELECTED) { caches = new List<Geocache> (); caches.Add (win.CacheList.SelectedCache); } else { caches = null; //caches = new List<Geocache> (UIMonitor.getInstance ().CacheStore.GetUnfilteredCaches(0d,0d,new string[0])); } ACacheStore target = new FileStore (targetDB); ACacheStore source = win.App.CacheStore; targetDBLabel.Text = targetDB; double count = 0; total = caches.Count; if (target.NeedsUpgrade) { MessageDialog dlg = new MessageDialog(null, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, Catalog.GetString("The target database needs to be upgraded. " + "Please open the target database before trying to copy/move caches.")); dlg.Run(); dlg.Hide(); this.Hide(); return; } buttonOk.Visible = false; List<String> str = new List<String>(); foreach(Geocache c in caches) { str.Add(c.Name); } target.StartUpdate(); target.PurgeAllLogs(str.ToArray()); target.PurgeAllAttributes(str.ToArray()); target.PurgeAllTravelBugs(str.ToArray()); foreach(Geocache cache in caches) { if (cancel) { target.CancelUpdate(); this.Hide(); this.Dispose(); return; } count++; UpdateProgress(count, cache.Name); target.AddWaypointOrCache(cache, false, false); List<CacheLog> logs = source.GetCacheLogs(cache.Name); foreach(CacheLog log in logs) { target.AddLog(cache.Name, log); } List<Waypoint> children = source.GetChildWaypoints(new string[]{cache.Name}); foreach (Waypoint child in children) { target.AddWaypointOrCache(child, false, false); } CacheAttribute[] attributes = source.GetAttributes(cache.Name); foreach (CacheAttribute attribute in attributes) { target.AddAttribute(cache.Name,attribute); } if (isMove) source.DeleteWaypoint(cache.Name); } statusLabel.Markup = Catalog.GetString("<i>Complete</i>"); progressBar.Text = Catalog.GetString("Complete"); buttonOk.Visible = true; buttonCancel.Visible = false; target.CompleteUpdate(); }
public void StartDelete(List<Geocache> caches, OCMMainWindow win) { this.copyLabel.Markup = Catalog.GetString("<big><b>Deleting Geocaches</b></big>"); this.Title = Catalog.GetString("Delete Caches...."); targetDBLabel.Visible = false; TargetLabel.Visible = false; ACacheStore store = win.App.CacheStore; store.StartUpdate(); double count = 0; total = caches.Count; foreach(Geocache cache in caches) { if (cancel) { store.CancelUpdate(); this.Hide(); this.Dispose(); return; } count++; DeleteProgress(count, cache.Name); store.DeleteWaypoint(cache.Name); win.DeleteCacheImages(cache.Name); } statusLabel.Markup = Catalog.GetString("<i>Complete</i>"); progressBar.Text = Catalog.GetString("Complete"); buttonOk.Visible = true; buttonCancel.Visible = false; store.CompleteUpdate(); }
public ImportDirectoryDialog(OCMMainWindow win) { this.Build (); m_Win = win; UpdateBookMarkCombo(); }
/// <summary> /// Main Constructpr /// </summary> /// <param name="win"> /// Parent Window <see cref="OCMMainWindow"/> /// </param> public FieldNotesProgress(OCMMainWindow win) { this.Build (); m_Win = win; }
public void InitializeApp(string filename, bool quitAfterImport) { m_Store = new FileStore(m_Config.DBFile); InitalizeTracing (); m_Locations = LocationList.LoadLocationList(); m_QuickFilters = QuickFilters.LoadQuickFilters(); m_Profiles = GPSProfileList.LoadProfileList(); m_Tools = EToolList.LoadEToolList(); m_Bookmarks = new BookmarkManager(this); m_CentreLat = AppConfig.LastLat; m_CentreLon = AppConfig.LastLon; m_CentreName = AppConfig.LastName; m_Window = new OCMMainWindow(this); QuickFilter startup = m_QuickFilters.GetFilter(AppConfig.StartupFilter); if (startup != null) m_Window.CacheList.ApplyInitalQuickFilter(startup); if (filename != null) { if (filename.EndsWith(".zip")) ImportZip(filename); else ImportGPXFile(filename); if (quitAfterImport) this.End(); else ShowMainWindow(); } else { m_splash = new OCMSplash(); m_splash.Show(); UpdateGUIThread(); m_splash.Preload(this, startup); } }
public void CheckForDefaultGPS(GPSProfileList list, OCMMainWindow win) { string defName = this.GPSProf; string defType = this.Get("/apps/ocm/gps/type", null) as string; if (defName == null && defType != null) { // Check for legacy GPS Config (pre 0.23) or use Garmin GPX as // default config. GPSProfile profile = new GPSProfile(); profile.Name = "Default"; profile.CacheLimit = (int) this.Get("/apps/ocm/gps/limit", -1); profile.BabelFormat = this.Get("/apps/ocm/gps/type", "OCM_GPX") as string; string nm = this.Get("/apps/ocm/gps/namemode", WaypointNameMode.CODE.ToString()) as string; profile.NameMode = (WaypointNameMode) Enum.Parse(typeof(WaypointNameMode), nm); string dm = this.Get("/apps/ocm/gps/descmode", WaypointDescMode.DESC.ToString()) as string; profile.DescMode = (WaypointDescMode) Enum.Parse(typeof(WaypointDescMode), dm); profile.LogLimit = (int) this.Get("/apps/ocm/gps/loglimit", -1); profile.IncludeAttributes = (bool) this.Get("/apps/ocm/gps/incattr", false); profile.OutputFile = this.Get("/apps/ocm/gps/file", "/media/GARMIN/Garmin/GPX/geocaches.gpx") as string; if (profile.BabelFormat == "delgpx") profile.FieldNotesFile = "/media/EM_USERMAPS/FieldNotes.txt"; else if (profile.BabelFormat == "OCM_GPX") profile.FieldNotesFile = "/media/GARMIN/Garmin/geocache_visits.txt"; UpgradeWaypointMappings(profile); list.AddProfile(profile); GPSProf = profile.Name; win.RebuildProfiles(); //Cleanup legacy keys UnsetKey("/apps/ocm/gps/limit"); UnsetKey("/apps/ocm/gps/type"); UnsetKey("/apps/ocm/gps/namemode"); UnsetKey("/apps/ocm/gps/descmode"); UnsetKey("/apps/ocm/gps/loglimit"); UnsetKey("/apps/ocm/gps/incattr"); UnsetKey("/apps/ocm/gps/file"); } }
public void RunCommand(OCMMainWindow win) { string cmd = m_command; if (cmd.Contains("%gpxgc%")) { GPXWriter writer = new GPXWriter(); String tempPath = System.IO.Path.GetTempPath(); String tempFile = tempPath + "ocm_export.gpx"; ExportProgressDialog dlg = new ExportProgressDialog(writer); dlg.AutoClose = true; dlg.Title = Catalog.GetString("Preparing GPX File"); dlg.WaypointsOnly = false; dlg.CompleteCommand = m_command.Replace("%gpxgc%", tempFile); dlg.Start(tempFile, win.CacheList.UnfilteredCaches, GPSProfileList.GetDefaultMappings(), win.App.CacheStore); } else if (cmd.Contains("%gpx%")) { GPXWriter writer = new GPXWriter(); String tempPath = System.IO.Path.GetTempPath(); String tempFile = tempPath + "ocm_export.gpx"; ExportProgressDialog dlg = new ExportProgressDialog(writer); dlg.AutoClose = true; dlg.Title = Catalog.GetString("Preparing GPX File"); dlg.WaypointsOnly = true; dlg.CompleteCommand = m_command.Replace("%gpx%", tempFile); dlg.Start(tempFile, win.CacheList.UnfilteredCaches, GPSProfileList.GetDefaultMappings(), win.App.CacheStore); } if (cmd.Contains("%selected%")) { if (win.CacheList.SelectedCache == null) { MessageDialog edlg = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, Catalog.GetString("No cache selected.")); edlg.Run(); edlg.Hide(); edlg.Dispose(); return; } GPXWriter writer = new GPXWriter(); String tempPath = System.IO.Path.GetTempPath(); String tempFile = tempPath + "ocm_export.gpx"; ExportProgressDialog dlg = new ExportProgressDialog(writer); dlg.AutoClose = true; dlg.Title = Catalog.GetString("Preparing GPX File"); dlg.WaypointsOnly = true; dlg.CompleteCommand = m_command.Replace("%selected%", tempFile); List<Geocache> cache = new List<Geocache>(); cache.Add(win.CacheList.SelectedCache); dlg.Start(tempFile, cache, GPSProfileList.GetDefaultMappings(), win.App.CacheStore); } else if (cmd.Contains("%finds%")) { GPXWriter writer = new GPXWriter(); writer.IsMyFinds = true; writer.MyFindsOwner = win.App.OwnerIDs[0]; String tempPath = System.IO.Path.GetTempPath(); String tempFile = tempPath + "ocm_finds.gpx"; ExportProgressDialog dlg = new ExportProgressDialog(writer); dlg.AutoClose = true; dlg.Title = Catalog.GetString("Preparing GPX File"); dlg.WaypointsOnly = true; dlg.CompleteCommand = m_command.Replace("%finds%", tempFile); //dlg.Start(tempFile, Engine.getInstance().Store.GetFinds(), GPSProfileList.GetDefaultMappings(), mon.CacheStore); } else { Process.Start(Utilities.StringToStartInfo(m_command)); } }