// can be called from different thread: public static void BringFormUp(PhotoDescr photoDescr, Waypoint wpt) { try { if (wpt != null) { m_wpt = wpt; PhotoWaypoints.SetCurrentWaypoint(m_wpt); } else { m_wpt = PhotoWaypoints.CurrentWaypoint(); } if (photoDescr == null) { try { photoDescr = PhotoDescr.FromThumbnail(m_wpt.ThumbSource); } // An invalid image will throw an OutOfMemoryException // exception catch (OutOfMemoryException) { } } else if (wpt == null) { m_wpt = null; // from Unrelated photos } m_photoDescr = photoDescr; if (This == null) { if (Project.mainForm.InvokeRequired) { Project.mainForm.Invoke(new MethodInvoker(RunPhotoFullSizeForm)); } else { RunPhotoFullSizeForm(); } } else { if (Project.mainForm.InvokeRequired) { Project.mainForm.Invoke(new MethodInvoker(RunBringUp)); } else { RunBringUp(); } } } catch {} }
private void zoomCloseButton_Click(object sender, System.EventArgs e) { Waypoint wpt = PhotoWaypoints.CurrentWaypoint(); if (wpt != null) { if (Math.Round(PictureManager.This.CameraManager.Location.Elev / 10.0d) != Math.Round(Project.CAMERA_HEIGHT_REAL_CLOSE * 100.0d)) { DlgPhotoManager.savedLocation = new GeoCoord(PictureManager.This.CameraManager.Location); } GeoCoord newLocation = new GeoCoord(wpt.Location); newLocation.Elev = Project.CAMERA_HEIGHT_REAL_CLOSE * 1000.0d; // for 1m/pixel PictureManager.This.CameraManager.SpoilPicture(); PictureManager.This.CameraManager.Location = newLocation; // calls ProcessCameraMove(); zoomCloseButton.Enabled = false; zoomOutButton.Enabled = true; } }
/// <summary> /// returns true if it could actually find something to display /// </summary> /// <returns></returns> private bool preview() { bool ret = false; disableButtons(); // Create an Image object from the specified file. try { m_wpt = PhotoWaypoints.CurrentWaypoint(); if (m_wpt != null) { PhotoDescr photoDescr = PhotoDescr.FromThumbnail(m_wpt.ThumbSource); photoViewerControl.photoDescr = m_photoDescr = photoDescr; setPhotoDetail(); if (m_keepInView) { PictureManager.This.CameraManager.keepInView(m_wpt.Location); } PictureManager.This.CameraManager.MarkLocation(m_wpt.Location, 0); ret = true; } else { photoViewerControl.photoDescr = m_photoDescr = null; } } // An invalid image will throw an OutOfMemoryException // exception catch (OutOfMemoryException) { throw new InvalidOperationException("'" + m_wpt.ThumbSource + "' is not a valid image file."); } if (ret) { setupButtons(); } DlgPhotoManager.sync(false); this.BringToFront(); return(ret); }