예제 #1
0
 void SetColumnDefinitions(ControlBarLayout layout)
 {
     LayoutRoot.ColumnDefinitions.Clear();
     foreach (var element in layout.Elements)
     {
         // This isn't what the spec says, but behaves like the actual player.
         if (element.Type == ControlBarElement.ElementType.TimeSlider)
         {
             LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition {
                 Width = new GridLength(1, GridUnitType.Star)
             });
         }
         else
         {
             LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition {
                 Width = GridLength.Auto
             });
         }
     }
 }
예제 #2
0
        public void SetSkin(JwSkinPackage pkg)
        {
            GetBackground(pkg);
            LayoutRoot.SizeChanged += LayoutRoot_SizeChanged;

            var baseColor = pkg.GetSettingValue("frontcolor");

            ControlbarOverMargin = double.Parse(pkg.GetSettingValue(ControlBarComponent, "margin") ?? "0.0");
            TargetFontSize       = double.Parse(pkg.GetSettingValue(ControlBarComponent, "fontsize") ?? "10.0");
            FontColour           = (pkg.GetSettingValue(ControlBarComponent, "fontcolor") ?? baseColor ?? "0xffffff").HexToColor();

            var layout = new ControlBarLayout(pkg);

            BuildControls(pkg, layout);

            UpdateFullScreenButtonState(null, null);
            UpdateSoundButtonState();
            UpdatePlaylistButtonVisibility();
            ShowPlayButton();
            PaddingBorder.Padding = new Thickness(ControlbarOverMargin);
        }
예제 #3
0
 void SetColumnDefinitions(ControlBarLayout layout)
 {
     LayoutRoot.ColumnDefinitions.Clear();
     foreach (var element in layout.Elements) {
         // This isn't what the spec says, but behaves like the actual player.
         if (element.Type == ControlBarElement.ElementType.TimeSlider) {
             LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition {Width = new GridLength(1, GridUnitType.Star)});
         } else {
             LayoutRoot.ColumnDefinitions.Add(new ColumnDefinition {Width = GridLength.Auto});
         }
     }
 }
예제 #4
0
        void BuildControls(JwSkinPackage pkg, ControlBarLayout layout)
        {
            SetColumnDefinitions(layout);
            int i = 0;
            FrameworkElement lastElement = null;
            foreach (var element in layout.Elements) {
                FrameworkElement c;

                switch (element.Type) {
                    case ControlBarElement.ElementType.Gap:
                        i++; continue;

                    case ControlBarElement.ElementType.Text:
                        if (element.Name == "elapsed") {
                            elapsedText = new JwElapsedText {
                                FontSize = TargetFontSize,
                                FontColour = FontColour
                            };
                            c = elapsedText;
                            players.EachPlayer(p => players.AddBinding(p, elapsedText));
                        } else if (element.Name == "duration") {
                            durationText = new JwDurationText {
                                FontSize = TargetFontSize,
                                FontColour = FontColour
                            };
                            c = durationText;
                            players.EachPlayer(p => players.AddBinding(p, durationText));
                        } else {
                            i++; continue;
                        }
                        break;

                    case ControlBarElement.ElementType.Divider:
                        c = new PairedImage(lastElement);
                        pkg.BindAndResize(((PairedImage)c).Image, ControlBarComponent, element.Name ?? "divider");
                        break;

                    case ControlBarElement.ElementType.CapLeft:
                        c = leftCap = new Image();
                        pkg.BindAndResize(leftCap, ControlBarComponent, element.Name ?? "divider");
                        break;

                    case ControlBarElement.ElementType.CapRight:
                        c = rightCap = new Image();
                        pkg.BindAndResize(rightCap, ControlBarComponent, element.Name ?? "divider");
                        break;

                    case ControlBarElement.ElementType.Button:
                        var btn = BindButton(element, pkg);
                        c = btn;
                        c.Cursor = Cursors.Hand;
                        break;

                    case ControlBarElement.ElementType.TimeSlider:
                        var tsl = BuildTimeSlider(pkg);
                        c = tsl;
                        c.Cursor = Cursors.Hand;
                        break;

                    case ControlBarElement.ElementType.VolumeSlider:
                        var vsl = BuildVolumeSlider(pkg);
                        c = vsl;
                        c.Cursor = Cursors.Hand;
                        break;

                    default:
                        i++; continue;
                }

                LayoutRoot.Children.Add(c);
                lastElement = c;
                if (element.Name == "play" || element.Name == "pause") lastElement = null;
                c.SetValue(Grid.ColumnProperty, i);
                i++;
            }
        }
