Exemplo n.º 1
0
        private void OperationImageTap(VideoViewModel template) 
        {
#if DEBUG
            long memory = DeviceStatus.ApplicationCurrentMemoryUsage / (1024 * 1024);
            long memoryLimit = DeviceStatus.ApplicationMemoryUsageLimit / (1024 * 1024);
            long memoryMax = DeviceStatus.ApplicationPeakMemoryUsage / (1024 * 1024);
            System.Diagnostics.Debug.WriteLine("当前内存使用情况:" + memory.ToString() + " MB 当前最大内存使用情况: " + memoryMax.ToString() + "MB  当前可分配最大内存: " + memoryLimit.ToString() + "  MB");
#endif
            
            switch (template.jumpType)
            {
                case "videoPlayer":
                    App.PlayerModel.VideoId = template.videoId;
                    App.PlayerModel.currentType = ViewModels.PlayerViewModel.PlayType.VideoType;
                    CallbackManager.currentPage.NavigationService.Navigate(new Uri(CommonData.PlayerPageName, UriKind.Relative)); 
                    break;
                case "subjectPage":
                    MoreSubject.subjectId = template.subjectId;
                    MoreSubject.speicalName = template.name;
                    MoreSubject.isMoreChannel = false;
                    CallbackManager.currentPage.NavigationService.Navigate(new Uri(CommonData.SpecialPageName, UriKind.Relative));
                    break;
                case "videoLibrary":
                    if (channel != null)
                    {
                        MoreChannelInfo.typeId = channel.libId;
                        MoreChannelInfo.name = channel.channelName;
                        CallbackManager.currentPage.NavigationService.Navigate(new Uri(CommonData.MoreChannelPageName, UriKind.Relative));
                    }
                    break;
                case "webView":
                    WebBrowserTask task = new WebBrowserTask();
                    task.Uri = new Uri(template.webUrl, UriKind.Absolute);
                    try
                    {
                        task.Show();
                    }
                    catch (Exception e)
                    {

                    }
                    break;
                case "livePlayer":
                    //LivePlayer.liveUrl = template.playUrl;
                    //CallbackManager.currentPage.NavigationService.Navigate(new Uri(CommonData.LivePlayerPage, UriKind.Relative));
                   // break;
                case "concertLivePlayer":
                    App.ShowToast("抱歉,暂时不支持直播功能");
                    break;
                default:
                    System.Diagnostics.Debug.WriteLine("该播放类型暂时未实现"+template.jumpType);
                    App.ShowToast("该播放类型暂时未实现" + template.jumpType );
                    break;
            }
        }
Exemplo n.º 2
0
        private void LoadChannelCompleted(IAsyncResult ar)
        {
            string result = HttpHelper.SyncResultTostring(ar);
            if (result != null)
            {
                MoreChannelResult channelDetails = null;
                try
                {
                    channelDetails = JsonConvert.DeserializeObject<MoreChannelResult>(result);
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("LoadChannelCompleted   json 解析错误" + ex.Message);
                    App.HideLoading();
                }
                if (channelDetails != null && channelDetails.err_code == HttpHelper.rightCode)
                {
                    this.Dispatcher.BeginInvoke(() =>
                    {
                        App.HideLoading();
                        //loadGrid.Visibility = Visibility.Collapsed;
                        ////if (pageCount > 0) 
                        ////{
                        ////    stackPanel.Children.Remove(addTipGrid);
                        ////}
                        //AddChannelView(channelDetails.data, 200, 2);
                        List<VideoViewModel> TemplateListData = new List<VideoViewModel>();

                        for (int i = 0; i < channelDetails.data.Count; i = i + 2)
                        {
                            if (channelDetails.data.Count > i + 1)
                            {
                                MoreChannel template1 = channelDetails.data[i];
                                MoreChannel template2 = channelDetails.data[i + 1];
                                VideoViewModel videoData = new VideoViewModel
                                {
                                    //stupid func
                                    name = template1.name,
                                    tag = template1.tag,
                                    desc = template1.desc,
                                    picUrl = template1.image,
                                    videoId = template1.videoId,
                                    name1 = template2.name,
                                    tag1 = template2.tag,
                                    desc1 = template2.desc,
                                    videoId1 = template2.videoId,
                                    picUrl1 = template2.image,
                                };
                                TemplateListData.Add(videoData);
                            }
                            else
                            {
                                MoreChannel template1 = channelDetails.data[i];
                                VideoViewModel videoData = new VideoViewModel
                                {
                                    name = template1.name,
                                    tag = template1.tag,
                                    desc = template1.desc,
                                    videoId = template1.videoId,
                                };
                                TemplateListData.Add(videoData);
                            }
                        }
                        moreChannelInfo.ItemsSource = TemplateListData;
                        pageCount++;
                    });
                }
            }
            else
            {
                //App.ShowToast("获取数据失败,请检查网络或重试");
                App.HideLoading();
                this.Dispatcher.BeginInvoke(() =>
                {
                    reLoadGrid.Visibility = Visibility.Visible;
                });
            }
        }
