Beispiel #1
0
        private async void Dialog_Click(object sender, RoutedEventArgs e)
        {
            if (null == mVideoFile)
            {
                var v = pickAndPlay(Dialog_Click, sender);
                return;
            }

            await WvvFrameSelectorDialog.Show(MediaSource.CreateFromStorageFile(mVideoFile), (FrameworkElement)sender, (dlg, position, stream) =>
            {
                using (stream)
                {
                    stream.Seek(0);
                    var image = new BitmapImage();
                    image.DecodePixelWidth  = 0;
                    image.DecodePixelHeight = 0;
                    image.SetSource(stream);
                    mFrameImage.Source = image;

                    //var decoder = await BitmapDecoder.CreateAsync(stream);
                    //var softwareBitmap = await decoder.GetSoftwareBitmapAsync();
                    //if (softwareBitmap.BitmapPixelFormat != BitmapPixelFormat.Bgra8 ||
                    //    softwareBitmap.BitmapAlphaMode == BitmapAlphaMode.Straight)
                    //{
                    //    softwareBitmap = SoftwareBitmap.Convert(softwareBitmap, BitmapPixelFormat.Bgra8, BitmapAlphaMode.Premultiplied);
                    //}
                    //var source = new SoftwareBitmapSource();
                    //await source.SetBitmapAsync(softwareBitmap);
                    //mFrameImage.Source = source;
                }
            });
        }
        /**
         * ダイアログを表示する。
         */
        public static async Task <bool> Show(MediaSource source, FrameworkElement anchor, WvvFrameSelectedHandler onSelected)
        {
            if (null == onSelected)
            {
                return(false);
            }

            var content = new WvvFrameSelectorDialog(source, onSelected);
            await WvvDialog.Show(content, anchor);

            return(true);
        }