private bool OpenShapeFile()
 {
     System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog();
     ofd.Title            = App.Current.FindResource("tbSelectSHPFile").ToString();
     ofd.RestoreDirectory = true;
     ofd.Multiselect      = false;
     ofd.Filter           = "shape file (*.shp)|*.shp";
     if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         string shpFileName = ofd.FileName;
         string dbfFilename = Path.ChangeExtension(shpFileName, ".dbf");
         if (!ofd.CheckFileExists || !File.Exists(dbfFilename))
         {
             MessageBox.Show(App.Current.FindResource("msgSHPError").ToString(), App.Current.FindResource("msgError").ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             try
             {
                 FileInfo  fiSHP     = new FileInfo(shpFileName);
                 FileInfo  fiDBF     = new FileInfo(dbfFilename);
                 ShapeFile shapeFile = new ShapeFile();
                 shapeFile.Read(fiSHP, fiDBF);
                 if (shapeFile.FileHeader.ShapeType != 5)
                 {
                     throw new Exception(App.Current.FindResource("msgSHPTypeError").ToString());
                 }
                 _graphicsLayer.ClearGraphics();
                 Envelope env = new Envelope();
                 foreach (ShapeFileRecord record in shapeFile.Records)
                 {
                     Graphic graphic = record.ToGraphic();
                     //if the coordinates is wgs 84,try to convert to 3857
                     if (Math.Abs(record.Points[0].X) < 300 || Math.Abs(record.Points[0].Y) < 300)
                     {
                         graphic.Geometry = _webMercator.FromGeographic(graphic.Geometry);
                     }
                     if (graphic != null)
                     {
                         graphic.Symbol = new SimpleFillSymbol()
                         {
                             BorderBrush = new SolidColorBrush(Colors.Red),
                             Fill        = new SolidColorBrush(Color.FromArgb(100, 255, 0, 0))
                         }
                     }
                     ;
                     _graphicsLayer.Graphics.Add(graphic);
                     env = env.Union(graphic.Geometry.Extent);
                 }
                 DownloadExtent   = _webMercator.ToGeographic(env).Extent;
                 _downloadPolygon = AppUtility.ConvertEsriPolygonToPBSPolygon(AppUtility.UnionEsriPolygon(_graphicsLayer.Graphics));
                 return(true);
             }
             catch (Exception e)
             {
                 MessageBox.Show(e.Message, App.Current.FindResource("msgError").ToString(), MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     return(false);
 }