public MainWindowViewModel()
        {
            _BrowseFolderCommand = new DelegateCommand(DoBrowseFolderCommand, CanDoBrowseFolderCommand);
            _CloseFolderCommand = new DelegateCommand(DoCloseFolderCommand, CanDoCloseFolderCommand);

            _GotoFirstFileCommand = new DelegateCommand(DoGotoFirstFileCommand, CanDoGotoFirstFileCommand);
            _GotoPreviousFileCommand = new DelegateCommand(DoGotoPreviousFileCommand, CanDoGotoPreviousFileCommand);
            _GotoNextFileCommand = new DelegateCommand(DoGotoNextFileCommand, CanDoGotoNextFileCommand);
            _GotoLastFileCommand = new DelegateCommand(DoGotoLastFileCommand, CanDoGotoLastFileCommand);
            _GotoImageNameCommand = new DelegateCommand(DoGotoImageNameCommand, CanDoGotoImageNameCommand);

            _ZoomInCommand = new DelegateCommand(DoZoomInCommand, CanDoZoomInCommandCommand);
            _ZoomOutCommand = new DelegateCommand(DoZoomOutCommand, CanDoZoomOutCommandCommand);
            _ActualSizeCommand = new DelegateCommand(DoActualSizeCommand, CanDoActualSizeCommandCommand);
            _ZoomFitCommand = new DelegateCommand(DoZoomFitCommand, CanDoZoomFitCommandCommand);
            _FitWidthCommand = new DelegateCommand(DoFitWidthCommand, CanDoFitWidthCommandCommand);
            _FitHeightCommand = new DelegateCommand(DoFitHeightCommand, CanDoFitHeightCommandCommand);

            _RenameActiveImageCommand = new DelegateCommand(DoRenameActiveImageCommand, CanDoRenameActiveImageCommand);
            _DeleteActiveImageCommand = new DelegateCommand(DoDeleteActiveImageCommand, CanDoDeleteActiveImageCommand);

            _RefreshActiveImageCommand = new DelegateCommand(DoRefreshActiveImageCommand, CanDoRefreshActiveImageCommandCommand);

            _AboutCommand = new DelegateCommand(DoAboutCommand, CanDoAboutCommand);

            _ActiveImagesViewModel = new ActiveImagesViewModel();

            _ActiveImagesViewModel.ActiveFilesCollection.CollectionChanged += (s, e) =>
                {
                    _CloseFolderCommand.RaiseCanExecuteChanged();
                    RaisePositionCommandEvents();
                    RaiseZoomCommandEvents();
                    RaiseFileOperationEvents();
                };
            _ActiveImagesViewModel.ActiveImageChanged += (s, e) =>
                {
                    RaisePositionCommandEvents();
                };
            _ActiveImagesViewModel.PropertyChanged += (s, e) =>
                {
                    switch (e.PropertyName)
                    {
                        case "IsLoadingFiles":
                            RaiseFileOperationEvents();
                            break;
                    }
                };
        }
Пример #2
0
        public MainWindowViewModel()
        {
            _BrowseFolderCommand = new DelegateCommand(DoBrowseFolderCommand, CanDoBrowseFolderCommand);
            _CloseFolderCommand  = new DelegateCommand(DoCloseFolderCommand, CanDoCloseFolderCommand);

            _GotoFirstFileCommand    = new DelegateCommand(DoGotoFirstFileCommand, CanDoGotoFirstFileCommand);
            _GotoPreviousFileCommand = new DelegateCommand(DoGotoPreviousFileCommand, CanDoGotoPreviousFileCommand);
            _GotoNextFileCommand     = new DelegateCommand(DoGotoNextFileCommand, CanDoGotoNextFileCommand);
            _GotoLastFileCommand     = new DelegateCommand(DoGotoLastFileCommand, CanDoGotoLastFileCommand);
            _GotoImageNameCommand    = new DelegateCommand(DoGotoImageNameCommand, CanDoGotoImageNameCommand);

            _ZoomInCommand     = new DelegateCommand(DoZoomInCommand, CanDoZoomInCommandCommand);
            _ZoomOutCommand    = new DelegateCommand(DoZoomOutCommand, CanDoZoomOutCommandCommand);
            _ActualSizeCommand = new DelegateCommand(DoActualSizeCommand, CanDoActualSizeCommandCommand);
            _ZoomFitCommand    = new DelegateCommand(DoZoomFitCommand, CanDoZoomFitCommandCommand);
            _FitWidthCommand   = new DelegateCommand(DoFitWidthCommand, CanDoFitWidthCommandCommand);
            _FitHeightCommand  = new DelegateCommand(DoFitHeightCommand, CanDoFitHeightCommandCommand);

            _RenameActiveImageCommand = new DelegateCommand(DoRenameActiveImageCommand, CanDoRenameActiveImageCommand);
            _DeleteActiveImageCommand = new DelegateCommand(DoDeleteActiveImageCommand, CanDoDeleteActiveImageCommand);

            _RefreshActiveImageCommand = new DelegateCommand(DoRefreshActiveImageCommand, CanDoRefreshActiveImageCommandCommand);

            _AboutCommand = new DelegateCommand(DoAboutCommand, CanDoAboutCommand);

            _ActiveImagesViewModel = new ActiveImagesViewModel();

            _ActiveImagesViewModel.ActiveFilesCollection.CollectionChanged += (s, e) =>
            {
                _CloseFolderCommand.RaiseCanExecuteChanged();
                RaisePositionCommandEvents();
                RaiseZoomCommandEvents();
                RaiseFileOperationEvents();
            };
            _ActiveImagesViewModel.ActiveImageChanged += (s, e) =>
            {
                RaisePositionCommandEvents();
            };
            _ActiveImagesViewModel.PropertyChanged += (s, e) =>
            {
                switch (e.PropertyName)
                {
                case "IsLoadingFiles":
                    RaiseFileOperationEvents();
                    break;
                }
            };
        }