/// <summary>
 /// Sends Geocaches to a device
 /// </summary>
 /// <param name="caches">
 /// A list of geocaches <see cref="List<Geocache>"/>
 /// </param>
 /// <param name="profile">
 /// A gps profiles <see cref="GPSProfile"/>
 /// </param>
 /// <param name="includeChildren">
 /// If true, include child waypoints<see cref="System.Boolean"/>
 /// </param>
 /// <param name="store">
 /// The source cache store <see cref="ACacheStore"/>
 /// </param>
 public void Start(List <Geocache> caches, GPSProfile profile, bool includeChildren, ACacheStore store)
 {
     try {
         total = caches.Count + 1;
         if (profile.CacheLimit != -1 && profile.CacheLimit < caches.Count)
         {
             total = profile.CacheLimit + 1;
         }
         writer.Limit             = profile.CacheLimit;
         writer.BabelFile         = profile.OutputFile;
         writer.BabelFormat       = profile.BabelFormat;
         writer.DescMode          = profile.DescMode;
         writer.NameMode          = profile.NameMode;
         writer.LogLimit          = profile.LogLimit;
         writer.IncludeAttributes = profile.IncludeAttributes;
         writer.OtherBabelParams  = profile.OtherProperties;
         writer.IncludeChildren   = includeChildren;
         writer.ForcePlainText    = profile.ForcePlainText;
         OCMApp.UpdateGUIThread();
         writer.WriteToGPS(caches, profile.WaypointMappings, store);
         this.Show();
     } catch (Exception e) {
         this.Hide();
         OCMApp.ShowException(e);
     }
 }
Пример #2
0
        public void SelecteWaypointByName(string code)
        {
            try
            {
                if (code == null)
                {
                    wptView.Selection.UnselectAll();
                    return;
                }

                TreeIter  itr;
                TreeModel model = wptView.Model;
                wptView.Model.GetIterFirst(out itr);
                do
                {
                    Waypoint pt = (Waypoint)model.GetValue(itr, 0);
                    if (pt.Name == code)
                    {
                        wptView.Selection.SelectIter(itr);
                        TreePath path = wptView.Model.GetPath(itr);
                        wptView.ScrollToCell(path, wptView.Columns[0], true, 0, 0);
                        return;
                    }
                }while (model.IterNext(ref itr));
            }
            catch (Exception e)
            {
                OCMApp.ShowException(e);
            }
        }
Пример #3
0
        public void Refresh()
        {
            try
            {
                if (null != this.RefreshStart)
                {
                    RefreshStart(this, new EventArgs());
                }
                Geocache selected = SelectedCache;
                m_disabledOrArchivedCount = 0;
                m_visibleCount            = 0;
                m_mineCount  = 0;
                m_foundCount = 0;

                if (m_app.AppConfig.ImperialUnits)
                {
                    m_distanceColumn.Title = Catalog.GetString("Mi");
                    distanceLabel.Text     = Catalog.GetString("Mi");
                }
                else
                {
                    m_distanceColumn.Title = Catalog.GetString("km");
                    distanceLabel.Text     = Catalog.GetString("km");
                }

                UpdateStatus();

                CacheStore.GlobalFilters.AddFilterCriteria(FilterList.KEY_STATUS,
                                                           new bool[] { foundCheck.Active, notFoundCheck.Active, mineCheck.Active,
                                                                        availCheck.Active, notAvailCheck.Active, archiveCheck.Active });
                cacheListTree.Model = null;
                if (m_list == null)
                {
                    m_list = new CacheStoreModel();
                }
                else
                {
                    m_list.Clear();
                }


                if (m_sort == null)
                {
                    m_sort = new TreeModelSort(new TreeModelAdapter(m_list));
                    m_sort.SetSortFunc(3, TitleCompare);
                    m_sort.SetSortFunc(2, DistanceCompare);
                    m_sort.SetSortFunc(0, SymbolCompare);
                    m_sort.DefaultSortFunc = DistanceCompare;
                }
                CacheStore.ReadCache += HandleCacheStoreReadCache;
                CacheStore.Complete  += HandleCacheStoreComplete;
                CacheStore.GetUnfilteredCaches(m_app.CentreLat, m_app.CentreLon, m_app.OwnerIDs.ToArray());
                CacheStore.ReadCache -= HandleCacheStoreReadCache;
                CacheStore.Complete  -= HandleCacheStoreComplete;
            }
            catch (Exception e)
            {
                OCMApp.ShowException(e);
            }
        }
