Esempio n. 1
0
 public void SetS2L(bool enable, DMXDevice.Location loc)
 {
     foreach (DMXDevice device in DMXDevices.Where(device => device.Sound2Light != -1 && (loc == DMXDevice.Location.All || device.DeviceLocation == loc)))
     {
         DMXDriver.SetDMXValue(device.Sound2Light, (byte)(enable ? 255 : 0));
     }
 }
Esempio n. 2
0
 public void SetDeviceMaster(byte value, DMXDevice.Location loc)
 {
     foreach (DMXDevice device in DMXDevices.Where(device => device.DeviceLocation == loc || loc == DMXDevice.Location.All))
     {
         DMXDriver.SetDMXValue(device.Master, value);
     }
 }
Esempio n. 3
0
        public void SetDeviceColor(Color color, DMXDevice.Location loc)
        {
            foreach (DMXDevice device in DMXDevices.Where(device => loc == DMXDevice.Location.All || device.DeviceLocation == loc))
            {
                DMXDriver.SetDMXValue(device.R, color.R);
                DMXDriver.SetDMXValue(device.G, color.G);
                DMXDriver.SetDMXValue(device.B, color.B);

                if (this.OnColorChange != null)
                {
                    this.OnColorChange(this, new ColorChangedEventArgs(color, device));
                }
            }
        }
Esempio n. 4
0
        void OnCommandIncoming(object sender, IncomingCommandEventArgs e)
        {
            if (DEBUG)
            {
                Console.WriteLine("\nGot command:\n" + String.Format("\tType: {0}\n\tArgs: {1}", e.Command.Type.ToString(), String.Join(" ", e.Command.Args)));
            }

            DMXDevice.Location loc = (DMXDevice.Location)Enum.Parse(typeof(DMXDevice.Location), e.Command.Args[1]);

            switch (e.Command.Type)
            {
            case Command.CommandType.SetBrightness:
            {
                controller.SetDeviceMaster(Convert.ToByte(e.Command.Args[0]), loc);

                break;
            }

            case Command.CommandType.SetColor:
            {
                Color color = System.Drawing.ColorTranslator.FromHtml(e.Command.Args[0]);
                controller.SetDeviceColor(color, loc);

                break;
            }

            case Command.CommandType.SetS2L:
            {
                controller.SetS2L(Convert.ToBoolean(e.Command.Args[0]), loc);
                break;
            }

            case Command.CommandType.Exit:
            {
                flyingServer.Stop();
                DIRECTflyingServer.Stop();
                break;
            }
            }
        }