public VideoPreviewImageViewModel(MediaFileWatcher mediaFileWatcher)
        {            
            setDefaults(mediaFileWatcher);
            
            directoryPickerCommand = new Command(new Action(() =>
            {
                DirectoryPickerView directoryPicker = new DirectoryPickerView();
                DirectoryPickerViewModel vm = (DirectoryPickerViewModel)directoryPicker.DataContext;
                vm.SelectedPath = OutputPath;
                vm.PathHistory = OutputPathHistory;

                if (directoryPicker.ShowDialog() == true)
                {
                    OutputPath = vm.SelectedPath;
                }

            }));

            OkCommand = new Command(async () =>
            {
                CancellableOperationProgressView progress = new CancellableOperationProgressView();
                using (VideoPreviewImageProgressViewModel vm = new VideoPreviewImageProgressViewModel())
                {
                    progress.DataContext = vm;
                    vm.AsyncState = this;
                    progress.Show();
                    Task task = vm.generatePreviews();
                    OnClosingRequest();
                    await task;
                    MiscUtils.insertIntoHistoryCollection(OutputPathHistory, OutputPath);
                }
            });
            CancelCommand = new Command(() =>
            {
                OnClosingRequest();
            });

            DefaultsCommand = new Command(() =>
                {
                    setDefaults(mediaFileWatcher);
                });
        }
Example #2
0
        public VideoPreviewImageViewModel(MediaFileWatcher mediaFileWatcher)
        {
            setDefaults(mediaFileWatcher);

            directoryPickerCommand = new Command(new Action(() =>
            {
                DirectoryPickerView directoryPicker = new DirectoryPickerView();
                DirectoryPickerViewModel vm         = (DirectoryPickerViewModel)directoryPicker.DataContext;
                vm.SelectedPath = OutputPath;
                vm.PathHistory  = OutputPathHistory;

                if (directoryPicker.ShowDialog() == true)
                {
                    OutputPath = vm.SelectedPath;
                }
            }));

            OkCommand = new Command(async() =>
            {
                CancellableOperationProgressView progress = new CancellableOperationProgressView();
                using (VideoPreviewImageProgressViewModel vm = new VideoPreviewImageProgressViewModel())
                {
                    progress.DataContext = vm;
                    vm.AsyncState        = this;
                    progress.Show();
                    Task task = vm.generatePreviews();
                    OnClosingRequest();
                    await task;
                    MiscUtils.insertIntoHistoryCollection(OutputPathHistory, OutputPath);
                }
            });
            CancelCommand = new Command(() =>
            {
                OnClosingRequest();
            });

            DefaultsCommand = new Command(() =>
            {
                setDefaults(mediaFileWatcher);
            });
        }