Пример #1
0
 public void disconnectFromApplication(bool terminate)
 {
     if (applicationPacket != null)
     {
         applicationPacket = null;
     }
     if (terminate)
         shutdownApplication();
 }
Пример #2
0
        public DXApplication(String s)
            : base(s)
        {
            theDXApplication = this;
            anchor = null;
            serverDisconnectScheduled = false;
            network = null;

            // Create the local command scope.
            commandScope = new CommandScope();

            // Initialize the packet interface.
            serverInfo.packet = null;
            applicationPacket = null;
            messageWindow = null;

            genericHelpCmd = new HelpMenuCommand("genericAppHelp",
                null, true, HelpMenuCommand.HelpType.GenericHelp);
            helpTutorialCmd = new HelpMenuCommand("helpTutorial",
                null, true, HelpMenuCommand.HelpType.HelpTutorial);

            quitCmd = new ConfirmedQuitCommand("quit", commandScope,
                true, this);
            exitCmd = new ConfirmedExitCommand("exit", commandScope,
                true, this);
            openFileCmd = new OpenCommand("open", commandScope,
                true, this);
            messageWindowCmd = new NoUndoDXAppCommand("messageWindowCmd",
                commandScope, true, this, CommandType.OpenMessageWindow);

            openSequencerCmd = new NoUndoDXAppCommand("openSequencerCmd",
                commandScope, false, this, CommandType.OpenSequencer);
            openAllColormapCmd = new NoUndoDXAppCommand("openAllColormapCmd",
                commandScope, false, this, CommandType.OpenAllColormaps);
            loadMacroCmd = new NoUndoDXAppCommand("Load Macro Command",
                commandScope, true, this, CommandType.LoadMacro);
            executeOnceCmd = new NoUndoDXAppCommand("Execute Once",
                commandScope, false, this, CommandType.ExecuteOnce);
            executeOnChangeCmd = new NoUndoDXAppCommand("Execute On Change",
                commandScope, false, this, CommandType.ExecuteOnChange);
            endExecutionCmd = new NoUndoDXAppCommand("End Execution",
                commandScope, false, this, CommandType.EndExecution);
            connectedToServerCmd = new NoOpCommand("Connected To Server",
                commandScope, true);
            disconnectedFromServerCmd = new NoOpCommand("Disconnected From Server",
                commandScope, true);
            executingCmd = new NoOpCommand("executingCmd", commandScope, true);
            notExecutingCmd = new NoOpCommand("notExecutingCmd", commandScope, true);
            connectToServerCmd = new NoUndoDXAppCommand("Start Server",
                commandScope, true, this, CommandType.StartServer);
            resetServerCmd = new NoUndoDXAppCommand("Reset Server",
                commandScope, false, this, CommandType.ResetServer);
            disconnectFromServerCmd = new DisconnectFromServerCommand("disconnectFromServer",
                commandScope, false);
            loadMDFCmd = new NoUndoDXAppCommand("Load MDF...",
                commandScope, true, this, CommandType.LoadUserMDF);
            toggleInfoEnable = new NoUndoDXAppCommand("Enable Information",
                commandScope, true, this, CommandType.ToggleInfoEnabled);
            toggleWarningEnable = new NoUndoDXAppCommand("Enable Warnings",
                commandScope, true, this, CommandType.ToggleWarningEnabled);
            toggleErrorEnable = new NoUndoDXAppCommand("Enable Errors",
                commandScope, true, this, CommandType.ToggleErrorEnabled);
            assignProcessGroupCmd = new NoUndoDXAppCommand("assignProcessGroup",
                commandScope, true, this, CommandType.AssignProcessGroup);

            connectedToServerCmd.autoActivate(executeOnceCmd);
            connectedToServerCmd.autoActivate(executeOnChangeCmd);
            connectedToServerCmd.autoActivate(endExecutionCmd);
            connectedToServerCmd.autoActivate(disconnectedFromServerCmd);
            connectedToServerCmd.autoActivate(resetServerCmd);
            connectedToServerCmd.autoActivate(connectedToServerCmd);

            disconnectedFromServerCmd.autoActivate(connectedToServerCmd);
            disconnectedFromServerCmd.autoActivate(executeOnceCmd);
            disconnectedFromServerCmd.autoActivate(executeOnChangeCmd);
            disconnectedFromServerCmd.autoActivate(endExecutionCmd);
            disconnectedFromServerCmd.autoActivate(disconnectedFromServerCmd);
            disconnectedFromServerCmd.autoActivate(resetServerCmd);

            //
            // Once in execute on change don't allow it again until the user
            // does an endExecutionCmd
            //
            executeOnChangeCmd.autoDeactivate(executeOnChangeCmd);
            endExecutionCmd.autoActivate(executeOnChangeCmd);
            openFileCmd.autoActivate(executeOnChangeCmd);

            //
            // Set the automatic activation of any commands that depend on whether
            // or not we are currently executing.
            //
            executingCmd.autoDeactivate(openFileCmd);
            notExecutingCmd.autoActivate(openFileCmd);
            executingCmd.autoDeactivate(executeOnceCmd);
            notExecutingCmd.autoActivate(executeOnceCmd);

            //
            // Don't allow execute on change during an execute once.
            //
            executeOnceCmd.autoDeactivate(executeOnChangeCmd);
            notExecutingCmd.autoActivate(executeOnChangeCmd);

            NDAllocatorDictionary.theNDAllocatorDictionary = new NDAllocatorDictionary();

            readFirstNetwork = false;
        }