Пример #1
0
 public void OpenSelectedCacheInQLandKarte()
 {
     GPXWriter writer = new GPXWriter ();
     String tempPath = System.IO.Path.GetTempPath ();
     String tempFile = tempPath + "ocm_export.gpx";
     List<Geocache> cache = new List<Geocache> ();
     cache.Add (CacheList.SelectedCache);
     ExportProgressDialog dlg = new ExportProgressDialog (writer);
     dlg.AutoClose = true;
     dlg.Title = Catalog.GetString ("Preparing to send to QLandKarte GT");
     dlg.CompleteCommand = "qlandkartegt " + tempFile;
     dlg.Icon = this.Icon;
     dlg.Start (tempFile, cache, GPSProfileList.GetDefaultMappings (), m_app.CacheStore);
 }
Пример #2
0
        public void OpenInQLandKarte()
        {
            GPXWriter writer = new GPXWriter ();
            String tempPath = System.IO.Path.GetTempPath ();
            String tempFile = tempPath + "ocm_export.gpx";
            ExportProgressDialog dlg = new ExportProgressDialog (writer);

                        /*Connection DbusConnection = Bus.Session;
            IQLandkarteGT ql = DbusConnection.GetObject<IQLandkarteGT> ("org.qlandkarte.dbus", new ObjectPath ("QLandkarteGT"));
            System.Console.WriteLine("Connected");
            ql.loadGeoData("/home/campbelk/Desktop/export.gpx");*/

            dlg.AutoClose = true;
            dlg.Title = Catalog.GetString ("Preparing to send to QLandKarte GT");
            dlg.CompleteCommand = "qlandkartegt " + tempFile;
            dlg.Icon = this.Icon;
            dlg.Start (tempFile, CacheList.UnfilteredCaches, GPSProfileList.GetDefaultMappings (), m_app.CacheStore);
        }
Пример #3
0
        public void ExportFindsGPX()
        {
            GPXWriter writer = new GPXWriter ();
            writer.IsMyFinds = true;
            writer.MyFindsOwner = m_app.OwnerIDs[0];
            ExportProgressDialog edlg = new ExportProgressDialog (writer);
            edlg.AutoClose = Config.AutoCloseWindows;

            try {
                FileChooserDialog dlg = new FileChooserDialog (Catalog.GetString (" Export Finds GPX File"), this, FileChooserAction.Save, Catalog.GetString ("Cancel"), ResponseType.Cancel, Catalog.GetString ("Export"), ResponseType.Accept);
                dlg.SetCurrentFolder (System.Environment.GetFolderPath (System.Environment.SpecialFolder.MyDocuments));
                dlg.CurrentName = "finds.gpx";
                FileFilter filter = new FileFilter ();
                filter.Name = "GPX Files";
                filter.AddPattern ("*.gpx");

                dlg.AddFilter (filter);

                if (dlg.Run () == (int)ResponseType.Accept) {
                    dlg.Hide ();
                    edlg.Icon = this.Icon;
                    edlg.Start (dlg.Filename, m_app.CacheStore.GetFinds(), GPSProfileList.GetDefaultMappings(), m_app.CacheStore);
                    RecentManager manager = RecentManager.Default;
                    manager.AddItem ("file://" + dlg.Filename);
                } else {
                    edlg.Destroy ();
                }
                dlg.Destroy ();
            } catch (Exception e) {
                OCMApp.ShowException(e);
                edlg.Hide ();
            }
        }
Пример #4
0
        public void ExportGPX()
        {
            GPXWriter writer = new GPXWriter ();
            ExportProgressDialog edlg = new ExportProgressDialog (writer);
            edlg.AutoClose = Config.AutoCloseWindows;

            try {
                ExportGPXDialog dlg = new ExportGPXDialog ();
                dlg.SetCurrentFolder (System.Environment.GetFolderPath (System.Environment.SpecialFolder.MyDocuments));
                dlg.CurrentName = "export.gpx";
                dlg.WaypointMappings = GetExportMappings ();
                FileFilter filter = new FileFilter ();
                filter.Name = "GPX Files";
                filter.AddPattern ("*.gpx");
                dlg.AddFilter (filter);
                dlg.UsePlainText = Config.ExportAsPlainText;
                dlg.UseMappings = Config.ExportCustomSymbols;
                dlg.IsPaperless = Config.ExportPaperlessOptions;
                dlg.IncludeChildren = Config.ExportChildren;
                dlg.NameMode = Config.ExportWaypointNameMode;
                dlg.DescMode = Config.ExportWaypointDescMode;
                dlg.IncludeAttributes = Config.ExportIncludeAttributes;
                dlg.LogLimit = Config.ExportLimitLogs;
                dlg.CacheLimit = Config.ExportLimitCaches;
                if (dlg.Run () == (int)ResponseType.Ok) {
                    dlg.Hide ();
                    writer.Limit = dlg.CacheLimit;
                    writer.IncludeGroundSpeakExtensions = dlg.IsPaperless;
                    writer.IncludeChildWaypoints = dlg.IncludeChildren;
                    writer.UseOCMPtTypes = dlg.UseMappings;
                    writer.NameMode = dlg.NameMode;
                    writer.DescriptionMode = dlg.DescMode;
                    if (dlg.UsePlainText)
                        writer.HTMLOutput = HTMLMode.PLAINTEXT;
                    writer.WriteAttributes = dlg.IncludeAttributes;
                    writer.LogLimit = dlg.LogLimit;
                    edlg.Icon = this.Icon;

                    Config.ExportAsPlainText = dlg.UsePlainText;
                    Config.ExportChildren = dlg.IncludeChildren;
                    Config.ExportCustomSymbols = dlg.UseMappings;
                    Config.ExportIncludeAttributes = dlg.IncludeAttributes;
                    Config.ExportLimitCaches = dlg.CacheLimit;
                    Config.ExportLimitLogs = dlg.LogLimit;
                    Config.ExportPaperlessOptions = dlg.IsPaperless;
                    Config.ExportWaypointDescMode = dlg.DescMode;
                    Config.ExportWaypointNameMode = dlg.NameMode;
                    SaveWaypointMappings (dlg.WaypointMappings);
                    edlg.Start (dlg.Filename, CacheList.UnfilteredCaches, dlg.WaypointMappings, m_app.CacheStore);
                    RecentManager manager = RecentManager.Default;
                    manager.AddItem ("file://" + dlg.Filename);
                } else {
                    edlg.Destroy ();
                }
                dlg.Destroy ();
            } catch (Exception e) {
                //ShowException (e);
                System.Console.WriteLine(e.Message);
                System.Console.WriteLine(e.StackTrace);
                edlg.Destroy ();
            }
        }
Пример #5
0
 public void RunCommand()
 {
     string cmd = m_command;
     if (cmd.Contains("%gpx%"))
     {
         UIMonitor mon = UIMonitor.getInstance();
         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, mon.GetVisibleCacheList(), GPSProfileList.GetDefaultMappings());
     }
     if (cmd.Contains("%selected%"))
     {
         UIMonitor mon = UIMonitor.getInstance();
         if (mon.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(mon.SelectedCache);
         dlg.Start(tempFile, cache, GPSProfileList.GetDefaultMappings());
     }
     else if (cmd.Contains("%finds%"))
     {
         UIMonitor mon = UIMonitor.getInstance();
         GPXWriter writer = new GPXWriter();
         writer.IsMyFinds = true;
         writer.MyFindsOwner = mon.OwnerID;
         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());
     }
     else
     {
         Process.Start(Utilities.StringToStartInfo(m_command));
     }
 }