Beispiel #1
0
 public void AddBinding(IPlayer PlayerToControl)
 {
     players.AddBinding(PlayerToControl, this);
 }
Beispiel #2
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++;
            }
        }