Exemplo n.º 3
0
        private void CreateBanner(List<ChannelTemplate> list)
        {
            //timer = new DispatcherTimer();
            //timer.Interval = new TimeSpan(1000);
            totalScrollImages = list.Count;


            double imageWidth = PopupManager.screenWidth - 20;
            double imageHieght = 200;
            Grid imagesGrid = new Grid();
            imagesGrid.Margin = new Thickness(0,0,0,10);
            imagesGrid.Width = imageWidth;
            imagesGrid.Height = imageHieght;
          
            imageScroll = new ScrollViewer();
            imageScroll.Height = imageHieght;
            imageScroll.Width = imageWidth;
            imageScroll.HorizontalScrollBarVisibility = ScrollBarVisibility.Hidden;
            imageScroll.VerticalScrollBarVisibility = ScrollBarVisibility.Hidden;
            //imageScroll.ManipulationStarted += new EventHandler<System.Windows.Input.ManipulationStartedEventArgs>(ImageScroll_StartMove);
            //imageScroll.ManipulationCompleted += new EventHandler<System.Windows.Input.ManipulationCompletedEventArgs>(ImageScroll_EndMove);
            //imageScroll.ManipulationDelta += new EventHandler<System.Windows.Input.ManipulationDeltaEventArgs>(ImageScroll_EndDelta);
            //imageScroll.SizeChanged += new SizeChangedEventHandler();
            //imageScroll.MouseEnter += new System.Windows.Input.MouseEventHandler(ImageScroll_StartMove);
            //imageScroll.MouseMove += new System.Windows.Input.MouseEventHandler(ImageScroll_Moveing);
            //imageScroll.MouseLeave += new System.Windows.Input.MouseEventHandler(ImageScroll_EndMove);
            StackPanel imagesPanel = new StackPanel();
            imagesPanel.Orientation = Orientation.Horizontal;
            imageScroll.Content = imagesPanel;
            imagesPanel.Height = imageHieght;

            imagesGrid.Children.Add(imageScroll);
           
            foreach (ChannelTemplate template in list) 
            {
                VideoViewModel videoData = new VideoViewModel
                {
                    name = template.name,
                    jumpType = template.jumpType,
                    subjectId = template.subjectId,
                    picUrl = template.picUrl,
                    playUrl = template.playUrl,
                    tag = template.tag,
                    desc = template.desc,
                    videoId = template.videoId,
                    hotDegree = template.hotDegree,
                    webUrl = template.webUrl,
                    rank = template.rank
                };
                Grid imageGrid = new Grid();
                imageGrid.Width = imageWidth;
                imageGrid.Height = imageHieght;
                Image image = new Image();
                image.Width = imageWidth;
                image.Height = imageHieght;
                image.Source = new BitmapImage(new Uri(videoData.picUrl, UriKind.RelativeOrAbsolute));
                image.Stretch = Stretch.UniformToFill;
              
                imageGrid.Children.Add(image);
                Border textCanvas = new Border();
                textCanvas.Height = 40;
                textCanvas.Background = new SolidColorBrush(Color.FromArgb(255, 106, 98, 33));
                textCanvas.VerticalAlignment = VerticalAlignment.Bottom;
                textCanvas.HorizontalAlignment = HorizontalAlignment.Left;
                TextBlock textNmae = new TextBlock();
                textNmae.FontSize = 20;
                textNmae.TextWrapping = TextWrapping.Wrap;
                textNmae.Text = videoData.name;
                textNmae.HorizontalAlignment = HorizontalAlignment.Left;
                textNmae.VerticalAlignment = VerticalAlignment.Center;
                textCanvas.Child = textNmae;
                imageGrid.Children.Add(textCanvas);
                imagesPanel.Children.Add(imageGrid);

                imageGrid.DataContext = videoData;
                imageGrid.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(GridImage_Tap);
            }
            stackPanel.Children.Add(imagesGrid);
            //timer.Tick += new EventHandler(Timer_Tick);
            //timer.Start();
        }