Пример #4
0
 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;
 }
Пример #5
0
 public static string GetStatusIcon(Geocache cache, OCMApp app, bool ignoreFound)
 {
     if (cache.Found && !ignoreFound)
     {
         if (cache.FTF)
         {
             return(FTF_MI);
         }
         return(FOUND_MI);
     }
     if ((app.OwnerIDs.Contains(cache.OwnerID)) || (app.OwnerIDs.Contains(cache.CacheOwner)))
     {
         return(OWNED_MI);
     }
     if ((cache.HasCorrected || cache.HasFinal))
     {
         if (app.AppConfig.SolvedModeState == SolvedMode.ALL)
         {
             return(CORRECTED_MI);
         }
         else if (app.AppConfig.SolvedModeState == SolvedMode.PUZZLES &&
                  cache.TypeOfCache == Geocache.CacheType.MYSTERY)
         {
             return(CORRECTED_MI);
         }
     }
     else if (cache.DNF && app.AppConfig.ShowDNFIcon)
     {
         return(DNF_MI);
     }
     return(null);
 }
Пример #6
0
 public SetupAssistant(OCMApp app)
 {
     this.Build ();
     m_App = app;
     AppendPage (page1);
     AppendPage (page2);
     AppendPage (page3);
     AppendPage (summ);
     Title = Catalog.GetString("Setup Assistant");
     SetPageTitle (page1, Catalog.GetString("Welcome"));
     SetPageComplete (page1, true);
     SetPageType (page1, Gtk.AssistantPageType.Intro);
     SetPageTitle (page2, Catalog.GetString("Setup a Database"));
     SetPageComplete (page2, true);
     SetPageTitle (page3, Catalog.GetString("User Details"));
     SetPageType (page3, Gtk.AssistantPageType.Content);
     SetPageComplete(page3, true);
     SetPageTitle(summ, "Summary");
     SetPageType (summ, Gtk.AssistantPageType.Summary);
     SetPageComplete(summ, true);
     WidthRequest = 600;
     HeightRequest = 500;
     this.Cancel += HandleHandleCancel;
     this.Apply += HandleHandleApply;
     this.Close += HandleHandleClose;
 }
Пример #7
0
 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;
 }
Пример #8
0
 public SetupAssistant(OCMApp app)
 {
     this.Build();
     m_App = app;
     AppendPage(page1);
     AppendPage(page2);
     AppendPage(page3);
     AppendPage(summ);
     Title = Catalog.GetString("Setup Assistant");
     SetPageTitle(page1, Catalog.GetString("Welcome"));
     SetPageComplete(page1, true);
     SetPageType(page1, Gtk.AssistantPageType.Intro);
     SetPageTitle(page2, Catalog.GetString("Setup a Database"));
     SetPageComplete(page2, true);
     SetPageTitle(page3, Catalog.GetString("User Details"));
     SetPageType(page3, Gtk.AssistantPageType.Content);
     SetPageComplete(page3, true);
     SetPageTitle(summ, "Summary");
     SetPageType(summ, Gtk.AssistantPageType.Summary);
     SetPageComplete(summ, true);
     WidthRequest  = 600;
     HeightRequest = 500;
     this.Cancel  += HandleHandleCancel;
     this.Apply   += HandleHandleApply;
     this.Close   += HandleHandleClose;
 }
 /// <summary>
 /// Starts downloading a list of files
 /// </summary>
 /// <param name="files">
 /// A list of file urls<see cref="List<System.String>"/>
 /// </param>
 /// <param name="destFolder">
 /// The destination directory <see cref="System.String"/>
 /// </param>
 public void Start(List <string> files, string destFolder)
 {
     try
     {
         int iCount = 1;
         int total  = files.Count;
         this.Show();
         OCMApp.UpdateGUIThread();
         foreach (string url in files)
         {
             if (m_cancel)
             {
                 break;
             }
             DownloadFile(url, destFolder, total, ref iCount);
         }
         if (m_cancel)
         {
             progBar.Text = Catalog.GetString("Cancelled");
         }
         else
         {
             progBar.Text = Catalog.GetString("Complete");
         }
         buttonOk.Show();
         buttonCancel.Hide();
     }
     catch (Exception e)
     {
         this.Hide();
         OCMApp.ShowException(e);
     }
 }
