示例#1
0
        public async Task CopyFile()
        {
            // Arrange
            const string src = _existingFilePath;
            string       dst = Path.Combine(_existingDirPath2, Guid.NewGuid().ToString());

            Directory.CreateDirectory(dst);

            ICopyService copyService = new CopyService(_mockedLoger);

            // Act
            await copyService.CopyDirectory(src, dst);

            // Assert
            Validate(src, dst);
        }
示例#2
0
        private void Copy(PanelViewModel from, PanelViewModel to)
        {
            string fromfull = from.TotalPath + "\\" + from.SelectedItem;

            if (from.IsFile)
            {
                CopyService.CopyFile(fromfull, to.TotalPath);
            }
            else if (from.IsDir)
            {
                var dialog = MessageBox.Show($"Przekopiować folder wraz z całą jego zawartością?", "Uwaga", MessageBoxButton.YesNoCancel);
                if (dialog != MessageBoxResult.Cancel)
                {
                    CopyService.CopyDirectory(fromfull, to.TotalPath, dialog == MessageBoxResult.Yes);
                }
            }
            to.TotalPath = to.TotalPath; //Reload the panel
        }
示例#3
0
        private void Start_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(CopySource.Text))
            {
                //Messagebox isn't great, but it is quick
                MessageBox.Show("Please enter a copy source");
                return;
            }

            if (string.IsNullOrEmpty(CopyDestination.Text))
            {
                //Messagebox isn't great, but it is quick
                MessageBox.Show("Please enter a copy destination");
                return;
            }

            CopyService copyService = new CopyService();

            //Event handler
            copyService.FileCopied += copyService_FileCopied;

            copyService.CopyDirectory(CopySource.Text, CopyDestination.Text);
        }