Exemplo n.º 4
0
 private Grid CreateRankImageView(double width, ChannelTemplate template, double height) 
 {
     VideoViewModel videoData = new VideoViewModel
     {
         //width = (int)width,
         //hight = (int)height,
         name = template.name,
         jumpType = template.jumpType,
         subjectId = template.subjectId,
         picUrl = template.picUrl,
         playUrl = template.playUrl,
         tag = template.tag,
         desc = template.desc,
         videoId = template.videoId,
         hotDegree = template.hotDegree,
         webUrl = template.webUrl,
         rank = template.rank
     };
     if (string.IsNullOrEmpty(rankXaml))
     {
         using (Stream stream = Application.GetResourceStream(new Uri("/MangGuoTv;component/Views/RankImageView.xaml", UriKind.Relative)).Stream)
         {
             using (StreamReader reader = new StreamReader(stream))
             {
                 rankXaml = reader.ReadToEnd();
             }
         }
     }
     Grid imageGrid = (Grid)XamlReader.Load(rankXaml);
     imageGrid.Width = width;
     imageGrid.Height = height;
     imageGrid.DataContext = videoData;
     imageGrid.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(GridImage_Tap);
     return imageGrid;
 }
Exemplo n.º 5
0
        private void OperationImageTap(VideoViewModel template) 
        {
#if DEBUG
            long memory = DeviceStatus.ApplicationCurrentMemoryUsage / (1024 * 1024);
            long memoryLimit = DeviceStatus.ApplicationMemoryUsageLimit / (1024 * 1024);
            long memoryMax = DeviceStatus.ApplicationPeakMemoryUsage / (1024 * 1024);
            System.Diagnostics.Debug.WriteLine("当前内存使用情况:" + memory.ToString() + " MB 当前最大内存使用情况: " + memoryMax.ToString() + "MB  当前可分配最大内存: " + memoryLimit.ToString() + "  MB");
#endif
            
            switch (template.jumpType)
            {
                case "videoPlayer":
                    App.PlayerModel.VideoId = template.videoId;
                    App.PlayerModel.currentType = ViewModels.PlayerViewModel.PlayType.VideoType;
                    CallbackManager.currentPage.NavigationService.Navigate(new Uri(CommonData.PlayerPageName, UriKind.Relative)); 
                    break;
                case "subjectPage":
                    MoreSubject.subjectId = template.subjectId;
                    MoreSubject.speicalName = template.name;
                    MoreSubject.isMoreChannel = false;
                    CallbackManager.currentPage.NavigationService.Navigate(new Uri(CommonData.SpecialPageName, UriKind.Relative));
                    break;
                case "videoLibrary":
                    if (channel != null)
                    {
                        MoreChannelInfo.typeId = channel.libId;
                        MoreChannelInfo.name = channel.channelName;
                        CallbackManager.currentPage.NavigationService.Navigate(new Uri(CommonData.MoreChannelPageName, UriKind.Relative));
                    }
                    break;
                case "webView":
                    WebBrowserTask task = new WebBrowserTask();
                    task.Uri = new Uri(template.webUrl, UriKind.Absolute);
                    try
                    {
                        task.Show();
                    }
                    catch (Exception e)
                    {

                    }
                    break;
                case "livePlayer":
                    LivePlayer.liveUrl = template.playUrl;
                    CallbackManager.currentPage.NavigationService.Navigate(new Uri(CommonData.LivePlayerPage, UriKind.Relative));
                    break;
                case "concertLivePlayer":
                   // LivePlayer.liveUrl = CommonData.LivePlaerUrl + "&videoId=" + template.videoId;
                    LivePlayer.liveUrl = "http://live.api.hunantv.com/mobile/getLiveStreaming?videoId=" + template.videoId;
                    HttpHelper.httpGet(LivePlayer.liveUrl, (ar) =>
                    {
                        string result = HttpHelper.SyncResultTostring(ar);
                        if (result != null)
                        {
                            LiveInfo videosResult = null;
                            try
                            {
                                videosResult = JsonConvert.DeserializeObject<LiveInfo>(result);
                            }
                            catch (Exception ex)
                            {
                                System.Diagnostics.Debug.WriteLine("LoadChannelCompleted   json 解析错误" + ex.Message);
                                App.JsonError(result);
                            }
                            if (videosResult != null && videosResult.m3u8 != null)
                            {
                                LivePlayer.liveUrl = videosResult.m3u8;
                                if (!string.IsNullOrEmpty(LivePlayer.liveUrl)) {
                                    CallbackManager.currentPage.Dispatcher.BeginInvoke(() =>
                                    {
                                        CallbackManager.currentPage.NavigationService.Navigate(new Uri(CommonData.LivePlayerPage, UriKind.Relative));
                                    });
                              
                                }
                               
                            }
                        }
                    });
                  
                    //App.ShowToast("抱歉,暂时不支持直播功能");
                    break;
                default:
                    System.Diagnostics.Debug.WriteLine("该播放类型暂时未实现"+template.jumpType);
                    App.ShowToast("该播放类型暂时未实现" + template.jumpType );
                    break;
            }
        }
