/* * Constructor. */ public SessionController(MyRibbon myRibbon, PPt.Application pptApplication) { MyRibbon = myRibbon; initCustomSlides(); updateThread = new Timers.Timer(); observeTimeSpentOnSlideThread = new Timers.Timer(); EvaluationSlides = new Dictionary <Slide, Evaluation>(); this.pptApplication = pptApplication; pptApplication.SlideShowNextSlide -= slideShowNextSlide; pptApplication.SlideShowNextSlide += new EApplication_SlideShowNextSlideEventHandler(slideShowNextSlide); }
/* * Is called when a presentation is opened. */ private void afterPresentationOpened(Presentation pre) { myRibbon = Globals.Ribbons.Ribbon; // a presentation is already opened. if (presentation != null) { DialogResult dialogResult = MessageBox.Show("Can not open a second presentation window with activated LARS Plugin.\nIt could cause unwanted side effects.", "Can not open a second presentation", MessageBoxButtons.OK); if (dialogResult == DialogResult.OK) { pre.Close(); return; } } if (pptApplication != null) { // Get Presentation Object try { presentation = pptApplication.ActivePresentation; } catch { return; } // load custom slides from saved instance var savedJsonCustomSlides = GetJsonContentFromRootElement("customSlides"); if (savedJsonCustomSlides != null) { var customSlides = JsonConvert.DeserializeObject <List <CustomSlide> >(savedJsonCustomSlides); if (JsonConvert.DeserializeObject <List <CustomSlide> >(savedJsonCustomSlides) != null) { myRibbon.pptNavigator.customSlides = customSlides; } } // load lecture from saved instance var savedJsonLecture = GetJsonContentFromRootElement("LectureForThisPresentation"); if (savedJsonLecture != null) { var savedLecture = JsonConvert.DeserializeObject <Lecture>(savedJsonLecture); if (JsonConvert.DeserializeObject <Lecture>(savedJsonLecture) != null) { myRibbon.LectureForThisPresentation = savedLecture; myRibbon.select_lecture_group.Label = "Lecture: " + myRibbon.LectureForThisPresentation.Name; } } var name = presentation.FullName; // Get Slide collection object slides = presentation.Slides; foreach (Slide sld in slides) { listOfSlideIds.Add(sld.SlideID); } // Get Slide count slidescount = slides.Count; // Get current selected slide try { // Get selected slide object in normal view slide = slides[pptApplication.ActiveWindow.Selection.SlideRange.SlideNumber]; } catch { // set first slide as selected slide if (slides.Count > 0) { slide = slides[1]; } } } }
private void Button_Click(object sender, RoutedEventArgs e) { MyRibbon.HideBackStage(); }