protected void UpdateFolderList() { FolderList.Clear(); foreach (string dir in DirAndFileScanner.GetFolderList()) { FolderList.Add(dir); } }
protected void MaybeUpdateFileList() { // TODO: investigate FormData.Homework can be empty if Folder is changed. This should // not happen. // Do not execute update if Homework is nothing. if (FormData.Homework.Trim() == "") { return; } if (FormData.Homework == loadingHomeworkList) { return; } if (FormData.Homework == selectFromDropDown) { return; } var allFiles = DirAndFileScanner.GetSubmittedAndWorkingFiles(FormData.Folder, FormData.Homework); List <string> files = allFiles.SubmittedFiles; if (FormData.ShowWorkingFiles || files.Count == 0) { files.AddRange(allFiles.WorkingFiles); } if (files.Count == 0) { return; } bool[] obsolete = new bool[files.Count]; bool isObsolete = false; for (int i = files.Count - 2; i >= 0; --i) { isObsolete = isObsolete ? IsPreviousOrSameVersion(files[i], files[i + 1]) : IsPreviousVersion(files[i], files[i + 1]); obsolete[i] = isObsolete; } FileList.Clear(); for (int i = 0; i < files.Count; ++i) { string path = System.IO.Path.Combine(FormData.Folder, files[i]); BitmapSource icon = IconUtil.GetIconForExtension(System.IO.Path.GetExtension(path)); FileList.Add(new FileListItem { FileName = files[i], FullPath = path, Icon = icon, Obsolete = obsolete[i] }); } }
protected async Task UpdateHomeworkList() { FormData.Homework = loadingHomeworkList; HomeworkComboBox.IsEnabled = false; var list = await Task.Factory.StartNew( () => DirAndFileScanner.GetHomeworkList(FormData.Folder)); HomeworkList.Clear(); foreach (var item in list) { HomeworkList.Add(new HomeworkListItem { Homework = item.Homework, Display = item.WorkingFilesOnly ? item.Homework + " (working files only)" : item.Homework, WorkingFilesOnly = item.WorkingFilesOnly }); } FormData.Homework = selectFromDropDown; HomeworkComboBox.IsEnabled = true; return; }