private void LoadToursViaWebService() { Cursor.Current = Cursors.WaitCursor; WWTWebService webService = new WWTWebService(); TerraViewer.org.worldwidetelescope.www.Tour[] results = webService.GetToursForDateRange("", ""); foreach (TerraViewer.org.worldwidetelescope.www.Tour resultRow in results) { Tour result = new Tour(); result.Id = resultRow.TourGuid.ToString(); result.Title = resultRow.TourTitle; result.Description = resultRow.TourDescription; result.Author = resultRow.AuthorName; result.AuthorUrl = resultRow.AuthorURL; //result.AuthorImageUrl = row["Title"].ToString(); result.OrganizationUrl = resultRow.OrganizationURL; result.OrgName = resultRow.OrganizationName; // Load tour thumbnail string filename = result.Id + "_tourThumb.jpg"; //move tour url //todo change tours when web service moves! string url = String.Format("http://www.worldwidetelescope.org/wwtweb/GetTourThumbnail.aspx?GUID={0}", result.Id); result.ThumbNail = UiTools.LoadThumbnailFromWeb(url, filename); filename = result.Id + "_AuthorThumb.jpg"; url = String.Format("http://www.worldwidetelescope.org/wwtweb/GetAuthorThumbnail.aspx?GUID={0}", result.Id); result.AuthorImage = UiTools.LoadThumbnailFromWeb(url, filename); resultsList.Add(result); } Cursor.Current = Cursors.Default; }
private void LoadTopLevel() { BrowseList.Clear(); exploreText.Text = "Collections"; topLevel = true; if (!Directory.Exists(Properties.Settings.Default.CahceDirectory + @"thumbnails\")) { Directory.CreateDirectory(Properties.Settings.Default.CahceDirectory + @"thumbnails\"); } AddCollectionFolders(); ArrayList dataSets = DataSetManager.GetDataSets(); foreach (DataSet d in dataSets) { // Todo Change this to exploere earth, moon etc. if (d.Sky == true) { if (d != null) { ArrayList placesList = d.GetPlaces(); foreach (Places places in placesList) { if (places != null && places.Browseable) { ThumbMenuNode node = new ThumbMenuNode(); node.Name = places.Name; node.Places = places; //string filename = places.ThumbnailUrl.Substring(places.ThumbnailUrl.LastIndexOf("/") + 1); //DataSetManager.DownloadFile(places.ThumbnailUrl, Properties.Settings.Default.CahceDirectory + @"thumbnails\" + filename, true); //node.ThumbNail = UiTools.LoadBitmap(Properties.Settings.Default.CahceDirectory + @"thumbnails\" + filename); node.ThumbNail = UiTools.LoadThumbnailFromWeb(places.ThumbnailUrl); BrowseList.Add(node); } } } } } Refresh(); }
private void UpdateTargetInfo() { if (target != null) { this.constellationName.Text = Language.GetLocalizedText(280, "in ") + Constellations.FullName(target.Constellation); if (target.Magnitude != 0) { this.magnitudeValue.Text = target.Magnitude.ToString(); } else { this.magnitudeValue.Text = Language.GetLocalizedText(281, "n/a"); } this.thumbnail.Image = target.ThumbNail; this.classificationText.Text = FriendlyName(target.Classification.ToString()); if (target.Classification == Classification.Unidentified && target.StudyImageset != null) { if (target.StudyImageset.Projection == ProjectionType.Toast || target.StudyImageset.Projection == ProjectionType.Equirectangular || target.StudyImageset.Projection == ProjectionType.Mercator) { this.thumbnail.Image = UiTools.LoadThumbnailFromWeb(target.StudyImageset.ThumbnailUrl); switch (target.StudyImageset.DataSetType) { case ImageSetType.Earth: this.classificationText.Text = Language.GetLocalizedText(282, "Survey Imagery"); this.constellationName.Text = Language.GetLocalizedText(283, "of Earth"); break; case ImageSetType.Planet: this.classificationText.Text = Language.GetLocalizedText(282, "Survey Imagery"); this.constellationName.Text = Language.GetLocalizedText(284, "of Planet/Moon"); break; case ImageSetType.Sky: this.classificationText.Text = Language.GetLocalizedText(282, "Survey Imagery"); this.constellationName.Text = Language.GetLocalizedText(285, "for Full Sky"); break; case ImageSetType.Panorama: this.classificationText.Text = Language.GetLocalizedText(286, "Panorama"); this.constellationName.Text = ""; break; default: break; } this.raLabel.Visible = false; this.raText.Visible = false; this.decText.Visible = false; this.decLabel.Visible = false; this.distanceLabel.Visible = false; this.altText.Visible = false; this.azText.Visible = false; this.magnitudeLabel.Visible = false; this.magnitudeValue.Visible = false; this.distanceValue.Visible = false; this.altLabel.Visible = false; this.azLabel.Visible = false; this.riseText.Visible = false; this.riseLabel.Visible = false; this.setLabel.Visible = false; this.setText.Visible = false; this.transitLabel.Visible = false; this.transitText.Visible = false; this.creditsText.Top = altText.Top + 4; this.creditsText.Height = 106; this.creditsLink.Top = decText.Top + 2; this.imageCreditsText.Top = raText.Top; this.research.Visible = false; this.ShowObject.Visible = false; } else { this.classificationText.Text = Language.GetLocalizedText(287, "Study Imagery"); } } if (Earth3d.TouchKiosk) { research.Visible = false; } if (target.StudyImageset != null) { ShowImageCredits(target.StudyImageset); } else if (target.BackgroundImageSet != null) { ShowImageCredits(target.BackgroundImageSet); } else { ShowImageCredits(Earth3d.MainWindow.CurrentImageSet); } bool first = true; nameValues.Text = ""; foreach (string name in target.Names) { if (!first) { nameValues.Text += "; "; } first = false; nameValues.Text += name; } nameValues.Select(); UpdateLiveValues(); } }
public ArrayList GetPlaceList() { if (dataList == null || CheckExpiration()) { dataList = new System.Collections.ArrayList(); if (dataSetType == DataSetType.Place) { DataSetManager.DownloadFile(url, Properties.Settings.Default.CahceDirectory + @"data\places\" + name + ".txt", false, true); TourPlace place; StreamReader sr = new StreamReader(Properties.Settings.Default.CahceDirectory + @"data\places\" + name + ".txt"); string line; while (sr.Peek() >= 0) { line = sr.ReadLine(); place = new TourPlace(line, sky); dataList.Add(place); } sr.Close(); } else if (dataSetType == DataSetType.Imageset) { string filename = Properties.Settings.Default.CahceDirectory + @"data\places\" + name + ".xml"; DataSetManager.DownloadFile(url, filename, false, true); XmlDocument doc = new XmlDocument(); doc.Load(filename); if (!Directory.Exists(Properties.Settings.Default.CahceDirectory + @"thumbnails\")) { Directory.CreateDirectory(Properties.Settings.Default.CahceDirectory + @"thumbnails\"); } XmlNode imageSets = doc["ImageSets"]; if (imageSets == null) { imageSets = doc["Folder"]; } foreach (XmlNode imageset in imageSets.ChildNodes) { ImageSetHelper newImageset = ImageSetHelper.FromXMLNode(imageset); if (newImageset != null) { TourPlace newPlace = new TourPlace(newImageset.Name, (newImageset.CenterY), (newImageset.CenterX) / 15, Classification.Unidentified, "Err", ImageSetType.Sky, newImageset.BaseTileDegrees * 10); newPlace.StudyImageset = newImageset; newPlace.ThumbNail = UiTools.LoadThumbnailFromWeb(newImageset.ThumbnailUrl); dataList.Add(newPlace); if (!String.IsNullOrEmpty(newImageset.AltUrl) && !Earth3d.ReplacementImageSets.ContainsKey(newImageset.AltUrl)) { Earth3d.ReplacementImageSets.Add(newImageset.AltUrl, newImageset); } } } } } return(dataList); }