예제 #5
0
        public void SetSkin(JwSkinPackage pkg)
        {
            GetBackground(pkg);
            LayoutRoot.SizeChanged+=LayoutRoot_SizeChanged;

            var baseColor = pkg.GetSettingValue("frontcolor");
            ControlbarOverMargin = double.Parse(pkg.GetSettingValue(ControlBarComponent, "margin") ?? "0.0");
            TargetFontSize = double.Parse(pkg.GetSettingValue(ControlBarComponent, "fontsize") ?? "10.0");
            FontColour = (pkg.GetSettingValue(ControlBarComponent, "fontcolor") ?? baseColor ?? "0xffffff").HexToColor();

            var layout = new ControlBarLayout(pkg);
            BuildControls(pkg, layout);

            UpdateFullScreenButtonState(null, null);
            UpdateSoundButtonState();
            UpdatePlaylistButtonVisibility();
            ShowPlayButton();
            PaddingBorder.Padding = new Thickness(ControlbarOverMargin);
        }
예제 #6
0
        void BuildControls(JwSkinPackage pkg, ControlBarLayout layout)
        {
            SetColumnDefinitions(layout);
            int i = 0;
            FrameworkElement lastElement = null;

            foreach (var element in layout.Elements)
            {
                FrameworkElement c;

                switch (element.Type)
                {
                case ControlBarElement.ElementType.Gap:
                    i++; continue;

                case ControlBarElement.ElementType.Text:
                    if (element.Name == "elapsed")
                    {
                        elapsedText = new JwElapsedText {
                            FontSize   = TargetFontSize,
                            FontColour = FontColour
                        };
                        c = elapsedText;
                        players.EachPlayer(p => players.AddBinding(p, elapsedText));
                    }
                    else if (element.Name == "duration")
                    {
                        durationText = new JwDurationText {
                            FontSize   = TargetFontSize,
                            FontColour = FontColour
                        };
                        c = durationText;
                        players.EachPlayer(p => players.AddBinding(p, durationText));
                    }
                    else
                    {
                        i++; continue;
                    }
                    break;

                case ControlBarElement.ElementType.Divider:
                    c = new PairedImage(lastElement);
                    pkg.BindAndResize(((PairedImage)c).Image, ControlBarComponent, element.Name ?? "divider");
                    break;

                case ControlBarElement.ElementType.CapLeft:
                    c = leftCap = new Image();
                    pkg.BindAndResize(leftCap, ControlBarComponent, element.Name ?? "divider");
                    break;

                case ControlBarElement.ElementType.CapRight:
                    c = rightCap = new Image();
                    pkg.BindAndResize(rightCap, ControlBarComponent, element.Name ?? "divider");
                    break;

                case ControlBarElement.ElementType.Button:
                    var btn = BindButton(element, pkg);
                    c        = btn;
                    c.Cursor = Cursors.Hand;
                    break;

                case ControlBarElement.ElementType.TimeSlider:
                    var tsl = BuildTimeSlider(pkg);
                    c        = tsl;
                    c.Cursor = Cursors.Hand;
                    break;

                case ControlBarElement.ElementType.VolumeSlider:
                    var vsl = BuildVolumeSlider(pkg);
                    c        = vsl;
                    c.Cursor = Cursors.Hand;
                    break;

                default:
                    i++; continue;
                }

                LayoutRoot.Children.Add(c);
                lastElement = c;
                if (element.Name == "play" || element.Name == "pause")
                {
                    lastElement = null;
                }
                c.SetValue(Grid.ColumnProperty, i);
                i++;
            }
        }