Ejemplo n.º 1
0
        private void button6_Click(object sender, EventArgs e)
        {
            //F8
            MooveForm mf = new MooveForm();

            mf.SourceFolder = totCommPanel1.CurrentDirectory.FullName;
            mf.DestFolder   = "Видалити вибрані елементи?";
            if (mf.ShowDialog() != DialogResult.OK)
            {
                return;
            }



            foreach (FileSystemInfo fs in totCommPanel1.foldersFilesPanel.selectedFoldersFiles)
            {
                if (fs is DirectoryInfo)
                {
                    ((DirectoryInfo)fs).Delete(true);
                }
                else if (fs is FileInfo)
                {
                    ((FileInfo)fs).Delete();
                }
            }
        }
Ejemplo n.º 2
0
        private void button4_Click(object sender, EventArgs e)
        {
            //F6
            MooveForm mf = new MooveForm();

            mf.SourceFolder = totCommPanel1.CurrentDirectory.FullName;
            mf.DestFolder   = totCommPanel2.CurrentDirectory.FullName;

            if (mf.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (totCommPanel1.CurrentDirectory.FullName == mf.DestFolder)
            {
                MessageBox.Show("Не можна копіювати директорію саму у себе!");
                return;
            }

            foreach (FileSystemInfo fs in totCommPanel1.foldersFilesPanel.selectedFoldersFiles)
            {
                if (fs is DirectoryInfo)
                {
                    ((DirectoryInfo)fs).MoveTo(mf.DestFolder + "\\" + fs.Name);
                }
                else if (fs is FileInfo)
                {
                    ((FileInfo)fs).MoveTo(mf.DestFolder + "\\" + fs.Name);
                }
            }
        }
Ejemplo n.º 3
0
        private void button3_Click(object sender, EventArgs e)
        {
            //F5
            void CopyFolder(DirectoryInfo SourceDir, DirectoryInfo DestDir)
            {
                DirectoryInfo di = new DirectoryInfo(DestDir.FullName + "\\" + SourceDir.Name);

                if (di.Exists == false)
                {
                    di.Create();
                }

                foreach (FileSystemInfo fsi in SourceDir.GetFileSystemInfos())
                {
                    if (fsi is DirectoryInfo)
                    {
                        CopyFolder(((DirectoryInfo)fsi), di);
                    }
                    else if (fsi is FileInfo)
                    {
                        ((FileInfo)fsi).CopyTo(di.FullName + "\\" + fsi.Name);
                    }
                }
            }

            MooveForm mf = new MooveForm();

            mf.SourceFolder = totCommPanel1.CurrentDirectory.FullName;
            mf.DestFolder   = totCommPanel2.CurrentDirectory.FullName;

            if (mf.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (totCommPanel1.CurrentDirectory.FullName == mf.DestFolder)
            {
                MessageBox.Show("Не можна копіювати директорію саму у себе!");
                return;
            }

            foreach (FileSystemInfo fs in totCommPanel1.foldersFilesPanel.selectedFoldersFiles)
            {
                if (fs is DirectoryInfo)
                {
                    CopyFolder((DirectoryInfo)fs, new DirectoryInfo(mf.DestFolder));
                }
                else if (fs is FileInfo)
                {
                    ((FileInfo)fs).CopyTo(mf.DestFolder + "\\" + fs.Name);
                }
            }
        }
Ejemplo n.º 4
0
        private void button5_Click(object sender, EventArgs e)
        {
            //F7
            MooveForm mf = new MooveForm();

            mf.SourceFolder = totCommPanel1.CurrentDirectory.FullName;
            mf.DestFolder   = "";
            if (mf.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            DirectoryInfo di = new DirectoryInfo(totCommPanel1.CurrentDirectory.FullName + "\\" + mf.DestFolder);

            if (!di.Exists)
            {
                di.Create();
            }
        }