public ArtifactProjectViewModel(INavigation navigation, Project project, string version) { Items.Add(new ProjectInfoItemViewModel("Name", project.Name)); Items.Add(new ProjectInfoItemViewModel("Version", version)); Items.Add(new ProjectInfoItemViewModel("Type", project.Packaging)); Items.Add(new ProjectActionItemViewModel("Download " + project.Packaging, async() => { var svc = DependencyService.Get <IDownloadService>(); if (svc != null) { var filename = project.ArtifactId + "-" + version + "." + project.Packaging.TrimStart('.'); using (var stream = await MavenService.GetArtifactFileAsync(project.GroupId, project.ArtifactId, version, project.Packaging)) await svc.SaveStreamAsync(filename, stream); } })); Items.Add(new ProjectActionItemViewModel("Dependencies", () => { navigation.PushAsync(new ArtifactDependencyListPage(project)); })); Items.Add(new ProjectActionItemViewModel("Download .pom", async() => { var svc = DependencyService.Get <IDownloadService>(); if (svc != null) { var filename = project.ArtifactId + "-" + version + ".pom"; using (var stream = await MavenService.GetArtifactFileAsync(project.GroupId, project.ArtifactId, version, ".pom")) await svc.SaveStreamAsync(filename, stream); } })); }
public ArtifactProjectViewModel(INavigation navigation, Project project, string version) { Items.Add(new ProjectInfoItemViewModel("Name", project.Name)); Items.Add(new ProjectInfoItemViewModel("Version", version)); Items.Add(new ProjectInfoItemViewModel("Type", project.Packaging)); Items.Add(new ProjectActionItemViewModel("Copy Download Url", async() => { var url = MavenService.GetArtifactFileUrl(project.GroupId, project.ArtifactId, version, project.Packaging); await Clipboard.SetTextAsync(url); await navigation.NavigationStack[0].DisplayAlert("Url Copied", "The download url has been copied to the clipboard", "Ok"); })); Items.Add(new ProjectActionItemViewModel("Download " + project.Packaging, async() => { var svc = DependencyService.Get <IDownloadService>(); if (svc != null) { var filename = project.ArtifactId + "-" + version + "." + project.Packaging.TrimStart('.'); using (var stream = await MavenService.GetArtifactFileAsync(project.GroupId, project.ArtifactId, version, project.Packaging)) await svc.SaveStreamAsync(filename, stream); } })); Items.Add(new ProjectActionItemViewModel("Dependencies", () => { navigation.PushAsync(new ArtifactDependencyListPage(project)); })); Items.Add(new ProjectActionItemViewModel("Download .pom", async() => { var svc = DependencyService.Get <IDownloadService>(); if (svc != null) { var filename = project.ArtifactId + "-" + version + ".pom"; using (var stream = await MavenService.GetArtifactFileAsync(project.GroupId, project.ArtifactId, version, ".pom")) await svc.SaveStreamAsync(filename, stream); } })); Items.Add(new ProjectActionItemViewModel("View .pom", async() => { var filename = project.ArtifactId + "-" + version + ".pom"; using (var stream = await MavenService.GetArtifactFileAsync(project.GroupId, project.ArtifactId, version, ".pom")) using (var ms = new System.IO.MemoryStream()) { await stream.CopyToAsync(ms); var txt = System.Text.Encoding.Default.GetString(ms.ToArray()); await navigation.PushAsync(new MavenRepoBrowser.FileViewerPage(txt)); } })); }
public ArtifactListViewModel(string groupId) { var mavenGroup = MavenService.GetGroup(groupId); if (mavenGroup == null) { return; } foreach (var a in mavenGroup.Artifacts.OrderBy(a => a.GroupId + "." + a.Id)) { MavenArtifacts.Add(a); } }
public MavenServiceTests(BaseWebApplicationFactory <TestStartup> applicationFactory, ITestOutputHelper helper) { _helper = helper; _mavenService = applicationFactory.Services.GetService <MavenService>(); }
public void clearCache(NSObject sender) { MavenService.ClearCache(); }