/// <summary> /// Serializes the <see cref="BrightcovePlaylist"/>. Note that the <see cref="Videos"/> property is not serialized with the rest of the other properties as the <see cref="VideoIds"/> properties is instead used by Brightcove. /// </summary> /// <param name="serializer">The serializer.</param> /// <returns>A serialized <see cref="IDictionary{String,Object}" />.</returns> public IDictionary <string, object> Serialize(JavaScriptSerializer serializer) { IDictionary <string, object> serialized = new Dictionary <string, object>(); serialized["filterTags"] = FilterTags; serialized["name"] = Name; serialized["playlistType"] = PlaylistType.ToBrightcoveName(); serialized["referenceId"] = ReferenceId; serialized["shortDescription"] = ShortDescription; serialized["thumbnailURL"] = ThumbnailUrl; // The Id must be non-0. if (Id != 0) { serialized["id"] = Id; } // If TagInclusionRule is set to None, then we won't serialize the value back to Brightcove. // In this case, whatever the value of TagInclusionRule was before the call will remain the // same. In the event of a Create call, it will be set to Or. In the event of an Update, the // returned playlist will contain the actual value of the TagInclusionRule, though it is not // accessible via a GET request (i.e. FindAll, FindById, etc.). if (TagInclusionRule != TagInclusionRule.None) { serialized["tagInclusionRule"] = TagInclusionRule.ToBrightcoveName(); } // Smart playlists (i.e. anything but an Explicit playlist) should not have the VideoIds // populated, as 1) Brightcove determines which video Ids belong in a smart playlist, and // 2) serializing this property for a smart playlists results in an error. // // It is still the case that you cannot switch from a smart playlist to an explicit playlist, // and attempting to do so will result in an error. A workaround in this case is detailed @ // https://github.com/BrightcoveOS/.NET-MAPI-Wrapper/wiki/Known-Issues#wiki-convert-smart-playlist-to-explicit. if (PlaylistType == PlaylistType.Explicit && VideoIds != null && VideoIds.Any()) { serialized["videoIds"] = VideoIds; } return(serialized); }
public BackTrackViewModel() { AssignCommands(); Messenger.Default.Register <List <int> >(this, "DVM2BTVM", msg => { VideoIds = msg; }); //调试数据,使用请删除或注释 VideoIds.Add(46); VideoIds.Add(47); //调试数据,使用请删除或注释 InitCombobox(); DispatcherHelper.Initialize(); tokenSource = new CancellationTokenSource(); token = tokenSource.Token; }