コード例 #1
0
        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);
                }
            }));
        }
コード例 #2
0
        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));
                    }
            }));
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
 public MavenServiceTests(BaseWebApplicationFactory <TestStartup> applicationFactory, ITestOutputHelper helper)
 {
     _helper       = helper;
     _mavenService = applicationFactory.Services.GetService <MavenService>();
 }
コード例 #5
0
 public void clearCache(NSObject sender)
 {
     MavenService.ClearCache();
 }