protected override void ExecuteAction(string ribbonId) { //TODO: This needs to improved to stop using global variables Presentation currentPresentation = this.GetCurrentPresentation().Presentation; if (!this.GetRibbonUi().IsValidPresentation(currentPresentation)) { return; } // prepare media files string tempPath = this.GetAddIn().PrepareTempFolder(currentPresentation); this.GetAddIn().PrepareMediaFiles(currentPresentation, tempPath); this.GetAddIn().RegisterRecorderPane(currentPresentation.Windows[1], tempPath); CustomTaskPane recorderPane = this.GetAddIn().GetActivePane(typeof(RecorderTaskPane)); RecorderTaskPane recorder = recorderPane.Control as RecorderTaskPane; // if currently the pane is hidden, show the pane if (recorder != null && !recorderPane.Visible) { // fire the pane visble change event recorderPane.Visible = true; // reload the pane recorder.RecorderPaneReload(); } }
protected override void ExecuteAction(string ribbonId) { //TODO: This needs to improved to stop using global variables (Change RemoveAudioEnabledHandler too) this.StartNewUndoEntry(); NotesToAudio.RemoveAudioFromSelectedSlides(); CustomTaskPane recorderPane = this.GetAddIn().GetActivePane(typeof(RecorderTaskPane)); if (recorderPane != null) { RecorderTaskPane recorder = recorderPane.Control as RecorderTaskPane; recorder.ClearRecordDataListForSelectedSlides(); // if current list is visible, update the pane immediately if (recorderPane.Visible) { foreach (PowerPointSlide slide in this.GetCurrentPresentation().SelectedSlides) { recorder.UpdateLists(slide.ID); } } } NotesToAudio.IsRemoveAudioEnabled = false; this.GetRibbonUi().RefreshRibbonControl("RemoveNarrationsButton"); }
protected override void ExecuteAction(string ribbonId) { //TODO: This needs to improved to stop using global variables Presentation currentPresentation = this.GetCurrentPresentation().Presentation; if (!this.GetRibbonUi().IsValidPresentation(currentPresentation)) { return; } this.RegisterTaskPane(typeof(RecorderTaskPane), NarrationsLabText.RecManagementPanelTitle, TaskPaneVisibleValueChangedEventHandler, null); CustomTaskPane recorderPane = this.GetAddIn().GetActivePane(typeof(RecorderTaskPane)); RecorderTaskPane recorder = recorderPane.Control as RecorderTaskPane; // if currently the pane is hidden, show the pane if (recorder?.Visible ?? false) { // fire the pane visble change event recorderPane.Visible = true; // reload the pane recorder.RecorderPaneReload(); } }
private void TaskPaneVisibleValueChangedEventHandler(object sender, EventArgs e) { CustomTaskPane recorderPane = Globals.ThisAddIn.GetActivePane(typeof(RecorderTaskPane)); RecorderTaskPane recorder = recorderPane?.Control as RecorderTaskPane; // trigger close form event when closing hide the pane if (!recorder?.Visible ?? false) { recorder.RecorderPaneClosing(); // remove recorder pane and force it to reload when next time open Globals.ThisAddIn.RemoveRecorderTaskPane(); } }
protected override void ExecuteAction(string ribbonId) { //TODO: This needs to improved to stop using global variables this.StartNewUndoEntry(); PowerPointSlide currentSlide = this.GetCurrentSlide(); // If there are text in notes page for any of the selected slides if (this.GetCurrentPresentation().SelectedSlides.Any(slide => slide.NotesPageText.Trim() != "")) { NotesToAudio.IsRemoveAudioEnabled = true; this.GetRibbonUi().RefreshRibbonControl("RemoveNarrationsButton"); } List <string[]> allAudioFiles = NotesToAudio.EmbedSelectedSlideNotes(); CustomTaskPane recorderPane = this.GetAddIn().GetActivePane(typeof(RecorderTaskPane)); if (recorderPane == null) { return; } RecorderTaskPane recorder = recorderPane.Control as RecorderTaskPane; if (recorder == null) { return; } // initialize selected slides' audio recorder.InitializeAudioAndScript(this.GetCurrentPresentation().SelectedSlides.ToList(), allAudioFiles, true); // if current list is visible, update the pane immediately if (recorderPane.Visible) { recorder.UpdateLists(currentSlide.ID); } if (NarrationsLabSettings.IsPreviewEnabled) { NotesToAudio.PreviewAnimations(); } }
public InShowControl(RecorderTaskPane recorder) { InitializeComponent(); // set the background transparency BackColor = Color.Magenta; TransparencyKey = Color.Magenta; _slideShowWindow = PowerPointPresentation.Current.Presentation.SlideShowWindow; _startingSlide = PowerPointPresentation.Current.Presentation.SlideShowSettings.StartingSlide; _recorder = recorder; // get slide show window var slideShowWindow = new IntPtr(_slideShowWindow.HWND); Native.RECT rec; Native.GetWindowRect(new HandleRef(new object(), slideShowWindow), out rec); Location = new Point(rec.Right - Width, rec.Bottom - Height- 65); _status = ButtonStatus.Idle; // disable undo button by default, enable only when there has something to undo undoButton.Enabled = false; }
public InShowControl(RecorderTaskPane recorder) { InitializeComponent(); // set the background transparency BackColor = Color.Magenta; TransparencyKey = Color.Magenta; _slideShowWindow = PowerPointPresentation.Current.Presentation.SlideShowWindow; _startingSlide = PowerPointPresentation.Current.Presentation.SlideShowSettings.StartingSlide; _recorder = recorder; // get slide show window var slideShowWindow = new IntPtr(_slideShowWindow.HWND); Native.RECT rec; Native.GetWindowRect(new HandleRef(new object(), slideShowWindow), out rec); Location = new Point(rec.Right - Width, rec.Bottom - Height - 65); _status = ButtonStatus.Idle; // disable undo button by default, enable only when there has something to undo undoButton.Enabled = false; }
protected override void ExecuteAction(string ribbonId) { if (AudioSettingService.selectedVoiceType == VoiceType.AzureVoice && AzureAccount.GetInstance().IsEmpty()) { MessageBox.Show("Invalid user account. Please log in again."); return; } //TODO: This needs to improved to stop using global variables this.StartNewUndoEntry(); PowerPointSlide currentSlide = this.GetCurrentSlide(); // If there are text in notes page for any of the selected slides if (this.GetCurrentPresentation().SelectedSlides.Any(slide => slide.NotesPageText.Trim() != "")) { ComputerVoiceRuntimeService.IsRemoveAudioEnabled = true; this.GetRibbonUi().RefreshRibbonControl("RemoveNarrationsButton"); } try { ComputerVoiceRuntimeService.EmbedSelectedSlideNotes(); } catch { MessageBox.Show("Failed to generate audio files."); return; } CustomTaskPane recorderPane = this.GetAddIn().GetActivePane(typeof(RecorderTaskPane)); if (recorderPane == null) { return; } RecorderTaskPane recorder = recorderPane.Control as RecorderTaskPane; if (recorder == null) { return; } // initialize selected slides' audio List <string[]> allAudioFiles = ComputerVoiceRuntimeService.ExtractSlideNotes(); recorder.InitializeAudioAndScript(this.GetCurrentPresentation().SelectedSlides.ToList(), allAudioFiles, true); // if current list is visible, update the pane immediately if (recorderPane.Visible) { recorder.UpdateLists(currentSlide.ID); } if (AudioSettingService.IsPreviewEnabled) { ComputerVoiceRuntimeService.PreviewAnimations(); } }