private RssItem GetItemFor(AllFeed feed, PluginContainer SelectedPlugin) { string folder = FileManager.RemovePath( FileManager.GetDirectory(SelectedPlugin.AssemblyLocation)); folder = folder.Replace("/", ""); if (!folder.ToLowerInvariant().EndsWith("plugin")) { folder += "plugin"; } folder = folder.ToLower(); RssItem itemToReturn = null; string whatToLookFor = folder + ".plug"; // We're going to narrow things down a bit here: whatToLookFor = ">" + whatToLookFor + @"</a>"; foreach (var item in feed.Items) { var description = item.Description.ToLower(); if (description.Contains(whatToLookFor)) { itemToReturn = item; break; } } return(itemToReturn); }
private void FinishedDownloadingInformation(AllFeed feed, Plugins.DownloadState downloadState) { if (downloadState == Plugins.DownloadState.InformationDownloaded) { string timeDownloaded = feed.Items[0].PublishedDate; DateTime dateTime = System.DateTime.Parse(timeDownloaded); LastUpdate = dateTime; } this.DownloadState = downloadState; }
private void HandleFinishedDownloading(AllFeed allFeed, DownloadState state) { if (mainControl != null) { GlueCommands.Self.DoOnUiThread(() => { viewModel.UpdateFrom(allFeed); mainControl.AllFeed = allFeed; mainControl.DownloadState = state; }); } }
public void TryStartDownload(Action <DownloadState> finishedDownloading) { if (DownloadState == Plugins.DownloadState.NotStarted && !string.IsNullOrEmpty(RemoteLocation)) { DownloadState = Plugins.DownloadState.Downloading; AllFeed.StartDownloadingInformation(RemoteLocation + "/revisions/rss", (feed, state) => { FinishedDownloadingInformation(feed, state); finishedDownloading(state); } ); } }
public void UpdateFrom(AllFeed allFeed) { AvailablePlugins.Clear(); if (allFeed != null) { foreach (var item in allFeed.Items) { var viewModel = new FeedItemViewModel { Title = item.Title, RssItem = item }; AvailablePlugins.Add(viewModel); } } }
private void HandleManagePlugins(object sender, EventArgs e) { if (mainControl == null) { viewModel = new BrowseGlueVaultViewModel(); mainControl = new MainControl(); mainControl.GlueVaultBrowser.DataContext = viewModel; this.AddToTab(PluginManager.LeftTab, mainControl, "Plugins"); } else { this.AddTab(); } AllFeed.StartDownloadingInformation(mAllFeedUrl, HandleFinishedDownloading); }