private void xInstallButonn_Click(object sender, RoutedEventArgs e) { xInstallButton.ButtonText = "Downloading & Installing..."; xProcessingImage.Visibility = Visibility.Visible; OnlinePluginPackageRelease release = (OnlinePluginPackageRelease)xVersionComboBox.SelectedItem; OnlinePluginPackage onlinePluginPackage = (OnlinePluginPackage)xPluginsGrid.CurrentItem; if (!string.IsNullOrEmpty(onlinePluginPackage.CurrentPackage) && onlinePluginPackage.CurrentPackage != release.Version) { UninstallPlugin(); } Task.Factory.StartNew(() => { WorkSpace.Instance.PlugInsManager.InstallPluginPackage(onlinePluginPackage, release); onlinePluginPackage.Status = "Installed"; }).ContinueWith((a) => { Dispatcher.Invoke(() => { xProcessingImage.Visibility = Visibility.Collapsed; xInstallButton.ButtonText = "Install"; xInstalledVersion.Text = onlinePluginPackage.CurrentPackage; }); }); xInstalledSection.Visibility = Visibility.Visible; ((OnlinePluginPackage)xPluginsGrid.CurrentItem).CurrentPackage = release.Version; SetInstallButton(); }
private void UninstallPlugin() { OnlinePluginPackage pluginPackageInfo = (OnlinePluginPackage)xPluginsGrid.CurrentItem; WorkSpace.Instance.PlugInsManager.UninstallPluginPackage(pluginPackageInfo); pluginPackageInfo.Status = string.Empty; pluginPackageInfo.CurrentPackage = string.Empty; }
private void ShowPluginInfo() { xProcessingImage.Visibility = Visibility.Visible; OnlinePluginPackage pluginPackageInfo = (OnlinePluginPackage)xPluginsGrid.CurrentItem; if(!string.IsNullOrEmpty(pluginPackageInfo.CurrentPackage)) { xInstalledSection.Visibility = Visibility.Visible; xInstalledVersion.Text = pluginPackageInfo.CurrentPackage; } else { xInstalledSection.Visibility = Visibility.Collapsed; } xNameTextBlock.Text = pluginPackageInfo.Id; xHyperLinkBtn.Content = pluginPackageInfo.URL; ObservableList<OnlinePluginPackageRelease> list = null; Task.Factory.StartNew(() => { list = pluginPackageInfo.Releases; }).ContinueWith((a) => { Dispatcher.Invoke(() => { xVersionComboBox.ItemsSource = list; xVersionComboBox.DisplayMemberPath = nameof(OnlinePluginPackageRelease.Version); // select the first item/latest release xVersionComboBox.SelectedIndex = 0; xProcessingImage.Visibility = Visibility.Collapsed; }); }); }
public void InstalledPluginPackageFromOnline() { //Arrange // TODO: create a simple plugin for unit test which will download faster. string PluginId = "PACT"; string path = TestResources.GetTestTempFolder(@"Solutions\PluginsManagerSR1"); if (Directory.Exists(path)) { Directory.Delete(path, true); } SolutionRepository solutionRepository = GingerSolutionRepository.CreateGingerSolutionRepository(); solutionRepository.CreateRepository(path); solutionRepository.Open(path); PluginsManager pluginsManager = new PluginsManager(solutionRepository); ObservableList <PluginPackage> pluginPackages = solutionRepository.GetAllRepositoryItems <PluginPackage>(); // Act var p = pluginsManager.GetOnlinePluginsIndex(); OnlinePluginPackage onlinePluginPackage = (from x in p where x.Id == PluginId select x).SingleOrDefault(); //OnlinePluginPackageRelease onlinePluginPackageRelease pluginsManager.InstallPluginPackage(onlinePluginPackage, onlinePluginPackage.Releases[0]); //string folder = Path.Combine(Common.GetTestResourcesFolder(), @"PluginPackages\SeleniumPluginPackage.1.0.0"); //Assert Assert.AreEqual(1, pluginPackages.Count); Assert.AreEqual("PACT", pluginPackages[0].PluginId); }
/// <summary> /// Installs the latest online version of package <paramref name="onlinePackage" />. /// Package's version and metadata will be derived from /// <paramref name="onlinePackage.LatestOnlineVersion" /> and /// <paramref name="onlinePackage.Metadata" />. Package's data, and metadata will be saved to /// the package json configuration file. /// </summary> /// <param name="onlinePackage">The online package to install</param> /// <param name="framework">Which .NET framework should the package be compatible with</param> /// <param name="cancellationToken"></param> /// <returns>Success of operation</returns> /// <exception cref="ArgumentException"><paramref name="onlinePackage" /> is already installed</exception> public Task <bool> InstallAsync( OnlinePluginPackage <TMeta> onlinePackage, NuGetFramework framework = null, CancellationToken cancellationToken = default) { return(InstallAsync( onlinePackage, onlinePackage?.LatestOnlineVersion, framework, cancellationToken)); }
public void GetOnlinePluginReleases() { //Arrange PluginsManager pluginsManager = new PluginsManager(WorkSpace.Instance.SolutionRepository); ObservableList <OnlinePluginPackage> list = pluginsManager.GetOnlinePluginsIndex(); OnlinePluginPackage PACT = (from x in list where x.Id == "PACT" select x).SingleOrDefault(); // Act ObservableList <OnlinePluginPackageRelease> releases = PACT.Releases; //Assert Assert.IsTrue(releases.Count > 0, "list.Count > 0"); }
private void SetInstallButton() { OnlinePluginPackageRelease release = (OnlinePluginPackageRelease)xVersionComboBox.SelectedItem; OnlinePluginPackage pluginPackageInfo = (OnlinePluginPackage)xPluginsGrid.CurrentItem; if (release!=null && pluginPackageInfo.CurrentPackage == release.Version) { xInstallButton.IsEnabled = false; } else { xInstallButton.IsEnabled = true; } }
public void InstallSeleniumPlugin_1_0() { //Arrange PluginsManager pluginsManager = new PluginsManager(WorkSpace.Instance.SolutionRepository); ObservableList <OnlinePluginPackage> list = pluginsManager.GetOnlinePluginsIndex(); OnlinePluginPackage plugin = (from x in list where x.Id == "SeleniumDriver" select x).SingleOrDefault(); OnlinePluginPackageRelease release1_1 = (from x in plugin.Releases where x.Version == "1.0" select x).SingleOrDefault(); // Act string folder = pluginsManager.InstallPluginPackage(plugin, release1_1); //Assert Assert.IsTrue(Directory.Exists(folder)); }
/// <summary> /// Installs the latest online version of package <paramref name="onlinePackage" />. /// Package's version and metadata will be derived from /// <paramref name="onlinePackage.LatestOnlineVersion" /> and /// <paramref name="onlinePackage.Metadata" />. Package's data, and metadata will be saved to /// the package json configuration file. /// </summary> /// <param name="onlinePackage">The online package to install</param> /// <param name="cancellationToken"></param> /// <returns>Success of operation</returns> /// <exception cref="ArgumentException"><paramref name="onlinePackage" /> is already installed</exception> /// <exception cref="InvalidOperationException"> /// NuGet returned a successful result but the plugin /// cannot be found /// </exception> public async Task <bool> InstallPluginAsync( OnlinePluginPackage <TMeta> onlinePackage, CancellationToken cancellationToken = default) { using (await PMLock.WriterLockAsync()) { var success = await PackageManager.InstallAsync( onlinePackage, null, cancellationToken); return(success && PostInstallPlugin(onlinePackage.Id)); } }
private void xInstallButonn_Click(object sender, RoutedEventArgs e) { xProcessingImage.Visibility = Visibility.Visible; OnlinePluginPackageRelease release = (OnlinePluginPackageRelease)xVersionComboBox.SelectedItem; Task.Factory.StartNew(() => { OnlinePluginPackage onlinePluginPackage = (OnlinePluginPackage)xPluginsGrid.CurrentItem; WorkSpace.Instance.PlugInsManager.InstallPluginPackage(onlinePluginPackage, release); onlinePluginPackage.Status = "Installed"; }).ContinueWith((a) => { Dispatcher.Invoke(() => { xProcessingImage.Visibility = Visibility.Collapsed; }); }); }
/// <summary> /// Installs package <paramref name="onlinePackage" /> version /// <paramref name="onlineVersion" />. Package data, and /// <paramref name="onlinePackage.Metadata" /> will be saved to the package json configuration /// file. /// </summary> /// <param name="onlinePackage">The online package to install</param> /// <param name="onlineVersion">The version of the package to install</param> /// <param name="framework">Which .NET framework should the package be compatible with</param> /// <param name="cancellationToken"></param> /// <returns>Success of operation</returns> /// <exception cref="ArgumentException"><paramref name="onlinePackage" /> is already installed</exception> public Task <bool> InstallAsync( OnlinePluginPackage <TMeta> onlinePackage, NuGetVersion onlineVersion = null, NuGetFramework framework = null, CancellationToken cancellationToken = default) { if (onlinePackage == null) { throw new ArgumentNullException(nameof(onlinePackage)); } return(InstallAsync( onlinePackage.Id, onlinePackage.Metadata, new VersionRange(onlineVersion, true, onlineVersion, true), true, framework, cancellationToken)); }