static void client_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e) { if (e.Error == null) { try { Byte[] data = e.Result; string filename = Properties.Settings.Default.CahceDirectory + "\\servertour.wtt"; File.WriteAllBytes(filename, data); TourPlayer oldPlayer = Earth3d.MainWindow.UiController as TourPlayer; if (oldPlayer != null) { LayerManager.CloseAllTourLoadedLayers(); oldPlayer.Tour.CleanUp(); oldPlayer.Tour.ClearTempFiles(); } TourDocument tour = TourDocument.FromFile(filename, false); tour.ProjectorServer = true; TourPlayer player = new TourPlayer(); player.Tour = tour; player.ProjectorServer = true; player.Play(); Earth3d.MainWindow.UiController = player; ReportStatus(ClientNodeStatus.Online, "Tour Loaded", ""); } catch { ReportStatus(ClientNodeStatus.Online, "Tour Threw Exception", "Tour Load Failed :" + e.Error.Message); } } else { ReportStatus(ClientNodeStatus.Online, "Tour Failed", "Tour Load Failed :" + e.Error.Message); } }
public static void SyncTourUiThread() { WebClient client = new WebClient(); // Synce Layers try { if (Earth3d.Logging) { Earth3d.WriteLogMessage("SyncTourUIThread"); } ReportStatus(ClientNodeStatus.Working, "Loading Tour", ""); string url = string.Format("http://{0}:5050/Configuration/images/tour.wtt", NetControl.MasterAddress); try { string filename = Properties.Settings.Default.CahceDirectory + "\\servertour.wtt"; client.DownloadFile(new Uri(url), filename); TourPlayer oldPlayer = Earth3d.MainWindow.UiController as TourPlayer; if (oldPlayer != null) { LayerManager.CloseAllTourLoadedLayers(); oldPlayer.Tour.CleanUp(); oldPlayer.Tour.ClearTempFiles(); } TourDocument tour = TourDocument.FromFile(filename, false); tour.ProjectorServer = true; TourPlayer player = new TourPlayer(); player.Tour = tour; player.ProjectorServer = true; player.Play(); Earth3d.MainWindow.UiController = player; ReportStatus(ClientNodeStatus.Online, "Tour Loaded", ""); } catch { ReportStatus(ClientNodeStatus.Online, "Tour Threw Exception", "Tour Load Failed :" ); } } catch { ReportStatus(ClientNodeStatus.Online, "Layers Loaded", "Layer Load Failed:"); } Earth3d.MainWindow.SyncTourNeeded = false; }