示例#1
0
        /// <summary>
        /// This function
        ///     - sets the server and solver parameters
        ///     - populates the stops NALocations
        ///     - gets and displays the server results (map, directions)
        /// </summary>
        private void cmdSolve_Click(object sender, System.EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            try
            {
                // Get SolverParams
                NAServerSolverParams solverParams = m_naServer.GetSolverParameters(cboNALayers.Text) as NAServerSolverParams;

                // Set Solver parameters
                SetServerSolverParams(solverParams);

                // Load Locations
                LoadLocations(solverParams);

                //Solve the Route
                NAServerSolverResults solverResults;
                solverResults = m_naServer.Solve(solverParams);

                //Get NAServer results in the tab controls
                OutputResults(solverParams, solverResults);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, "An error has occurred");
            }

            this.Cursor = Cursors.Default;
        }