Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            // Make route
            AbstractListEndpoint point_a = ctrlRouteDetails.
                                           cbTypeA.SelectedItem as AbstractListEndpoint;
            AbstractListEndpoint point_b = ctrlRouteDetails.
                                           cbTypeB.SelectedItem as AbstractListEndpoint;

            if (_route == null)
            {
                // Make new route
                _route = ctrlRouteDetails.GetRoute(MakeVector(dgWaypoints.Rows[0]),
                                                   MakeVector(dgWaypoints.Rows[dgWaypoints.Rows.Count - 2]));
                if (_route == null)
                {
                    return;
                }
            }
            else
            {
                // Update existing
                _route.PointA = point_a.GetEndpoint(ctrlRouteDetails.tbZoneA.Text,
                                                    MakeVector(dgWaypoints.Rows[0]));
                _route.PointB = point_b.GetEndpoint(ctrlRouteDetails.tbZoneB.Text,
                                                    MakeVector(dgWaypoints.Rows[dgWaypoints.Rows.Count - 2]));
                _route.Description = ctrlRouteDetails.tbDescr.Text;
                _route.Reversible  = ctrlRouteDetails.cbReversible.Checked;
            }

            // Add waypoints except  last empty line
            Waypoints waypoints = GetWaypointsList(_route.FileName);

            // Save route
            if (RouteListManager.SaveRoute(_route, waypoints, _lfs))
            {
                string s = "Route successfully saved";

                if (_route.FileName == null)
                {
                    s += ". No export file generated.";
                }
                else
                {
                    s += ".\nExport data located in the file '" +
                         _route.FileName + "'";
                }

                ctrlRouteDetails.lblWaypointFile.Text =
                    "Waypoint : " + _route.WaypointFileName;

                ShowSuccessMessage(s);
                IsChanged = false;
            }
        }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Route route = GetRoute();

            // Save route
            if (RouteListManager.SaveRoute(route, _lfs))
            {
                IsChanged = false;

                // Replace saved node
                SetTreeNode(route, tvRoutes.SelectedNode);
                tvRoutes.Sort();

                ShowSuccessMsg(route, "saved", false);
            }
        }