Exemplo n.º 6
0
 private void CreateLiveView(List<ChannelTemplate> list)
 {
     foreach(ChannelTemplate template in list)
     {
         VideoViewModel videoData = new VideoViewModel
         {
             width = 150,
             hight = 130,
             name = template.name,
             jumpType = template.jumpType,
             subjectId = template.subjectId,
             picUrl = template.picUrl,
             playUrl = template.playUrl,
             tag = template.tag,
             desc = template.desc,
             videoId = template.videoId,
             hotDegree = template.hotDegree,
             webUrl = template.webUrl,
             rank = template.rank
         };
         Grid myGrid = new Grid();
         myGrid.Height = 150;
         myGrid.Margin = new Thickness(10,5,5,10);
         Image liveImage = new Image();
         liveImage.Source = new BitmapImage(new Uri(videoData.picUrl, UriKind.RelativeOrAbsolute));
         liveImage.Height = 130;
         liveImage.Width = 150;
         liveImage.HorizontalAlignment = HorizontalAlignment.Left;
         TextBlock text = new TextBlock();
         text.Margin = new Thickness(liveImage.Width+10,0,0,0);
         text.VerticalAlignment = VerticalAlignment.Center;
         text.Text = videoData.name;
         myGrid.Children.Add(liveImage);
         myGrid.Children.Add(text);
         myGrid.DataContext = videoData;
         myGrid.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(GridImage_Tap);
         stackPanel.Children.Add(myGrid);
     }
   
 }
Exemplo n.º 7
0
 private Grid CreateImageView(double width, MoreChannel template, double height)
 {
     VideoViewModel videoData = new VideoViewModel
     {
         width = (int)width,
         hight = (int)height,
         name = template.name,
         videoId = template.videoId,
         picUrl = template.image,
         tag = template.tag,
         playCount = template.playCount
     };
     if (string.IsNullOrEmpty(xaml))
     {
         using (Stream stream = Application.GetResourceStream(new Uri("/MangGuoTv;component/Views/MoreChannelImageView.xaml", UriKind.Relative)).Stream)
         {
             using (StreamReader reader = new StreamReader(stream))
             {
                 xaml = reader.ReadToEnd();
             }
         }
     }
     Grid imageGrid = (Grid)XamlReader.Load(xaml);
     imageGrid.Width = width;
     imageGrid.Height = height;
     imageGrid.DataContext = videoData;
     imageGrid.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(GridImage_Tap);
     return imageGrid;
 }
