Esempio n. 1
0
        private async Task PasteAsync(IDataObject dataObject)
        {
            bool move;
            var  paths = dataObject.FromFileDropList(out move);

            conflictAction = FileConflictAction.None;

            var operations = paths
                             .Select(path => CopyOrMoveOperation(
                                         path,
                                         Path.Combine(Navigation.FullPath, Path.GetFileName(path)),
                                         move
                                         ))
                             .Where(o => o != null)
                             .ToArray();

            var dialog = new OperationProgressViewModel(operations)
            {
                Caption = $"{(move ? Properties.Resources.File_Moving : Properties.Resources.File_Copying)} {operations.Sum(o => o.Count)} files."
            };

            await Messenger.SendAsync(dialog);

            if (move && dialog.IsCancellationRequested == false)
            {
                ClipboardManager.Clear();
            }
        }
Esempio n. 2
0
        public DeviceDeploymentViewModel(DeviceDeployer deployer, IDialogService dialogService,
                                         IDeviceRepository deviceRepository, OperationProgressViewModel operationProgress)
        {
            this.deployer         = deployer;
            this.dialogService    = dialogService;
            this.deviceRepository = deviceRepository;
            OperationProgress     = operationProgress;

            ConfigureCommands();

            IsBusyObservable = Deploy.IsExecuting;
        }
Esempio n. 3
0
        public AdvancedViewModel(ScriptDeployer deployer, IDialogService dialogService,
                                 IFilePicker filePicker, OperationProgressViewModel operationProgress)
        {
            this.deployer      = deployer;
            this.dialogService = dialogService;
            this.filePicker    = filePicker;
            OperationProgress  = operationProgress;

            ConfigureCommands();

            IsBusyObservable = RunScript.IsExecuting;
        }
Esempio n. 4
0
        private async Task ZipAsync()
        {
            var zipPath = Path.Combine(
                Navigation.FullPath,
                Path.ChangeExtension(SelectedPaths.First(), ".zip")
                ).CopyableFileName();

            using (var archive = ZipFile.Open(zipPath, ZipArchiveMode.Create))
            {
                var operations = SelectedPaths.Select(path => ZipOperation(archive, path)).ToArray();

                var dialog = new OperationProgressViewModel(operations)
                {
                    Caption = string.Format(Properties.Resources.File_Zipping, operations.Sum(o => o.Count))
                };

                await Messenger.SendAsync(dialog);
            }
        }
Esempio n. 5
0
 public MainViewModel(IList <Meta <ISection> > sections, IList <IBusy> busies, IDialogService contextDialog, OperationProgressViewModel operationProgress) : base(sections, busies)
 {
     OperationProgress  = operationProgress;
     ShowWarningCommand = ReactiveCommand.CreateFromTask(() => contextDialog.Notice(Resources.TermsOfUseTitle, Resources.WarningNotice));
 }