public TCPanelPresenter(ITCPanelView view, Model model) { this.view = view; this.model = model; this.view.LoadDrivesList += View_LoadDrivesList; this.view.LoadDirectoryElements += View_LoadDirectoryElements; this.view.SelectedDriveChanged += View_SelectedDriveChanged; this.view.SubfolderChosen += View_SubpathChosen; Init(); }
public TCPanelPresenter(ITCPanelView view, Model model) { this.view = view; this.model = model; initDrives(); SetDefaultPath(); SetDefaultDirectory(); LoadDirectoryElements(); this.view.SelectDrive += SetPath; this.view.PathChanged += LoadDirectoryElements; this.view.SelectedItem += GoToDirecotry; }
public string CopyData(ITCPanelView left, ITCPanelView right) { String SelectedItemToCopy = left.ItemToCopy.Trim(); String SelectedPathFromCopy = left.CurrentPath.Trim(); String DestinatnionPath = right.CurrentPath; Console.WriteLine(SelectedPathFromCopy); Console.WriteLine(SelectedItemToCopy); if ((SelectedPathFromCopy != "") && (SelectedItemToCopy != "")) { if (SelectedItemToCopy[0] == 'F') { SelectedItemToCopy = SelectedItemToCopy.Substring(3); //add back slash for path if (!SelectedPathFromCopy[SelectedPathFromCopy.Length - 1].Equals('\\')) { SelectedPathFromCopy += "\\"; } if (!DestinatnionPath[DestinatnionPath.Length - 1].Equals('\\')) { DestinatnionPath += "\\"; } String PathAndItem = String.Concat(SelectedPathFromCopy, SelectedItemToCopy); DestinatnionPath = String.Concat(DestinatnionPath, SelectedItemToCopy); if (DestinatnionPath != "") { if (!File.Exists(DestinatnionPath)) { try { File.Copy(PathAndItem, DestinatnionPath); } catch (Exception e) { return("Brak dostepu"); } } else { return("Nie mozna nadpisac pliku"); } } } else { SelectedItemToCopy = SelectedItemToCopy.Substring(3); //add back slash for path if (!SelectedPathFromCopy[SelectedPathFromCopy.Length - 1].Equals('\\')) { SelectedPathFromCopy += "\\"; } if (!DestinatnionPath[DestinatnionPath.Length - 1].Equals('\\')) { DestinatnionPath += "\\"; } String PathAndItem = String.Concat(SelectedPathFromCopy, SelectedItemToCopy); DestinatnionPath = DestinatnionPath + "\\" + SelectedItemToCopy; if (DestinatnionPath != "") { try { Directory.CreateDirectory(DestinatnionPath); DirectoryCopy(PathAndItem, DestinatnionPath, true); } catch (Exception e) { return("Brak praw do kopiowania"); } } } } else { return("Wybierz element do skopiowania"); } return(""); //Console.WriteLine(PathAndItem); }