Пример #10
0
        /// <summary>
        /// Populates the list of logs contained in the field notes file
        /// </summary>
        /// <param name="logs">
        /// A list of cache logs<see cref="List<CacheLog>"/>
        /// </param>
        public void PopulateLogs(List <CacheLog> logs)
        {
            this.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Watch);
            this.Sensitive        = false;
            OCMApp.UpdateGUIThread();
            m_logList.Clear();
            m_caches.Clear();
            fieldNotesDescPane.Sensitive = false;
            viewCacheButton.Sensitive    = false;
            deleteButton.Sensitive       = false;
            m_Logs = logs;
            listSort.SetSortColumnId(0, SortType.Descending);
            List <String> caches = new List <String> ();

            foreach (CacheLog log in logs)
            {
                m_logList.AppendValues(log);
                caches.Add(log.CacheCode);
            }
            List <Geocache> cachesInDb = m_Win.App.CacheStore.GetCachesByName(caches.ToArray());

            foreach (Geocache cache in cachesInDb)
            {
                m_caches[cache.Name] = cache;
            }
            this.Sensitive        = true;
            this.GdkWindow.Cursor = new Gdk.Cursor(Gdk.CursorType.Arrow);
        }
Пример #11
0
        void HandleAppCacheStoreReadCache(object sender, ocmengine.ReadCacheArgs args)
        {
            m_Model.Add(args.Cache);
            if (!args.Cache.Available)
            {
                m_disabledOrArchivedCount++;
            }
            else if (args.Cache.Archived)
            {
                m_disabledOrArchivedCount++;
            }
            if (args.Cache.Found)
            {
                m_foundCount++;
            }
            if (m_App.OwnerIDs.Contains(args.Cache.OwnerID) || m_App.OwnerIDs.Contains(args.Cache.PlacedBy))
            {
                m_mineCount++;
            }
            m_visibleCount++;

            m_Count++;
            if (m_Count == 50)
            {
                loadProgress.Pulse();
                OCMApp.UpdateGUIThread();
                m_Count = 0;
            }
        }
Пример #12
0
        protected virtual void OnOpenButtonClicked(object sender, System.EventArgs e)
        {
            FileChooserDialog dlg = null;

            try {
                dlg = new FileChooserDialog(Catalog.GetString("Open Map Description File"), null, FileChooserAction.Open, Catalog.GetString("Cancel"), ResponseType.Cancel, Catalog.GetString("Open"), ResponseType.Accept);
                //dlg.SetCurrentFolder (m_conf.DataDirectory);
                FileFilter filter = new FileFilter();
                filter.Name = Catalog.GetString("OCM Map Files");
                filter.AddPattern("*.xml");
                dlg.AddFilter(filter);

                if (dlg.Run() == (int)ResponseType.Accept)
                {
                    dlg.Hide();
                    m_maps.AddRange(MapManager.GetMapsFromFile(dlg.Filename));
                    ReloadMaps();
                    dlg.Destroy();
                }
                else
                {
                    dlg.Hide();
                    dlg.Destroy();
                }
            } catch (Exception exception) {
                OCMApp.ShowException(exception);
                if (dlg != null)
                {
                    dlg.Hide();
                    dlg.Destroy();
                }
            }
        }
