Ejemplo n.º 1
0
        public bool UpdateOptions(LedMatrixOptions options)
        {
            GCHandle h = GCHandle.Alloc(options, GCHandleType.Pinned);

            try
            {
                return(NativeMethods.led_matrix_update_options(this.handle, h.AddrOfPinnedObject()));
            }
            finally
            {
                h.Free();
            }
        }
Ejemplo n.º 2
0
        private static IntPtr CreateLedMatrix(LedMatrixOptions options)
        {
            GCHandle h = GCHandle.Alloc(options, GCHandleType.Pinned);

            try
            {
                IntPtr argv;
                IntPtr ptr = NativeMethods.led_matrix_create_from_options(h.AddrOfPinnedObject(), IntPtr.Zero, out argv);
                if (ptr == IntPtr.Zero)
                {
                    throw new OutOfMemoryException("Can't create led matrix");
                }
                return(ptr);
            }
            finally
            {
                h.Free();
            }
        }
Ejemplo n.º 3
0
 public LedMatrix(LedMatrixOptions options) : base(CreateLedMatrix(options), true)
 {
     this.m_updateLatch = new SemaphoreSlim(1);
     this.m_canvas      = NativeMethods.led_matrix_create_offscreen_canvas(this.handle);
     NativeMethods.led_canvas_get_size(this.m_canvas, out this.m_canvasWidth, out this.m_canvasHeight);
 }