Hi,
I have a ViewModel:
public class ImportPdfViewModel : ReactiveObject
{
public ImportPdfViewModel(MainViewModel mainViewModel, IIOService openFileDialogService)
{
MainViewModel = mainViewModel;
//
this.WhenAnyValue(This => This.PdfFilePath).Where(x => x != null).Subscribe((pdfFilePath) =>
{
PdfDocumentStream = new FileStream(pdfFilePath, FileMode.OpenOrCreate, FileAccess.Read);
});
//
SelectFilePathCommand = ReactiveCommand
.Create(() => openFileDialogService.OpenFileDialog(@"D:\jr-T\VS\Hardyman\DudleyVoidsProcessor\DataIn"));
SelectFilePathCommand.Subscribe((pdfFilePath) => { PdfFilePath = pdfFilePath; });
//
ImportPdfDataCommand = ReactiveCommand.Create(() => { }, this.WhenAnyValue(This => This.PdfFilePath).Where(pdfFilePath => PdfFilePath != null).Any());
}
public MainViewModel MainViewModel { get; set; }
private string _PdfFilePath;
public string PdfFilePath
{
get => _PdfFilePath;
set => this.RaiseAndSetIfChanged(ref _PdfFilePath, value);
}
private Stream _PdfDocumentStream;
public Stream PdfDocumentStream
{
get => _PdfDocumentStream;
set => this.RaiseAndSetIfChanged(ref _PdfDocumentStream, value);
}
public ReactiveCommand<Unit, String> SelectFilePathCommand { get; set; }
public ReactiveCommand<Unit, Unit> ImportPdfDataCommand { get; set; }
}
I would like to add a command that moves to a particular page eg:
public ReactiveCommand<int, Unit> MoveToPageCommand{ get; set; }
that I can call like this (eg move to page 12):
MoveToPageCommand.Execute(12);
The problem I have is that I cannot figure out what bindings i need to put in place on the PdfViewControl?
Cheers,
James.