Пример #13
0
 public ReviewWaypointDialog(WaypointWidget widget)
 {
     this.Build();
     m_widget = widget;
     m_App    = widget.App;
     reviewWidget.ParentCache = widget.Cache;
     reviewWidget.App         = widget.App;
 }
 public ReviewWaypointDialog(WaypointWidget widget)
 {
     this.Build ();
     m_widget = widget;
     m_App = widget.App;
     reviewWidget.ParentCache = widget.Cache;
     reviewWidget.App = widget.App;
 }
Пример #15
0
        public static void Main(string[] args)
        {
            Application.Init();
            // Set the localeDirectory right both for developement or for installed versions
            String localeDirectory = Paths.LOCALE_DIR;

            if (localeDirectory.Contains("@" + "expanded_datadir" + "@"))
            {
                localeDirectory = "./locale";
            }

            System.Console.WriteLine(localeDirectory);

            Mono.Unix.Catalog.Init("opencachemanager", localeDirectory);
            OCMApp app = new OCMApp();


            try
            {
                //##AP BusG.Init ();
                Bus    bus     = Bus.Session;
                string busName = "org.ocm.dbus";
                if (bus.RequestName(busName) != RequestNameReply.PrimaryOwner)
                {
                    IDBusComm comm = bus.GetObject <IDBusComm> (busName, new ObjectPath("/org/ocm/dbus"));
                    if (args != null)
                    {
                        if (args.Length > 0)
                        {
                            comm.ImportGPX(args[0]);
                        }
                    }
                    comm.ShowOCM();
                    return;
                }
                else
                {
                    DBusComm comm = new DBusComm(app);
                    bus.Register(new ObjectPath("/org/ocm/dbus"), comm);
                }
            }
            catch
            {
                System.Console.Error.WriteLine("NO SESSION DBUS RUNNING");
            }
            if (args != null)
            {
                if (args.Length > 0)
                {
                    app.Start(args[0]);
                }
                else
                {
                    app.Start();
                }
            }
        }
Пример #16
0
 void HandleHandlePrepare(object o, PrepareArgs args)
 {
     if (args.Page == confirm)
     {
         this.GdkWindow.Cursor = new Cursor(CursorType.Watch);
         OCMApp.UpdateGUIThread();
         confirm.Prepare();
         this.GdkWindow.Cursor = new Cursor(CursorType.Arrow);
     }
 }
Пример #17
0
        void UpdateBG()
        {
            int idx = animPos;

            this.GdkWindow.SetBackPixmap(backgrounds[idx], false);
            this.GdkWindow.InvalidateRect(new Rectangle(0, 0, 744, 600), true);
            OCMApp.UpdateGUIThread();
            animPos++;
            if (animPos >= backgrounds.Length)
            {
                animPos = 0;
            }
        }
        private void DownloadFile(string url, string destFolder, int total, ref int iCount)
        {
            WebRequest  req   = WebRequest.Create(url);
            WebResponse resp  = req.GetResponse();
            string      fName = Utilities.GetShortFileNameNoExtension(url);

            if (fName == null)
            {
                // Skip this file
                iCount++;
                return;
            }

            System.IO.FileStream fs        = new FileStream(destFolder + "/" + fName, FileMode.Create);
            System.IO.Stream     webstream = resp.GetResponseStream();
            fileLabel.Markup = String.Format(Catalog.GetString("File {0} of {1}"), iCount, total);
            long totalKB    = resp.ContentLength / 8;
            long totalBytes = resp.ContentLength;
            long currProg   = 0;

            byte[] buff = new byte[4096];
            for (;;)
            {
                OCMApp.UpdateGUIThread();
                long currKB = currProg / 8;
                progBar.Text = String.Format(Catalog.GetString("Received {0} bytes of {1} bytes"), currKB, totalKB);
                double progress = (((double)currProg / (double)totalBytes) + (double)iCount) / (double)total;
                if (progress > 1)
                {
                    progress = 1;
                }
                if (progBar.Fraction >= 0)
                {
                    progBar.Fraction = progress;
                }
                int read = webstream.Read(buff, 0, 4096);
                currProg = currProg + read;
                if (read > 0 && !m_cancel)
                {
                    fs.Write(buff, 0, read);
                }
                else
                {
                    break;
                }
            }
            fs.Close();
            webstream.Close();
            iCount++;
            return;
        }
