public async void StartPresentation(string name) // Server side { this.Hide(); FormLoading formLoading = new FormLoading("Presentation is preparing for sharing. Please, wait..."); formLoading.Show(); PresentationController.StartApp(); await Task.Run(() => PresentationController.ExportImages(Helper.GetCurrentFolder())); formLoading.Close(); Connection.CurrentPresentation = new Presentation() { Name = name, CurrentSlide = 1, Author = Connection.CurrentUser.Username }; LoadConnectionTab(); PresentationController.StartSlideShow(checkBoxCheater.Checked); }
private async void button5_Click_1(object sender, EventArgs e) { if (!CheckLengthPresentationName()) { return; } if (!PresentationController.CheckApp()) { int ov = Helper.ShowOverlay(this); FormAlert formAlert = new FormAlert("PowerPoint error", "Make sure You have installed PowerPoint 2007 or newer", true); formAlert.ShowDialog(); Helper.HideOverlay(ov); return; } if ((Connection.CurrentRole == Role.Client && !Connection.clientConnection.ClRequestPresentationStart()) || (Connection.CurrentRole == Role.Host && Connection.ReservePresentation)) { int ov = Helper.ShowOverlay(this); FormAlert formAlert = new FormAlert("Error", "Someone in the group has already started presentation", true); formAlert.ShowDialog(); Helper.HideOverlay(ov); return; } string file = textBoxFile.Text; string name = textBoxPresentationName.Text; int overlay = Helper.ShowOverlay(); if (file.Length < 1) { (new FormAlert("No file", "Please, choose presentation file.", true)).ShowDialog(); } else { var formLoading = new FormLoading("Loading presentation. Please wait..."); try { if (Connection.CurrentRole == Role.Host) { Connection.ReservePresentation = true; } formLoading.Show(); await Task.Run(() => PresentationController.LoadPPT(file)); formLoading.Close(); StartPresentation(name); } catch (Exception ex) { if (formLoading != null) { formLoading.Close(); } Log.LogException(ex, "Can't load presentation"); (new FormAlert("Error", "Problem occured while opening the file", true)).ShowDialog(); if (Connection.CurrentRole == Role.Host) { Connection.ReservePresentation = false; } } } Helper.HideOverlay(overlay); }