示例#1
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();
        }