Пример #1
0
        /// <summary>
        /// Loads the media bin assets asynchronously.
        /// </summary>
        /// <param name="containerUri">The container URI.</param>
        public void LoadMediaBinAssetsAsync(Uri containerUri)
        {
            DataServiceClient client = this.CreateDataServiceClient();

            client.LoadMediaBinCompleted += (sender, args) =>
            {
                if (args.Error != null)
                {
                    client.Abort();
                    this.logger.Log(this.GetType().Name, args.Error);

                    if (args.Error.GetType() == typeof(Exception))
                    {
                        throw args.Error;
                    }

                    return;
                }

                try
                {
                    MediaBin mediaBin = DataServiceTranslator.ConvertToMediaBin(args.Result);
                    this.OnLoadMediaBinAssetsCompleted(new DataEventArgs <MediaBin>(mediaBin));
                }
                catch (Exception e)
                {
                    client.Abort();
                    this.logger.Log(this.GetType().Name, e);
                    throw;
                }
            };

            client.LoadMediaBinAsync(containerUri);
        }
Пример #2
0
        public void ShouldConvertToMediaBin()
        {
            var serviceContainer = TranslatorHelper.CreateServiceMediaBin();

            var container = DataServiceTranslator.ConvertToMediaBin(serviceContainer);

            TranslatorHelper.AssertContainer(serviceContainer, container);
        }