Пример #19
0
 /// <summary>
 /// Updates the current cache and field notes file
 /// </summary>
 void SaveLogChanges()
 {
     try
     {
         m_currLog.LogMessage = logEntry.Buffer.Text;
         m_Win.App.CacheStore.AddLog(m_currLog.CacheCode, m_currLog);
         if (m_caches.ContainsKey(m_currLog.CacheCode))
         {
             m_Win.App.CacheStore.AddWaypointOrCache(m_caches[m_currLog.CacheCode], false, false);
         }
         UpdateFNFile();
     }
     catch (Exception e)
     {
         OCMApp.ShowException(e);
     }
 }
Пример #20
0
 protected virtual void DoEdit(object sender, System.EventArgs e)
 {
     try {
         Gtk.TreeIter  itr;
         Gtk.TreeModel model;
         if (wptView.Selection.GetSelected(out model, out itr))
         {
             Waypoint wpt = (Waypoint)model.GetValue(itr, 0);
             if (wpt is Geocache)
             {
                 m_App.EditCache();
                 return;
             }
             m_App.EditChildWaypoint(wpt);
         }
     } catch (Exception ex) {
         OCMApp.ShowException(ex);
     }
 }
Пример #21
0
        public OCMMainWindow(OCMApp app)
            : base(Gtk.WindowType.Toplevel)
        {
            this.Build ();
            m_app = app;
            cacheList.App = app;
            CacheMap.App = app;
            ocmCacheInfo.MainWin = this;
            ocmMapWidget.MainWin = this;
            m_app.Bookmarks.MainWin = this;
            m_app.Profiles.MainWin = this;
            m_app.Tools.MainWin = this;
            CacheList.MainWin = this;
            LogToFieldNotesFileAction.Active = Config.UseOfflineLogging;
            MapPopupsAction.Active = Config.MapPopups;
            CacheList.RefreshStart += HandleCacheListRefreshStart;
            CacheList.RefreshEnd += HandleCacheListRefreshEnd;
            CacheList.RefreshPulse += HandleCacheListRefreshPulse;
            CacheList.SelectionChanged += HandleCacheListSelectionChanged;
            ShowNearbyCachesAction.Active = Config.ShowNearby;
            AllWaypointsAction.Active = Config.ShowAllChildren;
            printAction.Sensitive = false;
            m_app.Locations.Window = this;
            m_app.QuickFilterList.Window = this;
            RebuildLocations();
            RebuildQuickFilters();
            RebuildBookmarks();
            RebuildProfiles();
            RebuildTools();
            UpdateLocationLabel();
            UpdateMapButtons();
            this.Resize(m_app.AppConfig.WindowWidth, m_app.AppConfig.WindowHeight);
            this.mainHPane.Position = m_app.AppConfig.HBarPosition;
            this.mainVPane.Position = m_app.AppConfig.VBarPosition;

            if (m_app.Profiles.GetActiveProfile () != null)
                SetLastGPS (m_app.Profiles.GetActiveProfile ().Name, m_app.Profiles.GetActiveProfile ().FieldNotesFile != null);
            else
                SetLastGPS (null, false);
        }
