Beispiel #1
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            //Save current status
            SaveValues s = new SaveValues
            {
                IP              = txtIP.Text,
                Position        = currentLatLng,
                FollowPostion   = chkFollow.Checked,
                GoAutomatically = chkGo.Checked,
                UseRoads        = chkRoads.Checked,
                Speed           = speed,
                Zoom            = map.Zoom,
                Jitter          = jitter
            };

            SaveValues.WriteToBinaryFile <SaveValues>("settings.ini", s, false);
        }
Beispiel #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            int.TryParse(System.Configuration.ConfigurationManager.AppSettings["stepSleepMinMilliseconds"], out sleepMin);
            int.TryParse(System.Configuration.ConfigurationManager.AppSettings["stepSleepMaxMilliseconds"], out sleepMax);


            map.Position     = PointLatLng.Empty;
            map.MapProvider  = GMapProviders.GoogleMap;
            map.Manager.Mode = GMap.NET.AccessMode.ServerAndCache;

            markerOverlay         = new GMapOverlay();
            currentPositionMarker = new GMarkerGoogle(PointLatLng.Empty, GMarkerGoogleType.green);
            destinationMarker     = new GMarkerGoogle(PointLatLng.Empty, GMarkerGoogleType.red);
            markerOverlay.Markers.Add(destinationMarker);
            markerOverlay.Markers.Add(currentPositionMarker);
            map.Overlays.Add(markerOverlay);
            r          = new Random();
            stopwatch  = new Stopwatch();
            savedRoute = new List <SavedRoute>();

            SaveValues s = SaveValues.ReadFromBinaryFile <SaveValues>("settings.ini");

            currentLatLng     = s.Position;
            txtIP.Text        = s.IP;
            chkRoads.Checked  = s.UseRoads;
            chkGo.Checked     = s.GoAutomatically;
            chkFollow.Checked = s.FollowPostion;
            speed             = s.Speed;
            txtSpeed.Text     = speed.ToString();
            jitter            = s.Jitter;
            txtJitter.Text    = jitter.ToString();
            if (s.Zoom > 0)
            {
                map.Zoom = s.Zoom;
            }

            map.Position = currentLatLng;
            SetCurrentPosition();

            LoadRoutes();
        }