/// <summary>
        /// main window initialization
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            // default is walking
            walking_speed.IsChecked = true;
            running_speed.IsChecked = false;
            driving_speed.IsChecked = false;

            // default is reverse walking
            stop_at_end.IsChecked   = false;
            loop_to_start.IsChecked = false;
            loop_reverse.IsChecked  = true;

            gpx_save_button.IsEnabled = false;

            stop_spoofing_button.IsEnabled = false;

            // load native libraries for iDevice
            NativeLibraries.Load();

            // init walking timer.
            walking_timer                = new DispatcherTimer();
            walking_timer.Interval       = TimeSpan.FromMilliseconds(500); // 0.5 sec
            timer_callback               = new walking_timer_callback(g_polyline, myMap, this);
            timer_callback.walking_speed = c_fast_walking_speed;
            walking_timer.Tick          += timer_callback.one_step;
            walking_timer.IsEnabled      = true;
            walking_timer.Stop();

            loc_service = location_service.GetInstance(this);
            loc_service.ListeningDevice();

            if (loc_service.Devices.Count < 1)
            {
                device_prov.IsEnabled = false;
            }

            string ddi_path = AppDomain.CurrentDomain.BaseDirectory + "DDILocalRepo\\";

            if (!System.IO.Directory.Exists(ddi_path))
            {
                System.IO.Directory.CreateDirectory(ddi_path);
            }

            // set map center.
            Location map_center = new Location();

            map_center.Latitude  = Properties.Settings.Default.home_lat;
            map_center.Longitude = Properties.Settings.Default.home_lon;

            myMap.Center = map_center;
        }
Exemplo n.º 2
0
 public static location_service GetInstance(MainWindow wnd) => _instance ?? (_instance = new location_service(wnd));