Exemple #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();
        }
Exemple #2
0
        public void AddChildWaypoint(double lat, double lon)
        {
            Waypoint newPoint = new Waypoint();
            Geocache parent   = m_Window.CacheList.SelectedCache;

            newPoint.Symbol = "Final Location";
            newPoint.Parent = parent.Name;
            newPoint.Lat    = lat;
            newPoint.Lon    = lon;
            String         name = "FL" + parent.Name.Substring(2);
            WaypointDialog dlg  = new WaypointDialog();

            dlg.IgnorePrefix = m_Config.IgnoreWaypointPrefixes;
            dlg.App          = this;
            if (m_Config.IgnoreWaypointPrefixes)
            {
                name             = parent.Name;
                dlg.IgnorePrefix = true;
            }
            name          = m_Store.GetUniqueName(name);
            newPoint.Name = name;
            dlg.SetPoint(newPoint);
            if ((int)ResponseType.Ok == dlg.Run())
            {
                newPoint = dlg.GetPoint();
                if (newPoint.Symbol == "Final Location")
                {
                    parent.HasFinal = true;
                }
                if (!parent.Children)
                {
                    parent.Children = true;
                }
                m_Store.AddWaypointOrCache(newPoint, false, false);
                m_Window.Refresh();
                m_Window.CacheInfo.SelectChildByName(newPoint.Name);
            }
            dlg.Hide();
        }
        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_mon.ModifyCache();
                        return;
                    }
                    WaypointDialog dlg = new WaypointDialog ();
                    String origname = wpt.Name;
                    dlg.SetPoint (wpt);
                    if ((int)ResponseType.Ok == dlg.Run ()) {
                        wpt = dlg.GetPoint ();
                        CacheStore store = Engine.getInstance().Store;
                        if (wpt.Name == origname)
                            store.UpdateWaypointAtomic (wpt);
                        else
                        {
                            store.DeleteWaypoint(origname);
                            store.UpdateWaypointAtomic(wpt);
                        }
                        dlg.Dispose ();
                        UpdateCacheInfo ();
                    }
                }
            } catch (Exception ex) {
                UIMonitor.ShowException (ex);
            }
        }
 protected virtual void doAdd(object sender, System.EventArgs e)
 {
     try {
         Waypoint newPoint = new Waypoint ();
         Geocache parent = m_mon.SelectedCache;
         newPoint.Symbol = "Final Location";
         newPoint.Parent = parent.Name;
         newPoint.Lat = parent.Lat;
         newPoint.Lon = parent.Lon;
         String name = "FL" + parent.Name.Substring (2);
         WaypointDialog dlg = new WaypointDialog ();
         if (m_mon.Configuration.IgnoreWaypointPrefixes)
         {
             name = parent.Name;
             dlg.IgnorePrefix = true;
         }
         name = Engine.getInstance().Store.GenerateNewName(name);
         newPoint.Name = name;
         dlg.SetPoint (newPoint);
         if ((int)ResponseType.Ok == dlg.Run ()) {
             newPoint = dlg.GetPoint ();
             if (newPoint.Symbol == "Final Location")
                 parent.HasFinal = true;
             CacheStore store = Engine.getInstance ().Store;
             store.AddWaypointAtomic (newPoint);
             dlg.Dispose ();
             UpdateCacheInfo ();
         }
     } catch (Exception ex) {
         UIMonitor.ShowException (ex);
     }
 }
Exemple #5
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();
 }
Exemple #6
0
 public void AddChildWaypoint(double lat, double lon)
 {
     Waypoint newPoint = new Waypoint ();
     Geocache parent = m_Window.CacheList.SelectedCache;
     newPoint.Symbol = "Final Location";
     newPoint.Parent = parent.Name;
     newPoint.Lat = lat;
     newPoint.Lon = lon;
     String name = "FL" + parent.Name.Substring (2);
     WaypointDialog dlg = new WaypointDialog ();
     dlg.IgnorePrefix = m_Config.IgnoreWaypointPrefixes;
     dlg.App = this;
     if (m_Config.IgnoreWaypointPrefixes)
     {
         name = parent.Name;
         dlg.IgnorePrefix = true;
     }
     name = m_Store.GetUniqueName(name);
     newPoint.Name = name;
     dlg.SetPoint (newPoint);
     if ((int)ResponseType.Ok == dlg.Run ()) {
         newPoint = dlg.GetPoint ();
         if (newPoint.Symbol == "Final Location")
             parent.HasFinal = true;
         if (!parent.Children)
             parent.Children = true;
         m_Store.AddWaypointOrCache (newPoint, false, false);
         m_Window.Refresh();
         m_Window.CacheInfo.SelectChildByName(newPoint.Name);
     }
     dlg.Hide();
 }