public override void ReadyControl() { LayoutRoot.Children.Clear(); Slides.ForEach(x => { x.Opacity = 0; x.HorizontalAlignment = System.Windows.HorizontalAlignment.Center; x.VerticalAlignment = System.Windows.VerticalAlignment.Center; LayoutRoot.Children.Add(x); }); cbbSlideNumber.Items.Clear(); Enumerable.Range(1, Slides.Count).ToList().ForEach(x => cbbSlideNumber.Items.Add(string.Format("第 {0} 页", x))); }
public void Stop() { if (!IsRunning) { return; } foreach (PP.Presentation pres in GetPresentations()) { try { pres.SlideShowWindow().View.Exit(); } catch (InvalidCastException) { } catch (COMException) { } } Slides.ForEach(s => s.Presentation = null); Util.SlideShowWindows.Clear(); //needs to be called before calling running.close() otherwise when slideshowend event fires it will //call this code leading to an eternal loop IsRunning = false; }
public void Write() { if (File.Exists(Path)) { File.Delete(Path); } Console.WriteLine("Writing output..."); File.AppendAllText(Path, Slides.Count.ToString() + Environment.NewLine); Slides.ForEach(x => { var line = x.Photo1.ToString(); if (null != x.Photo2) { line += " " + x.Photo2.ToString(); } line += Environment.NewLine; File.AppendAllText(Path, line); }); Console.WriteLine("Done!"); }