private void RotateShape() { if (dialogProcessor.Selection == null) { MessageBox.Show("Select a shape to rotate", "Rotate"); return; } using (var rotateDialog = new RotateDialog(dialogProcessor.Selection.Rotation)) { if (rotateDialog.ShowDialog() == DialogResult.OK) { dialogProcessor.Selection.Rotation = rotateDialog.Degrees; } } viewPort.Invalidate(); }
private void ImageRotateAngleButton_Click(object sender, RoutedEventArgs e) { if (ScanBitmapSource == null) return; if (!CurrentBook.CanImageChanged(SelectedScanImage.IsCover ? PartOfBook.FrontCover : PartOfBook.TableOfContents)) { MessageBox.Show("Naskenovaný obrázek nelze upravovat!", ImageRotateAngleButton.Header.ToString(), MessageBoxButton.OK, MessageBoxImage.Information); return; } try { this.Cursor = Cursors.Wait; RotateDialog dlg = new RotateDialog(this, SelectedScanImage); if (dlg.ShowDialog() == true) { ScanBitmapSource = ImageFunctions.Deskew(ScanBitmapSource, dlg.Angle); MainScanImageControl.Refresh(ScanBitmapSource); CurrentBook.SetImageChanged(SelectedScanImage.IsCover ? PartOfBook.FrontCover : PartOfBook.TableOfContents); } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source, MessageBoxButton.OK, MessageBoxImage.Error); Logger.Log(String.Format("ERROR: {0}", ex.Message)); } finally { SetMenuButtonsEnabled(); GetAvailableMemory(); Logger.Log(ImageRotateAngleButton.Header.ToString()); this.Cursor = null; } }