public Presentation CreatePresentation(string clientId, string name) { if (string.IsNullOrEmpty(clientId)) return null; if (string.IsNullOrEmpty(name)) return null; if (presentations.Values.Any(p => p.Owner == clientId && p.Name == name)) return null; // create new presentation var presentation = new Presentation { Name = name, Owner = clientId, Id = Guid.NewGuid().ToString() }; presentations.Add(presentation.Id, presentation); return presentation; }
private void EditPresentation(Presentation pres) { CancelShowPresentation(); currentPresentation = pres; EditPresentationSlides.ItemsSource = null; if (NewPresentationGrid.Visibility == Visibility.Visible) { HideNewPresentationScreen(pres != null); } if (SelectPresentationView.Visibility == Visibility.Visible) { HideSelectPresentation(); } if (pres != null) { EditPresentationView.Visibility = Visibility.Visible; EditPresentationName.Content = pres.Name; if (dataContext.DroppedFileName != null) { ImportSlides(-1); } else { ShowSlides(); } } }
/// <summary> /// Start a Presentation /// </summary> private void ShowPresentation(Presentation pres) { CancelShowPresentation(); new PresentationWindow(dataContext) { DataContext = pres }.ShowDialog(); dataContext.StopPresentation(); }
/// <summary> /// Edit a Presentation, so fetch and display as a first Step /// </summary> public void ChangePresentation(SlidePreview presentationPreview) { new Thread(() => { if (EditPresentation != null) { var p = FetchPresentation(presentationPreview); if (p == null) return; currentPresentation = p; CommandManager.InvalidateRequerySuggested(); EditPresentation(this, currentPresentation); } else { if (CancelStartPresentation != null) CancelStartPresentation(this, null); } }).Start(); }
private void OnPresentationWindowSourceInitialized(object sender, EventArgs e) { dataContext = DataContext as Presentation; if (dataContext == null) return; if (dataContext.Slides == null) return; // get all slides as images from our model slides = new List<SlidePreview>(); foreach (var slide in dataContext.Slides) { slides.Add(SlidePreview.CreateFromSlide(slide, dataContext.Id)); } currentSlideIndex = 0; nextSlideIndex = -1; if (slides.Count == 0) return; SlideImageView.Source = slides[currentSlideIndex].SlideImage; }