Пример #22
0
        protected virtual void OnDeleteAllClick(object sender, System.EventArgs e)
        {
            MessageDialog dlg = new MessageDialog(this, DialogFlags.Modal, MessageType.Warning, ButtonsType.YesNo,
                                                  Catalog.GetString("Are you sure you want to remove all field notes?"));

            try
            {
                if ((int)ResponseType.Yes == dlg.Run())
                {
                    FieldNotesHandler.ClearFieldNotes(m_Win.App.AppConfig.FieldNotesFile);
                    m_Logs.Clear();
                    PopulateLogs(m_Logs);
                }
                dlg.Hide();
                dlg.Dispose();
            }
            catch (Exception e1)
            {
                dlg.Hide();
                OCMApp.ShowException(e1);
            }
        }
Пример #23
0
        public void Preload(OCMApp app, QuickFilter filter)
        {
            m_App = app;

            if (filter != null)
            {
                m_App.CacheStore.GlobalFilters.AddFilterCriteria(FilterList.KEY_STATUS,
                                                                 new bool[] { filter.Found, filter.NotFound, filter.Mine,
                                                                              filter.Available, filter.Unavailable, filter.Archived });
                m_App.CacheStore.AdvancedFilters = filter.AdvancedFilters;
                if (filter.ComboFilter != null)
                {
                    m_App.CacheStore.CombinationFilter = filter.ComboFilter;
                }
            }
            app.CacheStore.Complete  += HandleAppCacheStoreComplete;
            app.CacheStore.ReadCache += HandleAppCacheStoreReadCache;
            if (app.AppConfig.UseGPSD)
            {
                app.EnableGPS(false);
            }
            app.CacheStore.GetUnfilteredCaches(app.CentreLat, app.CentreLon, app.OwnerIDs.ToArray());
        }
        public void Start(Dictionary <string, string[]> files)
        {
            int iCount  = 1;
            int iFailed = 0;
            int total   = files.Count;

            this.Show();
            OCMApp.UpdateGUIThread();
            foreach (string url in files.Keys)
            {
                if (m_cancel)
                {
                    break;
                }
                try
                {
                    DownloadFile(files[url][0], files[url][1], total, ref iCount);
                }
                catch (Exception e)
                {
                    System.Console.WriteLine("FAILED:" + files[url][0]);
                    progBar.Text = String.Format(Catalog.GetString("Download Failed for {0}"), files[url][0]);
                    iCount++;
                    iFailed++;
                }
            }
            if (m_cancel)
            {
                progBar.Text = Catalog.GetString("Cancelled");
            }
            else
            {
                progBar.Text = String.Format(Catalog.GetString("Complete, {0} files failed to download"), iFailed);
            }
            buttonOk.Show();
            buttonCancel.Hide();
        }
Пример #25
0
 public void Start(String filename, ACacheStore store)
 {
     this.Show();
     try {
         m_parser.StartUpdate(store);
         FileStream stream = File.OpenRead(filename);
         m_total = m_parser.PreParseForSingle(stream, store);
         stream.Close();
         stream          = File.OpenRead(filename);
         m_progress      = 0;
         m_progressCount = 0;
         m_timeStart     = DateTime.Now;
         ParseFile(stream, store);
         stream.Close();
         if (!m_parser.Cancel)
         {
             m_parser.EndUpdate(store);
         }
     } catch (Exception e) {
         this.Hide();
         OCMApp.ShowException(e);
         this.Dispose();
     }
 }
Пример #26
0
 public BookmarkManager(OCMApp app)
 {
     m_App = app;
 }
Пример #27
0
 void HandleViewLoadProgressChanged(object o, LoadProgressChangedArgs args)
 {
     mapProgress.Fraction = ((double)args.Progress / 100d);
     OCMApp.UpdateGUIThread();
 }
Пример #28
0
 void HandleViewLoadStarted(object o, LoadStartedArgs args)
 {
     mapProgress.Fraction = 0.15;
     mapProgress.Visible  = true;
     OCMApp.UpdateGUIThread();
 }
