Ejemplo n.º 1
0
        public void EditChildWaypoint(Waypoint pt)
        {
            Geocache       parent   = m_Window.CacheList.SelectedCache;
            WaypointDialog dlg      = new WaypointDialog();
            string         origname = pt.Name;

            dlg.App          = this;
            dlg.IgnorePrefix = m_Config.IgnoreWaypointPrefixes;
            dlg.SetPoint(pt);
            if ((int)ResponseType.Ok == dlg.Run())
            {
                pt = dlg.GetPoint();
                if (pt.Symbol == "Final Location")
                {
                    parent.HasFinal = true;
                }
                if (!parent.Children)
                {
                    parent.Children = true;
                }
                m_Store.AddWaypointOrCache(pt, false, false);
                if (pt.Name != origname)
                {
                    m_Store.DeleteWaypoint(origname);
                }
                m_Window.Refresh();
                m_Window.CacheInfo.SelectChildByName(pt.Name);
            }
            dlg.Hide();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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();
        }