Exemplo n.º 1
0
        public Dictionary <string, string> GetActiveMappings()
        {
            string active = m_Win.App.AppConfig.GPSProf;

            if (active == null || !m_profiles.ContainsKey(active))
            {
                return(GPSProfileList.GetDefaultMappings());
            }
            return(m_profiles[active].WaypointMappings);
        }
Exemplo n.º 2
0
 public DeleteItem(GPSProfileList profiles)
 {
     this.Build();
     if (profiles != null)
     {
         this.label1.Text = Catalog.GetString("GPS Profile:");
         int iCount = 0;
         foreach (GPSProfile loc in profiles.Profiles)
         {
             bmrkCombo.AppendText(loc.Name);
             bmrkCombo.Active = 0;
             iCount++;
         }
     }
 }
Exemplo n.º 3
0
 public DeleteItem(GPSProfileList profiles)
 {
     this.Build ();
     if (profiles != null)
     {
         this.label1.Text = Catalog.GetString("GPS Profile:");
         int iCount = 0;
         foreach (GPSProfile loc in profiles.Profiles)
         {
             bmrkCombo.AppendText(loc.Name);
             bmrkCombo.Active = 0;
             iCount ++;
         }
     }
 }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
        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");
            }
        }
Exemplo n.º 6
0
        public void CheckForDefaultGPS(GPSProfileList list, MainWindow 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.RebuildProfEditMenu(list);
                win.RebuildProfilesMenu(list);

                //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");
            }
        }
Exemplo n.º 7
0
        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);
            }
            else 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("%names%") && win.CacheList.UnfilteredCaches.Count > 0)
            {
                String names = "";
                foreach (Geocache cache in win.CacheList.UnfilteredCaches)
                {
                    if (names.Length > 0)
                    {
                        names += ' ';
                    }
                    names += cache.Name;
                }
                Process.Start(Utilities.StringToStartInfo(cmd.Replace("%names%", names)));
            }
            else if (cmd.Contains("%selectedname%"))
            {
                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;
                }
                Process.Start(Utilities.StringToStartInfo(cmd.Replace("%selectedname%", win.CacheList.SelectedCache.Name)));
            }
            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));
            }
        }
Exemplo n.º 8
0
        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);
            }
        }
Exemplo n.º 9
0
	public void RebuildProfilesMenu(GPSProfileList profiles)
	{
		Menu tmenu = profiles.BuildProfileTransferMenu();
		(TransferCachesAction.Proxies[0] as MenuItem).Submenu = tmenu;
		Menu rmenu = profiles.BuildProfileReceiveMenu();
		(ReceiveFieldNotesAction.Proxies[0] as MenuItem).Submenu = rmenu;
	}
Exemplo n.º 10
0
	public void RebuildProfEditMenu(GPSProfileList profiles)
	{	
		Menu emenu = profiles.BuildProfileEditMenu();
		(EditGPSProfileAction.Proxies[0] as MenuItem).Submenu = emenu;
	}