private static void LoadConstellationArt(string filename) { if (ConstellationArt == null) { ConstellationArt = new List <IImageSet>(); } if (filename.ToLower() == "default.wtml" || !File.Exists(filename)) { filename = ArtworkPath + "default.wtml"; } ConstellationArt.Clear(); Folder art = Folder.LoadFromFile(filename, false); foreach (IPlace place in art.Items) { if (place.BackgroundImageSet != null && FullNames.ContainsKey(place.BackgroundImageSet.Name)) { ConstellationArt.Add(place.BackgroundImageSet); } if (place.StudyImageset != null && FullNames.ContainsKey(place.StudyImageset.Name)) { ConstellationArt.Add(place.StudyImageset); } } }
internal static void ImportArtFile() { OpenFileDialog openFile = new OpenFileDialog(); openFile.Filter = Language.GetLocalizedText(107, "WorldWide Telescope Collection") + "|*.wtml"; if (openFile.ShowDialog() == DialogResult.OK) { string filename = openFile.FileName; try { Folder newFolder = Folder.LoadFromFile(filename, false); newFolder.Type = FolderType.Sky; newFolder.Group = FolderGroup.Constellation; string path = ArtworkPath; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } filename = Guid.NewGuid().ToString() + ".wtml"; newFolder.SaveToFile(path + filename); Properties.Settings.Default.ConstellationArtFile = path + filename; } catch { MessageBox.Show(Language.GetLocalizedText(109, "This file does not seem to be a valid collection"), Language.GetLocalizedText(3, "Microsoft WorldWide Telescope")); } } }
private static void InitializeArt() { ConstellationArt = new List <IImageSet>(); // see if there are any files in the art directory if (String.IsNullOrEmpty(Properties.Settings.Default.ConstellationArtFile)) { foreach (string file in Directory.GetFiles(ArtworkPath, "*.wtml")) { try { Folder art = Folder.LoadFromFile(file, false); if (art.Group == FolderGroup.Constellation) { Properties.Settings.Default.ConstellationArtFile = file; break; } } catch { continue; } } } if (!(String.IsNullOrEmpty(Properties.Settings.Default.ConstellationArtFile))) { LoadConstellationArt(Properties.Settings.Default.ConstellationArtFile); } }
private void LoadTours() { Cursor.Current = Cursors.WaitCursor; resultsList.Clear(); resultsList.Refresh(); string filename = Properties.Settings.Default.CahceDirectory + @"data\tours.wtml"; DataSetManager.DownloadFile("http://www.worldwidetelescope.org/wwtweb/gettours.aspx", filename, false, false); Folder tours = Folder.LoadFromFile(filename); foreach (Tour result in tours.Tour) { resultsList.Add(result); } Cursor.Current = Cursors.Default; }