public static void SaveCGItems(CGItemCollection cgItems) { _cgItems = cgItems; var value = CGItemCollection.ToXml(cgItems); SaveSetting(null, null, null, "CGItems", value, null); }
internal void Preview(IPlayableItem playableItem) { if (_playableItem == playableItem) { return; } if (_player.Status != PreviewPlayerStatus.Closed) { if (_cgItems != null) { _player.Detach(_cgItems); _cgItems = null; } _player.Close(); } if (_playableItem != null) { _playableItem.PreviewClosing -= PlayableItem_PreviewClosing; } if (playableItem != null && !string.IsNullOrEmpty(playableItem.FilePath) && System.IO.File.Exists(playableItem.FilePath)) { _playableItem = playableItem; } else { _playableItem = null; } if (_playableItem != null) { _playableItem.PreviewClosing += PlayableItem_PreviewClosing; SetAudioGain(_playableItem.AudioGain, false); _player.Open(_playableItem); this.MaxPosition = _player.Duration; this.PlayRange = _playableItem.PlayRange; var withCG = _playableItem as IPlayableItemWithCG; if (withCG != null && withCG.CGItems != null && withCG.CGItems.Count > 0) { _cgItems = withCG.CGItems.Clone(); } if (_cgItems != null) { _player.Attach(_cgItems); } this.Play(); this.Pause(); } }
public static CGItemCollection GetCGItems() { if (_cgItems == null) { var info = GetSettings("CGItems", null).FirstOrDefault(); if (info != null && !string.IsNullOrEmpty(info.Value)) { _cgItems = CGItemCollection.FromXml(info.Value); } } if (_cgItems == null) { _cgItems = new CGItemCollection(); } return(_cgItems); }