Exemple #1
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;
 }
Exemple #2
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;
        }
Exemple #3
0
 private Grid CreateRankImageView(double width, ChannelTemplate template, double height) 
 {
     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 = template;
     imageGrid.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(GridImage_Tap);
     return imageGrid;
 }
Exemple #4
0
        //private void Image_Tap(object sender, System.Windows.Input.GestureEventArgs e)
        //{
        //    ChannelTemplate template = (sender as Image).DataContext as ChannelTemplate;
        //    OperationImageTap(template);

        //}
        private void OperationImageTap(ChannelTemplate template) 
        {
            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");
            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;
            }
        }
Exemple #5
0
 private Grid CreateImageView(double width, ChannelTemplate template, double height)
 {
     Grid imgGrid = new Grid();
     imgGrid.Width = width;
     imgGrid.Height = height;
     Grid imgContnt = new Grid();
     imgContnt.Width = width;
     imgContnt.Height = height - 50;
     Image videoImage = new Image();
     videoImage.Width = width;
     videoImage.Height = height - 50;
     BitmapImage videoImageSource = new BitmapImage(new Uri(template.picUrl, UriKind.RelativeOrAbsolute));
     //videoImageSource.DecodePixelWidth = videoImageSource.PixelWidth / 2;
     //videoImageSource.DecodePixelHeight = videoImageSource.PixelHeight / 2;
     videoImage.Source = videoImageSource;
     videoImage.VerticalAlignment = VerticalAlignment.Top;
     videoImage.HorizontalAlignment = HorizontalAlignment.Center;
     imgContnt.Children.Add(videoImage);
     if (!string.IsNullOrEmpty(template.tag))
     {
         Border tagBorder = new Border();
         tagBorder.Background = new SolidColorBrush(Color.FromArgb(255, 106, 95, 87));
         tagBorder.Opacity = 0.7;
         tagBorder.VerticalAlignment = VerticalAlignment.Bottom;
         tagBorder.HorizontalAlignment = HorizontalAlignment.Right;
         tagBorder.Margin = new Thickness(0,0,10,30);
         TextBlock tagText = new TextBlock();
         tagText.Text = template.tag;
         tagBorder.Child = tagText;
         imgContnt.Children.Add(tagBorder);
     }
     imgGrid.Children.Add(imgContnt);
     StackPanel descPanel = new StackPanel();
     descPanel.VerticalAlignment = VerticalAlignment.Bottom;
     TextBlock nameText = new TextBlock();
     nameText.Text = template.name;
     nameText.TextWrapping = TextWrapping.Wrap;
     descPanel.Children.Add(nameText);
     TextBlock descText = new TextBlock();
     descText.Text = template.desc;
     descText.FontSize = 15;
     descText.Foreground = new SolidColorBrush(Color.FromArgb(255, 106, 95, 87));
     descText.TextWrapping = TextWrapping.Wrap;
     descPanel.Children.Add(descText);
     imgGrid.Children.Add(descPanel);
     imgGrid.DataContext = template;
     imgGrid.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(GridImage_Tap);
     return imgGrid;
 }