Exemplo n.º 8
0
        private void NorVideoTap(object sender, System.Windows.Input.GestureEventArgs e)
        {
            tapFromGrid = true;

            Grid tapGrid = sender as Grid;
            if (tapGrid != null) {
                string tag = tapGrid.Tag.ToString();
                VideoViewModel template1 = tapGrid.DataContext as VideoViewModel;
                if (template1 == null) return;
                switch (tag) 
                {
                    case "0":
                         VideoViewModel template = new VideoViewModel
                        {
                            type = template1.type,
                            name = template1.name,
                            jumpType = template1.jumpType,
                            picUrl = template1.picUrl,
                            tag = template1.tag,
                            desc = template1.desc,
                            videoId = template1.videoId,
                            webUrl = template1.webUrl,
                            playUrl = template1.playUrl,
                            subjectId = template1.subjectId,
                        };
               
                        OperationImageTap(template);
                        break;
                    case "1":
                         VideoViewModel template2 = new VideoViewModel
                        {
                            type = template1.type,
                            name = template1.name1,
                            jumpType = template1.jumpType1,
                            picUrl = template1.picUrl1,
                            tag = template1.tag1,
                            desc = template1.desc1,
                            videoId = template1.videoId1,
                            webUrl = template1.webUrl1,
                            playUrl = template1.playUrl1,
                            subjectId = template1.subjectId1,
                        };
                        OperationImageTap(template2);
                        break;
                    default:
                         VideoViewModel template3 = new VideoViewModel
                        {
                            type = template1.type,
                            name = template1.name,
                            jumpType = template1.jumpType,
                            picUrl = template1.picUrl,
                            tag = template1.tag,
                            desc = template1.desc,
                            videoId = template1.videoId,
                            webUrl = template1.webUrl,
                            playUrl = template1.playUrl,
                            subjectId = template1.subjectId,
                        };
                        OperationImageTap(template3);
                        break;
                }
            }
        }
Exemplo n.º 9
0
        private void LoadSiftChannelCompleted(IAsyncResult ar)
        {
            string result = HttpHelper.SyncResultTostring(ar);
            if (result != null)
            {
                channelDetailResult channelDetails = null;
                try
                {
                    channelDetails = JsonConvert.DeserializeObject<channelDetailResult>(result);
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine("LoadChannelCompleted   json 解析错误" + ex.Message);
                }
                if (channelDetails != null && channelDetails.err_code == HttpHelper.rightCode)
                {
                    siftListLoadSucc = true;

                    CallbackManager.currentPage.Dispatcher.BeginInvoke(() =>
                    {
                        SiftLLs.Visibility = System.Windows.Visibility.Visible;
                        List<VideoViewModel> TemplateListData = new List<VideoViewModel>();
                        foreach (ChannelDetail channelDatail in channelDetails.data)
                        {
                            switch (channelDatail.type)
                            {
                                case "normalAvatorText":
                                case "normalLandScape":
                                case "roundAvatorText":
                                case "tvPortrait":
                                    for (int i = 0; i < channelDatail.templateData.Count; i=i+2)
                                    {
                                        if (channelDatail.templateData.Count > i + 1)
                                        {
                                            ChannelTemplate template1 = channelDatail.templateData[i];
                                            ChannelTemplate template2 = channelDatail.templateData[i+1];
                                            VideoViewModel videoData = new VideoViewModel
                                            {
                                                //stupid func
                                                type = channelDatail.type,
                                                name = template1.name,
                                                jumpType = template1.jumpType,
                                                picUrl = template1.picUrl,
                                                tag = template1.tag,
                                                desc = template1.desc,
                                                videoId = template1.videoId,
                                                webUrl = template1.webUrl,
                                                playUrl = template1.playUrl,
                                                subjectId = template1.subjectId,
                                                name1 = template2.name,
                                                picUrl1 = template2.picUrl,
                                                tag1 = template2.tag,
                                                desc1 = template2.desc,
                                                videoId1 = template2.videoId,
                                                jumpType1 = template1.jumpType,
                                                webUrl1 = template2.webUrl,
                                                playUrl1 = template2.playUrl,
                                                subjectId1 = template2.subjectId,
                                            };
                                            TemplateListData.Add(videoData);
                                        }
                                        else 
                                        {
                                            ChannelTemplate template1 = channelDatail.templateData[i];
                                            VideoViewModel videoData = new VideoViewModel
                                            {
                                                type = channelDatail.type,
                                                name = template1.name,
                                                jumpType = template1.jumpType,
                                                picUrl = template1.picUrl,
                                                tag = template1.tag,
                                                desc = template1.desc,
                                                videoId = template1.videoId,
                                                webUrl = template1.webUrl,
                                                playUrl = template1.playUrl,
                                                subjectId = template1.subjectId,
                                            };
                                            TemplateListData.Add(videoData);
                                        }
                                      
                                    }
                                    break;
                                default:
                                    break;
                            }
                            foreach (ChannelTemplate template in channelDatail.templateData)
                            {
                                switch (channelDatail.type)
                                {
                                    case "banner":
                                    case "largeLandScapeNodesc":
                                    case "largeLandScape":
                                    case "normalLandScapeNodesc":
                                    case "aceSeason":
                                    case "title":
                                    case "rankList":
                                    case "live":
                                        break;
                                    case "normalAvatorText":
                                    case "normalLandScape":
                                    case "roundAvatorText":
                                    case "tvPortrait":
                                    case "unknowModType1":
                                    case "unknowModType2":
                                        continue;
                                    default:
                                        continue;
                                }
                                VideoViewModel videoData = new VideoViewModel
                                {
                                    type = channelDatail.type,
                                    //width = width,
                                    //hight = height,
                                    name = template.name,
                                    jumpType = template.jumpType,
                                    subjectId = template.subjectId,
                                    picUrl = template.picUrl,
                                    playUrl = template.playUrl,
                                    tag = template.tag,
                                    desc = template.desc,
                                    videoId = template.videoId,
                                    hotDegree = template.hotDegree,
                                    webUrl = template.webUrl,
                                    rank = template.rank
                                };
                                TemplateListData.Add(videoData);
                            }
                        }
                        SiftLLs.ItemsSource = TemplateListData;
                    });
                }
            }
            else
            {
                if (CommonData.NetworkStatus != "None")
                {
                    App.ShowToast("获取数据失败,请检查网络或重试");
                }
                CallbackManager.currentPage.Dispatcher.BeginInvoke(() =>
                {
                    siftLoadGrid.Visibility = System.Windows.Visibility.Visible;
                    App.HideLoading();
                    //siftLoadGrid.Tap -= new EventHandler<System.Windows.Input.GestureEventArgs>(ReloadSiftDataTap);
                    //siftLoadGrid.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(ReloadSiftDataTap);
                    SiftLLs.Visibility = System.Windows.Visibility.Collapsed;
                });

            }
        }