Пример #29
0
 public BookmarkManager(OCMApp app)
 {
     m_App = app;
 }
Пример #30
0
 void HandleM_ViewLoadCommitted(object o, LoadCommittedArgs args)
 {
     mapProgress.Fraction = 0.10;
     mapProgress.Visible  = true;
     OCMApp.UpdateGUIThread();
 }
Пример #31
0
 public DBusComm(OCMApp app)
 {
     m_App = app;
 }
Пример #32
0
        public static void Main(string[] args)
        {
            Application.Init ();
            // Set the localeDirectory right both for developement or for installed versions
            String localeDirectory = Paths.LOCALE_DIR;
            if (localeDirectory.Contains("@" + "expanded_datadir" + "@")) {
                localeDirectory = "./locale";
            }

            System.Console.WriteLine(localeDirectory);

            Mono.Unix.Catalog.Init ("opencachemanager", localeDirectory);
            OCMApp app = new OCMApp();

            try
            {
                BusG.Init ();
                Bus bus = Bus.Session;
                string busName = "org.ocm.dbus";
                if (bus.RequestName (busName) != RequestNameReply.PrimaryOwner)
                {
                    IDBusComm comm = bus.GetObject<IDBusComm> (busName, new ObjectPath ("/org/ocm/dbus"));
                    if (args != null)
                    {
                        if (args.Length > 0)
                            comm.ImportGPX (args[0]);
                    }
                    comm.ShowOCM();
                    return;
                }
                else
                {
                    DBusComm comm = new DBusComm (app);
                    bus.Register (new ObjectPath ("/org/ocm/dbus"), comm);
                }
            }
            catch
            {
                System.Console.Error.WriteLine("NO SESSION DBUS RUNNING");
            }
            if (args != null)
                if (args.Length > 0)
                    app.Start(args[0]);
            else
                app.Start();
        }
Пример #33
0
 /// <summary>
 /// Connect to the specified profile and download all field notes
 /// </summary>
 /// <param name="profile">
 /// The GPS Profile to use <see cref="GPSProfile"/>
 /// </param>
 /// <param name="latestScan">
 /// Logs older then this date will be ignored <see cref="DateTime"/>
 /// </param>
 /// <param name="ownerId">
 /// The owner ID to use for marking the logs in the OCM DB <see cref="String"/>
 /// </param>
 /// <returns>
 /// The new datetime of the latest scan <see cref="DateTime"/>
 /// </returns>
 public DateTime ProcessFieldNotes(GPSProfile profile, DateTime latestScan, String ownerId)
 {
     try
     {
         statusLabel.Markup = Catalog.GetString("<i>Receiving from device...</i>");
         OCMApp.UpdateGUIThread();
         List <CacheLog> logs       = FieldNotesHandler.GetLogs(profile.FieldNotesFile, ownerId);
         int             iCount     = 0;
         int             iProgCount = 0;
         int             iTotal     = logs.Count;
         statusLabel.Markup = Catalog.GetString("<i>Processing Field Notes...</i>");
         m_Win.App.CacheStore.StartUpdate();
         DateTime newLatest = DateTime.MinValue;
         foreach (CacheLog log in logs)
         {
             if (m_cancel)
             {
                 m_Win.App.CacheStore.CancelUpdate();
                 return(DateTime.MinValue);
             }
             double prog = (double)((double)iProgCount / (double)iTotal);
             loadProgress.Fraction = prog;
             loadProgress.Text     = prog.ToString("0%");
             iProgCount++;
             OCMApp.UpdateGUIThread();
             if (log.LogDate <= latestScan)
             {
                 System.Console.WriteLine("Skipping" + latestScan);
                 continue;
             }
             List <Geocache> cache = m_Win.App.CacheStore.GetCachesByName(new string[] { log.CacheCode });
             if (cache.Count > 0)
             {
                 UpdateCache(cache[0], log);
             }
             if (newLatest < log.LogDate)
             {
                 newLatest = log.LogDate;
             }
             iCount++;
         }
         if (!m_cancel)
         {
             UpdateFNFile(logs);
             m_Win.App.CacheStore.CompleteUpdate();
         }
         else
         {
             m_Win.App.CacheStore.CancelUpdate();
         }
         buttonCancel.Visible  = false;
         buttonClose.Visible   = true;
         buttonView.Visible    = true;
         loadProgress.Fraction = 1;
         statusLabel.Markup    = String.Format(Catalog.GetString("<i>Scanned {0} Field Notes, {1} new.</i>"), iProgCount, iCount);
         loadProgress.Text     = Catalog.GetString("Complete");
         return(newLatest);
     }
     catch (Exception e)
     {
         m_Win.App.CacheStore.CancelUpdate();
         this.Hide();
         OCMApp.ShowException(e);
         return(DateTime.MinValue);
     }
 }
