//----< get directory from repostorage >------- private void getDir(RepoStorage RS, string dir) { if (RS.Dir_ == dir) { RS_ = RS; return; } foreach (RepoStorage child in RS.subDirs_) { getDir(child, dir); } }
//----< show files is selected directory >------- private void DirList_MouseDoubleClick(object sender, MouseButtonEventArgs e) { string selectedDir = (string)DirList.SelectedItem; if (DirList.SelectedIndex != -1) { if (selectedDir == "..") { if (pathStack_.Count > 1) { pathStack_.Pop(); setPath(); RS_ = pathStack_.Peek(); } else { return; } } else { pathStack_.Push(RS_.subDirs_[DirList.SelectedIndex - 1]); RS_ = RS_.subDirs_[DirList.SelectedIndex - 1]; setPath(); } clearDirs(); foreach (var dir in RS_.subDirs_) { addDir(dir.Dir_); } insertParent(); clearFiles(); foreach (var file in RS_.files_) { addFile(file); } } }
//----< constructor to initialize window >------- public AddChildren(RepoStorage RS) { InitializeComponent(); RS_ = RS; }