Exemplo n.º 10
0
 private void RankListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     ChannelTemplate template = RankListBox.SelectedItem as ChannelTemplate;
     if (template != null) 
     {
         VideoViewModel videoData = new VideoViewModel
         {
             width = 150,
             hight = 130,
             name = template.name,
             jumpType = template.jumpType,
             subjectId = template.subjectId,
             picUrl = template.picUrl,
             playUrl = template.playUrl,
             tag = template.tag,
             desc = template.desc,
             videoId = template.videoId,
             hotDegree = template.hotDegree,
             webUrl = template.webUrl,
             rank = template.rank
         };
         OperationImageTap(videoData);
     }
 }
Exemplo n.º 11
0
        private Grid CreateImageView(double width, ChannelTemplate template, double height)
        {
            VideoViewModel videoData = new VideoViewModel
            {
                name = template.name,
                jumpType = template.jumpType,
                subjectId = template.subjectId,
                picUrl = template.picUrl,
                playUrl = template.playUrl,
                tag = template.tag,
                desc = template.desc,
                videoId = template.videoId,
                hotDegree = template.hotDegree,
                webUrl = template.webUrl,
                rank = template.rank
            };
            if (string.IsNullOrEmpty(xaml))
            {
                using (Stream stream = Application.GetResourceStream(new Uri("/MangGuoTv;component/Views/ImageView.xaml", UriKind.Relative)).Stream)
                {
                    using (StreamReader reader = new StreamReader(stream))
                    {
                        xaml = reader.ReadToEnd();
                    }
                }
            }

            Grid imageGrid = (Grid)XamlReader.Load(xaml);
            imageGrid.Width = width;
            imageGrid.Height = height;
            imageGrid.DataContext = videoData;
            imageGrid.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(GridImage_Tap);
            return imageGrid;
            //Grid imgGrid = new Grid();
            //imgGrid.Width = width;
            //imgGrid.Height = height;
            //Image videoImage = new Image();
            //BitmapImage videoImageSource = new BitmapImage(new Uri(template.picUrl, UriKind.RelativeOrAbsolute));
            //videoImageSource.DecodePixelHeight = ((int)height - 50);
            //videoImageSource.DecodePixelWidth = ((int)width)/2;
            //videoImage.Source = videoImageSource;
            //videoImage.VerticalAlignment = VerticalAlignment.Top;
            //videoImage.HorizontalAlignment = HorizontalAlignment.Center;
            //imgGrid.Children.Add(videoImage);
            //imgGrid.DataContext = template;
            //imgGrid.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(GridImage_Tap);
            //return imgGrid;
        }