void btnConvert_Click(object sender, RoutedEventArgs e) { btnSavePages.IsEnabled = false; if (_converting) { btnConvert.Content = "Canceling"; _writer.Cancel(); return; } _converting = true; btnConvert.Content = "Cancel"; Config.BitmapConverter.Rotate = 270; KindleDocumentConverter converter = new KindleDocumentConverter(Config.Document, Enumerable.Range(1, Config.Document.PageCount), Config.PageHeight); _convert(converter); }