コード例 #1
0
        private bool ViewIsValid()
        {
            bool   isValid  = false;
            string errorMsg = string.Empty;

            ClearViewErrors();
            if (PdfFiles.Count < 2)
            {
                ProgressStatus = "Please make sure you select at least two PDF files to merge using the + button or [ Ins ].";
            }
            else if (PdfFiles.Where(file => file.IsLocked == true).Any())
            {
                ProgressStatus = "Please unlock any locked PDF file by clicking the lock button in the list or [ Ctrl+U ].";
            }
            else
            {
                if (FileHelpers.FileNameIsValid(BaseFileName, out errorMsg) != Define.Success)
                {
                    SetErrors("BaseFileName", new List <ValidationResult>()
                    {
                        new ValidationResult(false, errorMsg)
                    });
                }

                if (FileHelpers.FolderIsValid(DestinationFolder, out errorMsg) != Define.Success)
                {
                    SetErrors("DestinationFolder", new List <ValidationResult>()
                    {
                        new ValidationResult(false, errorMsg)
                    });
                }
                isValid = !HasErrors;
            }
            return(isValid);
        }
コード例 #2
0
        private void ClearFilesCommand_Execute()
        {
            var files = PdfFiles.Where(
                file => SelectedPdfFiles.All(f => f != file));

            PdfFiles = new ObservableCollection <string>(files);
        }