Example #1
0
        void IOpenMenuOperations.Open()
        {
            List <string> selectedPaths = PendingChangesSelection.
                                          GetSelectedPathsWithoutMeta(mPendingChangesTreeView);

            FileSystemOperation.Open(selectedPaths);
        }
Example #2
0
        void PendingChangesViewMenu.IMetaMenuOperations.OpenMeta()
        {
            List <string> selectedPaths = PendingChangesSelection
                                          .GetSelectedMetaPaths(mPendingChangesTreeView);

            FileSystemOperation.Open(selectedPaths);
        }
Example #3
0
        void IPendingChangesMenuOperations.OpenWith()
        {
            List <string> selectedPaths = PendingChangesSelection
                                          .GetSelectedPathsWithoutMeta(mPendingChangesTreeView);

            OpenOperation.OpenWith(
                FileSystemOperation.GetExePath(),
                selectedPaths);
        }
Example #4
0
                protected override void OnOperationFound(FileSystemOperation operation)
                {
                    PendingOperations.Add(new OperationItem(operation));

                    if (ShouldUpdate())
                    {
                        RequestUpdate();
                    }
                }
Example #5
0
        public async Task BeginCopyOperation(FileSystemElement targetFolder, List <IStorageItem> sourceItems)
        {
            var itemsString = sourceItems.Count > 1 ? sourceItems.Count.ToString() : sourceItems[0].Name;
            var operation   = new FileSystemOperation(FileSystemOperations.Copy, itemsString, targetFolder);

            Operations.Add(operation);
            await FileSystem.CopyStorageItemsAsync(targetFolder, sourceItems);

            Operations.Remove(operation);
        }
Example #6
0
 public FileSystemDialogResult Show(FileSystemElement element, FileSystemOperation operation, string initialPath = default(string), string message = null, string title = null, IWindow parent = null)
 {
     if (parent is Window window)
     {
         return(window.Dispatcher.Invoke(() => new FileSystemDialog(element, operation, text, initialPath, message, title, parent).Show()));
     }
     else
     {
         return(new FileSystemDialog(element, operation, text, initialPath, message, title).Show());
     }
 }
Example #7
0
        void IHistoryViewMenuOperations.OpenRevisionWith()
        {
            List <HistoryRevision> revisions = HistorySelection.
                                               GetSelectedHistoryRevisions(mHistoryListView);

            OpenRevisionOperation.OpenWith(
                mRepSpec,
                FileSystemOperation.GetExePath(),
                Path.GetFileName(mPath),
                revisions);
        }
Example #8
0
        void IOpenMenuOperations.OpenInExplorer()
        {
            List <string> selectedPaths = PendingChangesSelection
                                          .GetSelectedPathsWithoutMeta(mPendingChangesTreeView);

            if (selectedPaths.Count < 1)
            {
                return;
            }

            FileSystemOperation.OpenInExplorer(selectedPaths[0]);
        }
Example #9
0
            public OperationItem(FileSystemOperation op) : base(new[] { string.Empty, op.FileName, op.FilePath, string.Empty })
            {
                switch (op)
                {
                case CreateDirectoryOperation _:
                    Text       = "Create directory";
                    BackColor  = s_green;
                    ImageIndex = CreateDirectoryImageIndex;
                    break;

                case DestroyDirectoryOperation _:
                    Text       = "Destroy directory";
                    BackColor  = s_red;
                    ImageIndex = DestroyDirectoryImageIndex;
                    break;

                case CopyFileOperation _:
                    Text       = "Copy file";
                    BackColor  = s_green;
                    ImageIndex = CopyFileImageIndex;
                    break;

                case EditFileOperation _:
                    Text       = "Edit file";
                    BackColor  = s_yellow;
                    ImageIndex = EditFileImageIndex;
                    break;

                case EditAttributesOperation _:
                    Text       = "Edit attributes";
                    BackColor  = s_yellow;
                    ImageIndex = EditAttributesImageIndex;
                    break;

                case DeleteFileOperation _:
                    Text       = "Delete file";
                    BackColor  = s_red;
                    ImageIndex = DeleteFileImageIndex;
                    break;

                default:
                    throw new NotSupportedException();
                }

                Operation = op;
            }
Example #10
0
                private void ProcessOperation(int index, FileSystemOperation op)
                {
                    try
                    {
                        op.Perform();
                        ProcessingQueue.Add(new ChangeResult(index, null));
                    }
                    catch (Exception ex) when(ex is ArgumentException ||
                                              ex is IOException ||
                                              ex is UnauthorizedAccessException ||
                                              ex is SecurityException)
                    {
                        ProcessingQueue.Add(new ChangeResult(index, ex));
                    }

                    ProcessedWeight += GetOperationWeight(op);
                }
        internal FileSystemDialog(
            FileSystemElement element,
            FileSystemOperation operation,
            IText text,
            string initialPath = default(string),
            string message     = default(string),
            string title       = default(string),
            IWindow parent     = default(IWindow))
        {
            this.element     = element;
            this.initialPath = initialPath;
            this.message     = message;
            this.operation   = operation;
            this.parent      = parent;
            this.text        = text;
            this.title       = title;

            InitializeComponent();
            InitializeDialog();
        }
Example #12
0
            private static long GetOperationWeight(FileSystemOperation op)
            {
                switch (op)
                {
                case CreateDirectoryOperation _:
                case DestroyDirectoryOperation _:
                case EditAttributesOperation _:
                case DeleteFileOperation _:
                    return(1);

                case CopyFileOperation copy:
                    return(1 + copy.SourceFile.Length / 8192);

                case EditFileOperation edit:
                    return(1 + edit.SourceFile.Length / 8192);

                default:
                    throw new NotSupportedException();
                }
            }
 protected virtual void OnOperationFound(FileSystemOperation operation)
 {
     OperationFound?.Invoke(this, new FileSystemOperationEventArgs(operation));
 }
Example #14
0
 public FileSystemOperationEventArgs(FileSystemOperation operation)
 {
     Operation = operation;
 }