Exemplo n.º 1
0
        public int connectToServer(int port, DXChild c)
        {
            bool wasQueued = false;
            String server;

            if (c != null)
            {
                server = c.getServer();
                if (!c.IsQueued)
                {
                    serverInfo.children.Remove(c);
                    c.unQueue();
                }
            }
            else
            {
                server = serverInfo.server;
            }
            DXPacketIF p = new DXPacketIF(server, port, DXChild.HostIsLocal(server));
            if (DXApplication.resource.debugMode)
                p.setEchoCallback(DXApplication.DebugEchoCallback, "need to get stderr");

            if (p.Error)
            {
                ErrorDialog ed = new ErrorDialog();
                ed.post("Connection to {0} failed.", server);
                p = null;
                return 0;
            }

            clearErrorList();
            if (serverInfo.packet == null)
            {
                if (wasQueued)
                {
                    InfoDialog id = new InfoDialog();
                    id.post("Your connection to {0} has been accepted.", server);
                }
                packetIFAccept(p);
            }
            else
            {
                serverInfo.queuedPackets.Insert(0, p);
                QuestionDialog qd = new QuestionDialog();
                String s = String.Format("Your connection to server {0} has been accepted. Do you want to disconnect from {0} and connect to it?",
                    server, serverInfo.server);
                qd.modalPost(this.getAnchorForm(), s, null, p, DXApplication.QueuedPacketAccept,
                    DXApplication.QueuedPacketCancel, null, "Yes", "No", null, 2);

            }
            return 1;
        }
Exemplo n.º 2
0
        protected virtual bool sendMacro(DXPacketIF pif)
        {
            Object cbdata = null;
            PacketIF.PacketIFCallback cb = pif.getEchoCallback(ref cbdata);
            StreamWriter sw = pif.getStreamWriter();
            bool viasocket = true;

            if (getNetwork().isJavified())
            {
                pif.sendMacroStart();
                FormatMacro(sw, cb, cbdata, ImageNode.GifMacroTxt, viasocket);
                pif.sendMacroEnd();

                pif.sendMacroStart();
                FormatMacro(sw, cb, cbdata, ImageNode.VrmlMacroTxt, viasocket);
                pif.sendMacroEnd();

                pif.sendMacroStart();
                FormatMacro(sw, cb, cbdata, ImageNode.DXMacroTxt, viasocket);
                pif.sendMacroEnd();
            }

            pif.sendMacroStart();
            bool sts = printMacro(pif.getStreamWriter(), cb, cbdata, true);
            pif.sendMacroEnd();

            return sts;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Handle acceptance of (connection to) a packet interface.
        /// </summary>
        /// <param name="p"></param>
        protected virtual void packetIFAccept(DXPacketIF p)
        {
            serverInfo.queuedPackets.Remove(p);
            if (serverInfo.packet != null)
            {
                serverInfo.packet = null;
                disconnectedFromServerCmd.execute();
            }
            serverInfo.packet = p;

            p.initializePacketIO();

            connectedToServerCmd.execute();
            sendNewMDFToServer(NodeDefinition.theNodeDefinitionDictionary);

            getExecCtl().newConnection();
        }
Exemplo n.º 4
0
 /// <summary>
 /// Send the command to the flush the dictionaries.
 /// </summary>
 /// <param name="pif"></param>
 protected virtual void flushExecutiveDictionaries(DXPacketIF pif)
 {
     Debug.Assert(pif != null);
     pif.send(PacketIF.PacketType.FOREGROUND, "Executive(\"flush dictionary\");\n");
 }
Exemplo n.º 5
0
 /// <summary>
 /// Handle cancelation of (disconnection from) a packet interface.
 /// </summary>
 /// <param name="p"></param>
 public virtual void packetIFCancel(DXPacketIF p)
 {
     throw new Exception("Not Yet Implemented");
 }
Exemplo n.º 6
0
 protected override void updateModuleMessageProtocol(DXPacketIF pif)
 {
     throw new Exception("not implemented yet");
 }
Exemplo n.º 7
0
        /// <summary>
        /// Update the state of message handling for a module/UI message.
        /// This is called only when we send a Node's module call to the executive
        /// and the node has a module messaging protocol as defined by
        /// this->hasModuleMessageProtocol().
        /// </summary>
        /// <param name="pif"></param>
        protected virtual void updateModuleMessageProtocol(DXPacketIF pif)
        {
            String id = getModuleMessageIdString();

            if (expectingModuleMessage())
            {
                // Install a callback to handle messages from the module
                pif.setHandler(PacketIF.PacketType.INFORMATION,
                    Node.ExecModuleMessageHandler,
                    this, id);
            }
            else
            {
                // Remove the handler in case it was previously installed.
                pif.setHandler(PacketIF.PacketType.INFORMATION,
                    null, this, id);
            }
        }