Example #1
0
        public async Task Attach(IVncHandler handler)
        {
            await Lock.WaitAsync();

            try
            {
                Handlers.Add(handler);
                ushort x      = 0;
                ushort y      = 0;
                ushort width  = FramebufferWidth;
                ushort height = FramebufferHeight;
                if (Section != null)
                {
                    x      = Section.X;
                    y      = Section.Y;
                    width  = Section.Width;
                    height = Section.Height;
                }
                SendFramebufferUpdateRequest(x, y, width, height, false);
                handler.HandleResolutionUpdate(width, height);
            }
            finally
            {
                Lock.Release();
            }
        }
Example #2
0
        public async Task Detach(IVncHandler handler)
        {
            await Lock.WaitAsync();

            try
            {
                Handlers.Remove(handler);
            }
            finally
            {
                Lock.Release();
            }
        }