private void GetGpsData()
        {
            this.progressBar1.Maximum = _fileNames.Count();
            this.progressBar1.Value   = 0;
            this.progressBar1.Visible = true;

            TaskScheduler taskScheduler = TaskScheduler.FromCurrentSynchronizationContext();

            Task.Factory.StartNew(() =>
            {
                foreach (string filename in _fileNames)
                {
                    if (!File.Exists(filename))
                    {
                        continue;
                    }

                    Image image         = Image.FromFile(filename);
                    GpsMetaData gpsData = image.GetGpsInfo();
                    image.Dispose();

                    ImageGpsMetaData imgGpsMetaData = new ImageGpsMetaData();
                    imgGpsMetaData.Altitude         = gpsData.Altitude;
                    imgGpsMetaData.Latitude         = gpsData.Latitude;
                    imgGpsMetaData.Longitude        = gpsData.Longitude;
                    imgGpsMetaData.Timestamp        = gpsData.Timestamp;
                    imgGpsMetaData.FileName         = filename;
                    _imageGpsMetaData.Add(imgGpsMetaData);

                    var token = Task.Factory.CancellationToken;
                    Task reportProgressTask = Task.Factory.StartNew(() =>
                    {
                        this.progressBar1.Value += 1;
                        ListViewItem item        = this.listView1.Items.Add(filename);

                        if (gpsData.Latitude != Double.MinValue && gpsData.Longitude != Double.MinValue)
                        {
                            item.SubItems.Add(gpsData.Latitude.ToString());
                            item.SubItems.Add(gpsData.Longitude.ToString());
                        }

                        if (gpsData.Altitude != Double.MinValue)
                        {
                            item.SubItems.Add(gpsData.Altitude.ToString());
                        }

                        if (gpsData.Timestamp != DateTime.MinValue)
                        {
                            item.SubItems.Add(gpsData.Timestamp.ToString("MM/dd/yyyy hh:mm:ss"));
                        }

                        if (this.progressBar1.Value == this.progressBar1.Maximum)
                        {
                            this.progressBar1.Visible = false;
                        }
                    }, token, TaskCreationOptions.None, taskScheduler);
                    reportProgressTask.Wait();
                }
            });
        }
        public static GpsMetaData GetGpsInfo(this Image image)
        {
            double?lat    = GetLatitude(image);
            double?lon    = GetLongitude(image);
            var    dTs    = GetGpsDateTimeStamp(image);
            var    alt    = GetAltitude(image);
            var    dTaken = GetDateTaken(image);
            var    result = new GpsMetaData();

            if (lat.HasValue)
            {
                result.Latitude = lat.Value;
            }
            if (lon.HasValue)
            {
                result.Longitude = lon.Value;
            }
            if (alt.HasValue)
            {
                result.Altitude = alt.Value;
            }
            if (dTs.HasValue)
            {
                result.Timestamp = dTs.Value;
            }
            else if (dTaken.HasValue)
            {
                result.Timestamp = dTaken.Value;
            }

            return(result);
        }