Пример #34
0
        public OCMSplash() : base(Gtk.WindowType.Toplevel)
        {
            this.Build();
            SetSplashBG();

            this.versionLabel.Markup = String.Format(Catalog.GetString("<b><big>Version {0}</big></b>\n<small>Copyright (c) Kyle Campbell 2010-2013\nCopyright (c) Andreas Peters 2015-2016</small>"), OCMApp.GetOCMVersion());

            if (showChristmasSplash)
            {
                animTimer.Elapsed  += HandleAnimTimerElapsed;
                animTimer.AutoReset = true;
                animTimer.Interval  = 150;
                animTimer.Start();
            }

            Timer minWait = new Timer();

            minWait.Elapsed  += HandleMinWaitElapsed;
            minWait.AutoReset = false;
            minWait.Interval  = 1500;
            minWait.Start();
        }
Пример #35
0
 public DBusComm(OCMApp app)
 {
     m_App = app;
 }
Пример #36
0
 public static string GetStatusIcon(Geocache cache, OCMApp app, bool ignoreFound)
 {
     if (cache.Found && !ignoreFound)
     {
         if (cache.FTF)
             return FTF_MI;
         return FOUND_MI;
     }
     if ((app.OwnerIDs.Contains(cache.OwnerID)) ||(app.OwnerIDs.Contains(cache.CacheOwner)))
         return OWNED_MI;
     if ((cache.HasCorrected || cache.HasFinal))
     {
         if (app.AppConfig.SolvedModeState == SolvedMode.ALL)
             return CORRECTED_MI;
         else if (app.AppConfig.SolvedModeState == SolvedMode.PUZZLES &&
                  cache.TypeOfCache == Geocache.CacheType.MYSTERY)
             return CORRECTED_MI;
     }
     else if (cache.DNF && app.AppConfig.ShowDNFIcon)
     {
         return DNF_MI;
     }
     return null;
 }
Пример #37
0
        public void Preload(OCMApp app, QuickFilter filter)
        {
            m_App = app;

            if (filter != null)
            {
                m_App.CacheStore.GlobalFilters.AddFilterCriteria(FilterList.KEY_STATUS,
                                                       new bool[]{filter.Found, filter.NotFound, filter.Mine,
                                                                    filter.Available, filter.Unavailable, filter.Archived});
                m_App.CacheStore.AdvancedFilters = filter.AdvancedFilters;
                if (filter.ComboFilter != null)
                    m_App.CacheStore.CombinationFilter = filter.ComboFilter;
            }
            app.CacheStore.Complete += HandleAppCacheStoreComplete;
            app.CacheStore.ReadCache += HandleAppCacheStoreReadCache;
            if (app.AppConfig.UseGPSD)
                app.EnableGPS(false);
            app.CacheStore.GetUnfilteredCaches(app.CentreLat, app.CentreLon, app.OwnerIDs.ToArray());
        }