public Form1()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            thisDrawing    = new MSMQGraphics.Drawing();
            timer1.Enabled = true;
            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }
Beispiel #2
0
        private void drawingMQ_ReceiveCompleted(object sender, System.Messaging.ReceiveCompletedEventArgs e)
        {
            System.Messaging.Message m;
            MSMQGraphics.Drawing     d;

            try
            {
                if (e.Message != null)
                {
                    m           = e.Message;
                    m.Formatter = new XmlMessageFormatter(new Type[] { typeof(MSMQGraphics.Drawing), typeof(MSMQGraphics.Line) });
                    d           = (MSMQGraphics.Drawing)m.Body;
                    thisDrawing = d;
                    pictureBox1.Invalidate();
                }
            }
            catch
            {
            }

            drawingMQ.BeginReceive(new TimeSpan(0, 0, 3));
        }
        private void checkForDrawing()
        {
            System.Messaging.Message m;
            MSMQGraphics.Drawing     d;

            try
            {
                m = drawingMQ.Receive(new TimeSpan(0, 0, 1));

                m.Formatter = new XmlMessageFormatter(new Type[] { typeof(MSMQGraphics.Drawing), typeof(MSMQGraphics.Line) });

                d = (MSMQGraphics.Drawing)m.Body;

                thisDrawing = d;

                pictureBox1.Invalidate();
            }

            catch
            {
                // We don’t want to display a message after every 5 second poll if no messages are availiable
            }
        }