void pres_OnFinishedLoading(object sender, EventArgs args) { finishedLoading = true; recoverSelection = null; if (this.SlideListBox.SelectedIndex >= 0) { presentation.CurrentSlideIndex = this.SlideListBox.SelectedIndex; if (Controller.PresentationManager.CurrentPresentation != oldPresentation && oldPresentation != null) { oldPresentation.Close(); } Controller.PresentationManager.CurrentPresentation = presentation; oldPresentation = null; } }
void Refresh(bool firstTime) { if (!firstTime) { oldPresentation = presentation; oldPresentation.FinishedLoading -= pres_OnFinishedLoading; } finishedLoading = false; presentation = Controller.PresentationManager.CreatePresentation <SongPresentation>(); presentation.FinishedLoading += pres_OnFinishedLoading; presentation.Load(this.song.Song, !firstTime); if (!firstTime) { presentation.ShowChords = oldPresentation.ShowChords; if (this.SlideListBox.SelectedItem != null) { var con = (SongSlideListBox.SongSlideContainer) this.SlideListBox.SelectedItem; recoverSelection = new SongSlideSelection { PartName = con.PartName, SlideIndex = con.SlideIndex, PartIndex = con.PartIndex }; } } this.SlideListBox.Song = this.song.Song; if (!firstTime && recoverSelection != null) { this.SlideListBox.SelectedIndex = RecoverSelectedSlide(recoverSelection); } else { this.SlideListBox.Loaded += (sender, args) => this.SlideListBox.SelectedIndex = -1; } }
void Refresh(bool firstTime) { if (!firstTime) { oldPresentation = presentation; oldPresentation.FinishedLoading -= pres_OnFinishedLoading; } finishedLoading = false; presentation = Controller.PresentationManager.CreatePresentation<SongPresentation>(); presentation.FinishedLoading += pres_OnFinishedLoading; presentation.Load(this.song.Song, !firstTime); if (!firstTime) { presentation.ShowChords = oldPresentation.ShowChords; if (this.SlideListBox.SelectedItem != null) { var con = (SongSlideListBox.SongSlideContainer)this.SlideListBox.SelectedItem; recoverSelection = new SongSlideSelection { PartName = con.PartName, SlideIndex = con.SlideIndex, PartIndex = con.PartIndex }; } } this.SlideListBox.Song = this.song.Song; if (!firstTime && recoverSelection != null) { this.SlideListBox.SelectedIndex = RecoverSelectedSlide(recoverSelection); } else { this.SlideListBox.Loaded += (sender, args) => this.SlideListBox.SelectedIndex = -1; } }
void pres_OnFinishedLoading(object sender, EventArgs args) { finishedLoading = true; recoverSelection = null; if (this.SlideListBox.SelectedIndex >= 0) { presentation.CurrentSlideIndex = this.SlideListBox.SelectedIndex; if (Controller.PresentationManager.CurrentPresentation != oldPresentation && oldPresentation != null) oldPresentation.Close(); Controller.PresentationManager.CurrentPresentation = presentation; oldPresentation = null; } }