public ImageCollageViewModel(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 (ImageCollageProgressViewModel vm = new ImageCollageProgressViewModel())
                {
                    progress.DataContext = vm;
                    vm.AsyncState = this;
                    progress.Show();
                    Task task = vm.generateImage();
                    OnClosingRequest();
                    await task;
                    MiscUtils.insertIntoHistoryCollection(OutputPathHistory, OutputPath);
                }
            });
            CancelCommand = new Command(() =>
            {
                OnClosingRequest();
            });

            DefaultsCommand = new Command(() =>
            {
                setDefaults(mediaFileWatcher);
            });
        }
Esempio n. 2
0
        public ImageCollageViewModel(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 (ImageCollageProgressViewModel vm = new ImageCollageProgressViewModel())
                {
                    progress.DataContext = vm;
                    vm.AsyncState        = this;
                    progress.Show();
                    Task task = vm.generateImage();
                    OnClosingRequest();
                    await task;
                    MiscUtils.insertIntoHistoryCollection(OutputPathHistory, OutputPath);
                }
            });
            CancelCommand = new Command(() =>
            {
                OnClosingRequest();
            });

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