Ejemplo n.º 1
0
        public void SendImage(Bitmap signImage)
        {
            lock (this)
            {
                SignConfiguration config = CurrentConfig;

                // For each element in the configuration, render it.
                for (int i = 0; i < config.Components.Length; i++)
                {
                    SignComponent c           = config.Components[i];
                    uint[]        elementData = new uint[32 * 32];
                    try
                    {
                        for (int y = 0; y < 32; y++)
                        {
                            for (int x = 0; x < 32; x++)
                            {
                                elementData[x + y * 32] = (uint)signImage.GetPixel(x + c.X, y + c.Y).ToArgb();
                            }
                        }

                        TestBoard.SendImage32x32(i, elementData);
                    }
                    catch { } // Exceptions are generally due to configuration changes leading bitmap changes.
                }
            }
        }
Ejemplo n.º 2
0
        public SignPreview()
        {
            lockObj  = new object();
            SignName = "Sign Preview";
            if (PreviewIndex > 1)
            {
                SignName += " " + PreviewIndex;
            }
            PreviewIndex++;

            InitializeComponent();

            Text = SignName;

            SignComponent[] c = new SignComponent[2];
            c[0] = new SignComponent()
            {
                X = 0, Y = 0, Width = 32, Height = 32
            };
            c[1] = new SignComponent()
            {
                X = 32, Y = 0, Width = 32, Height = 32
            };
            CurrentConfig = new SignConfiguration(c);
            ResizeForConfiguration();
        }
Ejemplo n.º 3
0
        public TargetTestBoard()
        {
            TestBoard = null;
            foreach (var dev in SignTest.Enumerate())
            {
                try
                {
                    TestBoard = new SignTest(dev);
                    break;
                }
                catch { }
            }
            if (TestBoard == null)
            {
                throw new Exception("Unable to attach to a Sign Test board.");
            }


            SignComponent[] c = new SignComponent[1];
            c[0] = new SignComponent()
            {
                X = 0, Y = 0, Width = 32, Height = 32
            };
            CurrentConfig = new SignConfiguration(c);

            // Initialize test board.

            TestBoard.SetMode(SignTest.DeviceMode.On);
            TestBoard.SetMode(SignTest.DeviceMode.FpgaActive);
        }
Ejemplo n.º 4
0
 public void SetTarget(SignTargetUI toConfigure)
 {
     ResponseObject       = toConfigure;
     Configuring          = toConfigure.Target;
     InitialConfiguration = Configuring.CurrentConfiguration();
     ResetView();
 }
Ejemplo n.º 5
0
 public void ApplyConfiguration(SignConfiguration configuration)
 {
     lock (lockObj)
     {
         CurrentConfig = configuration;
     }
     ResizeForConfiguration();
 }
Ejemplo n.º 6
0
        public void ConfigurationChange()
        {
            SignConfiguration newConfiguration = new SignConfiguration(Elements.Select(e => e.Location).ToArray());

            Configuring.ApplyConfiguration(newConfiguration);
            SetIdentify(checkBox1.Checked);
            ParentWindow.UpdateConfiguration(ResponseObject);
        }
Ejemplo n.º 7
0
 public void SetConfiguration(SignConfiguration c)
 {
     lock (this)
     {
         if (Render == null)
         {
             Render = new SignRender();
         }
         Render.SetConfiguration(c);
     }
 }
Ejemplo n.º 8
0
        public void UpdateConfiguration(SignTargetUI target)
        {
            // Apply configuration to all other displays for now. Maybe support multiple configurations in the future.
            SignConfiguration c = target.Target.CurrentConfiguration();

            foreach (SignTargetUI t in Targets)
            {
                if (t != target)
                {
                    t.Target.ApplyConfiguration(c);
                }
            }
            Animate.SetConfiguration(c);
        }
Ejemplo n.º 9
0
 public void SetConfiguration(SignConfiguration c)
 {
     Configuration = c;
     if (c.Width > 0 && c.Height > 0)
     {
         SignOutput   = new Bitmap(Configuration.Width, Configuration.Height);
         SignGraphics = Graphics.FromImage(SignOutput);
         SignGraphics.SmoothingMode     = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
         SignGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAliasGridFit;
         // (Disables cleartype, which doesn't make much sense on the LED sign)
     }
     else
     {
         SignOutput = null;
     }
 }
Ejemplo n.º 10
0
 public void ApplyConfiguration(SignConfiguration configuration)
 {
     CurrentConfig = configuration;
 }
Ejemplo n.º 11
0
 public bool SupportsConfiguration(SignConfiguration configuration)
 {
     return(true);
 }