Ejemplo n.º 1
0
        private void ClearPathsToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            CustomPathWaypoints.Clear();
            CustomPathStartWaypoints.Clear();
            CustomPathEndWaypoints.Clear();
            CustomPathNames.Clear();

            MapPictureBox.Invalidate();
        }
Ejemplo n.º 2
0
        private void LoadPathToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "Text |*.txt";
            ofd.Title  = "Open path";
            ofd.ShowDialog();

            if (ofd.FileName != "")
            {
                try
                {
                    string path = File.ReadAllText(ofd.FileName);

                    string[] waypointsComponents = path.Split(';');

                    List <uint> mapIds = Program.ExtractCommaDelimitedUInts(waypointsComponents[0].Trim());

                    if (mapIds[0] != SetPathWaypoints[0].MapId)
                    {
                        MessageBox.Show("Path not on current map.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    List <double>   xs           = Program.ExtractCommaDelimitedDoubles(waypointsComponents[1].Trim());
                    List <double>   ys           = Program.ExtractCommaDelimitedDoubles(waypointsComponents[2].Trim());
                    List <Waypoint> waypointList = new List <Waypoint>();

                    for (int i = 0; i < mapIds.Count; i++)
                    {
                        waypointList.Add(new Waypoint(mapIds[i], xs[i], ys[i]));
                    }

                    CustomPathWaypoints.AddRange(waypointList);
                    CustomPathStartWaypoints.Add(waypointList[0]);
                    CustomPathEndWaypoints.Add(waypointList[waypointList.Count - 1]);

                    FileInfo fi = new FileInfo(ofd.FileName);
                    CustomPathNames.Add(fi.Name);

                    MapPictureBox.Invalidate();
                }
                catch (Exception err)
                {
                    MessageBox.Show(err.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Ejemplo n.º 3
0
 private void M_ApiDataUpdateTimer_Tick(object sender, System.EventArgs e)
 {
     MapPictureBox.Invalidate();
 }