Example #1
0
 public VideoControl()
 {
     InitializeComponent();
     if (!App.IsDesignTime)
     {
         var playViewModel = new NodeCornerButtonViewModel { ButtonType = NodeCornerButtonType.Play };
         var pauseViewModel = new NodeCornerButtonViewModel { ButtonType = NodeCornerButtonType.Pause };
         NodeCornerButtonLoader.DressButton(playViewModel);
         NodeCornerButtonLoader.DressButton(pauseViewModel);
         PlayButton.DataContext = playViewModel;
         PauseButton.DataContext = pauseViewModel;
     }
 }
        public static void DressButton(NodeCornerButtonViewModel button)
        {
            ImageSource skinImage;
            if (Images.ContainsKey(button.ButtonType))
            {
                skinImage = Images[button.ButtonType];
            }
            else
            {
                var skinImageAddress = GetSkinImageUri(button.ButtonType);
                var skinImageUri = new Uri(skinImageAddress);

                skinImage = new BitmapImage(skinImageUri);
                Images[button.ButtonType] = skinImage;
            }

            button.Icon = skinImage;
        }
Example #3
0
        private void RefreshCornerControl()
        {
            if (ViewModelNode == null) return;

            var count = 0;
            if (ViewModelNode.VideoInfo != null && ViewModelNode.VideoInfo.HasVideo)
            {
                VideoRemoteControl.Visibility = Visibility.Visible;
                count++;
            }

            if (ViewModelNode.DescriptionType != NodeDescriptionType.None)
            {
                if (count == 0)
                {
                    CornerButton.Visibility = Visibility.Visible;
                    var buttonViewModel = new NodeCornerButtonViewModel { ButtonType = NodeCornerButtonType.Content };
                    NodeCornerButtonLoader.DressButton(buttonViewModel);
                    CornerButton.DataContext = buttonViewModel;
                }
                count++;
            }
            else
            {
                NodeCornerButtonViewModel buttonViewModel = CornerButton.DataContext as NodeCornerButtonViewModel;
                if (buttonViewModel != null && buttonViewModel.ButtonType == NodeCornerButtonType.Content && CornerButton.Visibility == Visibility.Visible)
                {
                    CornerButton.Visibility = Visibility.Collapsed;
                }
            }

            if (ViewModelNode.IsTranscluded)
            {
                if (count == 0)
                {
                    CornerButton.Visibility = Visibility.Visible;
                    var viewmodel = new NodeCornerButtonViewModel { ButtonType = NodeCornerButtonType.Map };
                    NodeCornerButtonLoader.DressButton(viewmodel);
                    CornerButton.DataContext = viewmodel;
                }
                count++;

            }

            if (count > 1)
            {
                MultiButtonIndicator.Visibility = Visibility.Visible;
            }
            else
            {
                MultiButtonIndicator.Visibility = Visibility.Collapsed;
            }
        }