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; }
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); } }
private void SetPlayPauseMode() { if (tour.EditMode) { if (playing) { if (player == null) { player = new TourPlayer(); } player.Tour = tour; Earth3d.MainWindow.UiController = player; player.Play(); Preview.Image = Resources.button_pause_normal; Preview.Text = Language.GetLocalizedText(440, "Pause"); tourStopList.ShowAddButton = false; } else { Earth3d.MainWindow.UiController = TourEditorUI; Preview.Image = Resources.button_play_normal; Preview.Text = Language.GetLocalizedText(441, "Play"); if (player != null) { player.Stop(false); player.Dispose(); } player = null; Earth3d.MainWindow.Mover = null; tourStopList.ShowAddButton = tour.EditMode; } } else { if (playing) { if (player == null) { player = new TourPlayer(); } player.Tour = tour; Earth3d.MainWindow.UiController = player; player.Play(); Preview.Image = Resources.button_pause_normal; Preview.Text = Language.GetLocalizedText(440, "Pause"); tourStopList.ShowAddButton = false; } else { Earth3d.MainWindow.UiController = null; Earth3d.MainWindow.FreezeView(); Preview.Image = Resources.button_play_normal; Preview.Text = Language.GetLocalizedText(441, "Play"); if (player != null) { player.Stop(false); player.Dispose(); } player = null; Earth3d.MainWindow.Mover = null; tourStopList.ShowAddButton = tour.EditMode; } } }