Пример #1
0
 /// <summary>
 /// if no implicit button defined, add one after the target button (if there is one)
 /// </summary>
 void InjectImplicitButton(string implicitButton, string targetButton)
 {
     if (elements.Any(e => (e.Type == ControlBarElement.ElementType.Button) && (e.Name == implicitButton)))
     {
         return;
     }
     for (var i = 0; i < elements.Count; i++)
     {
         if ((elements[i].Type != ControlBarElement.ElementType.Button) || (elements[i].Name != targetButton))
         {
             continue;
         }
         elements.Insert(i, ControlBarElement.Button(implicitButton));
         break;
     }
 }
Пример #2
0
        void ReadPlaceholders(XElement layout, string groupName)
        {
            foreach (var item in GroupNodes(layout, groupName))
            {
                var name    = item.AttributeValue("name");
                var element = item.AttributeValue("element");
                var width   = item.AttributeValue("width");
                switch (item.Name.LocalName.ToLower())
                {
                case "button":
                    if (name != null && name != "blank")
                    {
                        elements.Add(ControlBarElement.Button(name));
                    }
                    break;

                case "text":
                    if (name != null)
                    {
                        elements.Add(ControlBarElement.Text(name));
                    }
                    break;

                case "divider":
                    if (width == null)
                    {
                        elements.Add(ControlBarElement.Divider(element));
                    }
                    else
                    {
                        elements.Add(ControlBarElement.Gap(int.Parse(width)));
                    }
                    break;

                case "slider":
                    if (name == "time")
                    {
                        elements.Add(ControlBarElement.TimeSlider());
                    }
                    else if (name == "volume")
                    {
                        elements.Add(ControlBarElement.VolumeSlider());
                    }
                    break;
                }
            }
        }
Пример #3
0
 void SetupDefaults()
 {
     elements.Add(ControlBarElement.Button("play"));
     elements.Add(ControlBarElement.Button("pause"));
     elements.Add(ControlBarElement.Button("stop"));
     elements.Add(ControlBarElement.Button("prev"));
     elements.Add(ControlBarElement.Button("next"));
     elements.Add(ControlBarElement.Divider("divider"));
     elements.Add(ControlBarElement.Text("elapsed"));
     elements.Add(ControlBarElement.TimeSlider());
     elements.Add(ControlBarElement.Text("duration"));
     elements.Add(ControlBarElement.Divider("divider"));
     elements.Add(ControlBarElement.Divider("divider"));
     elements.Add(ControlBarElement.Button("fullscreen"));
     elements.Add(ControlBarElement.Button("normalscreen"));
     elements.Add(ControlBarElement.Divider("divider"));
     elements.Add(ControlBarElement.Button("mute"));
     elements.Add(ControlBarElement.Button("unmute"));
     elements.Add(ControlBarElement.VolumeSlider());
 }