Beispiel #1
0
        /*
         * Event Handler Methods
         */
        protected void messageReceived(ConnectionEventArgs a)
        {
            PUC.Communication.Message msg = a.GetMessage();

            if (msg is ServerInformation)
            {
                // Globals.GetDefaultLog().AddLogLine( msg.GetXML() );
                initUIMenu((ServerInformation)msg);
                Globals.GetDefaultLog().AddLogLine("Server information updated for " + _name);
            }
        }
Beispiel #2
0
        protected void messageReceived(ConnectionEventArgs a)
        {
            PUC.Communication.Message msg = a.GetMessage();

            if (msg is DeviceSpec)
            {
                DeviceSpec dmsg = (DeviceSpec)msg;

                Appliance appl = new Appliance(this);

#if POCKETPC
                Globals.AddFrameMapping(appl, PUCFrame.DEFAULT_FRAME);
#endif
#if SMARTPHONE
                Globals.AddFrameMapping(appl, PhonePUC.PUCFrame.DEFAULT_FRAME);
#endif
#if DESKTOP && !DEBUGSVR
                // TODO: Make DesktopPUC use multiple windows, like Debug Server
                Globals.AddFrameMapping(appl, DesktopPUC.PUCFrame.DEFAULT_FRAME);
#endif

                try
                {
                    SpecParser.Parse(new StringReader(dmsg.GetSpec()), appl);

                    MenuItem mi = new MenuItem();
                    mi.Text = appl.Name;
                    appl.SetMenuItem(mi);

                    _server.ActivateAppliance(this, appl);

                    Cursor.Current = Cursors.Default;

                    _connection.MessageReceivedEvent    -= new Connection.MessageReceivedHandler(this.messageReceived);
                    _connection.ConnectionRegainedEvent -= new Connection.ConnectionRegainedHandler(this.connectionRegained);
                    _connection.ConnectionLostEvent     += new Connection.ConnectionLostHandler(appl.ConnectionLost);
                    _connection.MessageReceivedEvent    += new Connection.MessageReceivedHandler(appl.MessageReceived);
                    _connection.ConnectionRegainedEvent += new Connection.ConnectionRegainedHandler(appl.ConnectionRegained);

                    FullStateRequest fsrMsg = new FullStateRequest();
                    _connection.Send(fsrMsg);
                }
                catch (Exception e)
                {
                    Globals.GetFrame(appl).AddLogLine(e.ToString());
                    Cursor.Current = Cursors.Default;
                }
            }
        }
Beispiel #3
0
        public void MessageReceived(ConnectionEventArgs a)
        {
            PUC.Communication.Message msg = a.GetMessage();

            if (msg is StateChangeNotification)
            {
                _varTable.HandleStateChangeNotification((StateChangeNotification)msg);
            }
            else if (msg is BinaryStateChangeNotification)
            {
                _varTable.HandleBinaryStateChangeNotification((BinaryStateChangeNotification)msg);
            }
            else if (msg is AlertInformation)
            {
                MessageBox.Show(this.Name, ((AlertInformation)msg).GetAlertMessage());
            }
        }