Ejemplo n.º 1
0
        public override bool doIt(CommandInterface ci)
        {
            bool ret = false;

                switch (commandType)
                {
                    case HelpType.GenericHelp:
                        Debug.Assert(ci != null);
                        ci.componentHelp();
                        ret = true;
                        break;
                    case HelpType.HelpTutorial:
                        ret = MainProgram.theApplication.startTutorial();
                        break;
                    case HelpType.AboutApp:
                        InfoDialog id = new InfoDialog();
                        id.post(MainProgram.theApplication.getAboutAppString());
                        ret = true;
                        break;
                    case HelpType.TechSupport:
                        String url = "file://" + MainProgram.theApplication.getUIRoot() +
                            "/html/pages/qikgu033.htm";

                        Process p = Process.Start("iexplore.exe", url);
                        if (p == null)
                        {
                            InfoDialog infoDialog = new InfoDialog();
                            infoDialog.post(MainProgram.theApplication.getTechSupportString());
                        }
                        ret = true;
                        break;
                    default:
                        Debug.Assert(false);
                        break;
                }
                return ret;
        }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
        public void completeConnection(DXChild c)
        {
            if (c != null)
            {
                switch (c.waitForConnection())
                {
                    case -1:
                        ErrorDialog ed = new ErrorDialog();
                        ed.post("Connection to server {0} failed: {1}",
                            c.getServer(), c.failed());
                        closeConnection(c);
                        break;
                    case 0:
                        if (resource.executeProgram)
                            getExecCtl().executeOnce();
                        break;
                    case 1:
                        InfoDialog id = new InfoDialog();
                        id.post("Connection to server {0} has been queued", c.getServer());
                        break;
                }
            }
            else if (!serverInfo.autoStart)
            {
                connectToServer(serverInfo.port, null);
            }

            // Let the application packet know that a new connection to
            // the server has been created.
            if (applicationPacket != null)
                applicationPacket.handleServerConnection();

            if (resource.executeOnChange)
                getExecCtl().enableExecOnChange();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Create a new network editor.  
        /// This particular implementation makes the returned editor an anchor
        /// if this->anchor is NULL.
        /// This may return NULL in which case a message dialog is posted. 
        /// </summary>
        /// <param name="n"></param>
        /// <returns></returns>
        public virtual EditorWindow newNetworkEditor(Network n)
        {
            String msg = "";
            Debug.Assert(n != null);

            if (!this.appAllowsEditorAccess())
            {
                msg = "This invocation of Data Explorer does not allow editor " +
                    "access (-edit). \n" +
                    "Try image mode (-image).";
                InfoDialog id = new InfoDialog();
                id.post(msg);
                return null;
            }
            bool is_anchor;
            if (anchor == null)
                is_anchor = true;
            else
                is_anchor = false;

            return new EditorWindow(is_anchor, n);
        }
Ejemplo n.º 5
0
        public override void switchNetwork(Network from, Network to, bool silently)
        {
            bool change_label = false;
            String name = LabelString.Substring(0, LabelString.IndexOf('_')-1);
            int instance = Int32.Parse(LabelString.Substring(LabelString.IndexOf('_')));

            if (name != null && name == NameString && instance != InstanceNumber)
            {
                change_label = true;
            }

            String new_name = "";

            List<Node> rnl = to.makeClassifiedNodeList(typeof(ProbeNode), false);
            if (rnl != null && !change_label)
            {
                foreach (Node n in rnl)
                {
                    if (!change_label)
                    {
                        if (n.LabelString == LabelString)
                        {
                            change_label = true;
                            break;
                        }
                    }
                }
            }

            if (change_label)
            {
                String new_label = NameString + "_" + InstanceNumber;
                if (!silently)
                {
                    InfoDialog id = new InfoDialog();
                    id.post("{0} {1} has been relabled {2}", NameString, LabelString, new_label);
                }
                setLabelString(new_label);
            }
            base.switchNetwork(from, to, silently);
        }
Ejemplo n.º 6
0
        public override void switchNetwork(Network from, Network to, bool silently)
        {
            String conflict = to.nameConflictExists(this, LabelString);
            String new_name = "";
            bool name_change_required = false;
            if (conflict != null)
            {
                new_name = String.Format("wireless_{0}", InstanceNumber);
                name_change_required = true;
            }

            List<Node> rnl = to.makeClassifiedNodeList(typeof(TransmitterNode), false);
            String cp = (name_change_required ? new_name : LabelString);
            if (rnl != null)
            {
                foreach (Node n in rnl)
                {
                    ReceiverNode rn = (ReceiverNode)n;
                    if (!rn.IsTransmitterConnected &&
                        rn.LabelString == cp)
                    {
                        if (to.checkForCycle(this, rn))
                        {
                            new_name = String.Format("cyclic_connection_{0}", InstanceNumber);
                            name_change_required = true;
                            break;
                        }
                    }
                }
            }

            if (name_change_required)
            {
                if (!silently)
                {
                    InfoDialog id = new InfoDialog();
                    id.post("Transmitter {0} has been relabled {1}", LabelString, new_name);
                }
                setLabelString(new_name);
            }
            rnl = to.makeClassifiedNodeList(typeof(ReceiverNode), false);
            if (rnl != null)
            {
                foreach (Node n in rnl)
                {
                    ReceiverNode rn = (ReceiverNode)n;
                    if (!rn.IsTransmitterConnected &&
                        rn.LabelString == LabelString)
                    {
                        new Ark(this, 0, rn, 0);
                    }
                }
            }
            base.switchNetwork(from, to, silently);
        }