Ejemplo n.º 1
0
        private void OnCanExecuteFileOperation(CanExecuteFileOperationEventArgs e)
        {
            var source = e.Sender as IFileListPaneViewModel;
            IFileListPaneViewModel target = null;

            if (e.Sender == LeftPane)
            {
                target = RightPane as IFileListPaneViewModel;
            }
            if (e.Sender == RightPane)
            {
                target = LeftPane as IFileListPaneViewModel;
            }

            switch (e.Action)
            {
            case FileOperation.Copy:
                if (!CanExecuteCopyCommand(source, target))
                {
                    e.Cancelled = true;
                }
                break;

            case FileOperation.Move:
                if (!CanExecuteMoveCommand(source, target))
                {
                    e.Cancelled = true;
                }
                break;

            case FileOperation.Delete:
                if (!CanExecuteDeleteCommand(source))
                {
                    e.Cancelled = true;
                }
                break;
            }
        }
Ejemplo n.º 2
0
        private void OnCanExecuteFileOperation(CanExecuteFileOperationEventArgs e)
        {
            IFileListPaneViewModel target = null;
            if (e.Sender == LeftPane) target = RightPane as IFileListPaneViewModel;
            if (e.Sender == RightPane) target = LeftPane as IFileListPaneViewModel;

            if (target == null || target.IsReadOnly)
            {
                e.Cancelled = true;
            }
        }