Esempio n. 1
0
 private void addFileButton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (Directory.Exists(ListFiles.varListPath))
         {
             InputWin addDirWin = new InputWin(RightListFile, ListFiles.varListPath, "Создать файл с именем (и расширением): ");
             addDirWin.Owner = this;
             addDirWin.Show();
             addDirWin.Enter  += OperationsWithFiles.CreateFile;
             addDirWin.Output += ListFiles.OutDirAndFiles;
         }
     }
     catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка"); }
 }
Esempio n. 2
0
 private void RenameButton_Click(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (RightListFile.SelectedItem != null && SelectedItemList.Name != "..")
         {
             string   textForNewWin = "Переименовать \"" + SelectedItemList.Name + "\"";
             InputWin renameWin     = new InputWin(RightListFile, ListFiles.varListPath, textForNewWin);
             renameWin.Owner = this;
             renameWin.Show();
             renameWin.Enter  += Rename;
             renameWin.Output += ListFiles.OutDirAndFiles;
         }
     } catch (Exception ex) { MessageBox.Show(ex.Message); }
 }
Esempio n. 3
0
 private void DecryptButton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (RightListFile.SelectedItem != null && SelectedItemList.Name != "..")
         {
             string   textForNewWin = "Ключ для расшифрования \"" + SelectedItemList.Name + "\"";
             InputWin renameWin     = new InputWin(RightListFile, ListFiles.varListPath, textForNewWin);
             renameWin.Owner = this;
             renameWin.Show();
             renameWin.Enter  += Decrypt;
             renameWin.Output += ListFiles.OutDirAndFiles;
         }
     }
     catch (Exception ex) { MessageBox.Show(ex.Message); }
 }
Esempio n. 4
0
        private void Window_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Delete)
            {
                if (RightListFile.SelectedItem != null && SelectedItemList.Name != "..")
                {
                    string valid = Path.Combine(ListFiles.varListPath, SelectedItemList.Name);
                    if (valid != Directory.GetDirectoryRoot(valid))
                    {
                        if (File.Exists(Path.Combine(ListFiles.varListPath, SelectedItemList.Name)))
                        {
                            OperationsWithFiles.DeleteFile(RightListFile, SelectedItemList.Name);
                        }
                        else if (Directory.Exists(Path.Combine(ListFiles.varListPath, SelectedItemList.Name)))
                        {
                            OperationsWithDirectories.DeleteDir(RightListFile, SelectedItemList.Name);
                        }
                    }
                }
            }//Del
            if (e.Key == Key.Back)
            {
                ListFiles.UpInPath(RightListFile, RightSearchDirText, ListFiles.varListPath);
            } //Back
            if (e.Key == Key.Enter)
            {
                if (RightListFile.SelectedItem != null)
                {
                    ListFiles.DB_ClickInList(RightListFile, RightSearchDirText, SelectedItemList.Name);
                }
            }// Enter

            if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control && e.Key == Key.C)// Ctrl + C
            {
                if (RightListFile.SelectedItem != null && SelectedItemList.Name != "..")
                {
                    if (File.Exists(Path.Combine(ListFiles.varListPath, SelectedItemList.Name)))
                    {
                        OperationsWithFiles.CopyFile(RightListFile, "Copy", SelectedItemList.Name);
                    }

                    else if (Directory.Exists(Path.Combine(ListFiles.varListPath, RightListFile.SelectedItem.ToString())))
                    {
                        OperationsWithDirectories.CopyDir(RightListFile, SelectedItemList.Name);
                    }
                }
            }// Ctrl + C
            if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control && e.Key == Key.X) // Ctrl + X
            {
                if (RightListFile.SelectedValue != null && SelectedItemList.Name != "..")
                {
                    if (File.Exists(Path.Combine(ListFiles.varListPath, SelectedItemList.Name)))
                    {
                        OperationsWithFiles.CopyFile(RightListFile, "Cut", SelectedItemList.Name);
                    }

                    else if (Directory.Exists(Path.Combine(ListFiles.varListPath, SelectedItemList.Name)))
                    {
                        OperationsWithDirectories.CutDir(RightListFile, SelectedItemList.Name);
                    }
                }
            }// Ctrl + X
            if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control && e.Key == Key.V) // Ctrl + V
            {
                try
                {
                    if (File.Exists(ListFiles.thisPath))
                    {
                        if (ListFiles.CutOrCopy == "Copy")
                        {
                            OperationsWithFiles.PasteAfterCopyFile(RightListFile);
                        }
                        else if (ListFiles.CutOrCopy == "Cut")
                        {
                            OperationsWithFiles.PasteAfterCutFile(RightListFile);
                        }
                    }
                    else if (Directory.Exists(ListFiles.thisPath))
                    {
                        OperationsWithDirectories.PasteDir(RightListFile, ListFiles.CutOrCopy);
                    }
                }
                catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка"); }
            }// Ctrl + V
            if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control && e.Key == Key.R)
            {
                try
                {
                    if (RightListFile.SelectedItem != null && SelectedItemList.Name != "..")
                    {
                        string   textForNewWin = "Переименовать \"" + SelectedItemList.Name + "\"";
                        InputWin renameWin     = new InputWin(RightListFile, ListFiles.varListPath, textForNewWin);
                        renameWin.Owner = this;
                        renameWin.Show();
                        renameWin.Enter  += Rename;
                        renameWin.Output += ListFiles.OutDirAndFiles;
                    }
                }
                catch (Exception ex) { MessageBox.Show(ex.Message); }
            }// Ctrl + R
            if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control && e.Key == Key.D)
            {
                if (Directory.Exists(ListFiles.varListPath))
                {
                    InputWin addDirWin = new InputWin(RightListFile, ListFiles.varListPath, "Создать папку с именем: ");
                    addDirWin.Owner = this;
                    addDirWin.Show();
                    addDirWin.Enter  += OperationsWithDirectories.CreateDir;
                    addDirWin.Output += ListFiles.OutDirAndFiles;
                }
            }// Ctrl + D
            if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control && e.Key == Key.F)
            {
                if (Directory.Exists(ListFiles.varListPath))
                {
                    InputWin addDirWin = new InputWin(RightListFile, ListFiles.varListPath, "Создать файл с именем (и расширением): ");
                    addDirWin.Owner = this;
                    addDirWin.Show();
                    addDirWin.Enter  += OperationsWithFiles.CreateFile;
                    addDirWin.Output += ListFiles.OutDirAndFiles;
                }
            }// Ctrl + F
        }