public BrowsePage() { InitializeComponent(); InitializeApplicationBar(); DataContext = Browse = new VMBrowse(App.ViewModel, App.ViewModel.SelectedZone.SelectedInput, App.ViewModel.SelectedZone.TheZone); Browse.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler(List_PropertyChanged); Browse.OnSelectedItem += new EventHandler(List_OnSelectedItem); Browse.Refresh(); }
public ActionResult Browse(int?id, string path = "") { if (!id.HasValue) { return(RedirectToAction("Index")); } FTPK_FTPs site = dbContext.FTPK_FTPs.Where(x => x.ID == id).FirstOrDefault(); if (site == null) { return(HttpNotFound()); } if (!SecurityManager.canRead(site.ID)) { return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized)); } SftpClientWrapper sftp = initSFTP(site); AppResponse <List <VMDirectoryItem> > resp = sftp.getDirectoryContents(path); VMBrowse model = new VMBrowse(); if (resp.success) { List <VMDirectoryItem> items = (List <VMDirectoryItem>)resp.getData(); VMSFTPPermission permissions = SecurityManager.getPermissions(site.ID); model = new VMBrowse(items.OrderBy(x => x.typeSequence).ThenBy(x => x.name).ToList(), id.Value, path, getPreviousPath(path), site.DisplayName, permissions); model.navLinks = getNavigationTreeLinks(path); } else { model.errorMessage = "Something when wrong. " + resp.message; } return(View(model)); }