예제 #1
0
 void PushButton_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
 {
     this.pushSurfaceItem = args.NewValue as PushSurfaceItem;
     if (this.pushSurfaceItem != null && !string.IsNullOrEmpty(this.pushSurfaceItem.ImageResourceName))
     {
         imgPushArea.Background = Application.Current.Resources[this.pushSurfaceItem.ImageResourceName] as Brush;
         imgPushArea.Visibility = Visibility.Visible;
     }
 }
예제 #2
0
        private PushSurfaceItem CreatePushSurfaceItem(Dictionary <string, FixtureReference> references,
                                                      XElement xeSurfaceItem)
        {
            List <DmxBinding> bindingsPress   = null;
            List <DmxBinding> bindinsReleased = null;

            var    xaName = xeSurfaceItem.Attribute("name");
            string name   = "";

            if (xaName != null)
            {
                name = xaName.Value;
            }

            foreach (var xeOutput in xeSurfaceItem.Elements("Output"))
            {
                List <DmxBinding> dmxChannelTargets = BuildBindingList(references, xeOutput);
                if (xeOutput.Attribute("state").Value == "PRESS")
                {
                    bindingsPress = dmxChannelTargets;
                }
                else
                {
                    bindinsReleased = dmxChannelTargets;
                }
            }
            var psi = new PushSurfaceItem(name, bindingsPress, bindinsReleased);

            var xaImg = xeSurfaceItem.Attribute("img");

            if (xaImg != null)
            {
                psi.ImageResourceName = xaImg.Value;
            }

            return(psi);
        }