public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { RepositoryFileModel repositoryFileModel = value as RepositoryFileModel; if (repositoryFileModel == null) { return(null); } return(new Uri(repositoryFileModel.Path, UriKind.Absolute)); }
void UpdateUsedFiles(Dictionary <Repository, List <string> > usedFilesByRep, Dictionary <Repository, List <Team> > teams) { HashSet <string> usedFiles = RepositoryOptimizerViewModel.GetUsedFiles(usedFilesByRep, testsService); UsedFiles = GetActualFiles(usedFilesByRep.Keys.Select(rep => rep.Version).Distinct().ToList(), usedFiles, teams); if (UsedFiles.Count > 0) { CurrentFile = UsedFiles[0]; } Status = ProgramStatus.Idle; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { RepositoryFileModel repositoryFileModel = value as RepositoryFileModel; if (repositoryFileModel == null) { return(null); } if (!File.Exists(repositoryFileModel.Path)) { return(null); } return(File.ReadAllText(repositoryFileModel.Path)); }
public override DataTemplate SelectTemplate(object item, DependencyObject container) { RepositoryFileModel repositoryFileModel = item as RepositoryFileModel; if (item == null) { return(null); } switch (Path.GetExtension(repositoryFileModel.Path)) { case ".png": case ".jpg": case ".jpeg": return(ImageTemplate); case ".xml": default: return(TextTemplate); } }