private void RefreshLists()
        {
            // get connection lists
            MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager();

            if (commandServer == null)
            {
                return;
            }

            this.slaveList  = commandServer.GetRegisteredSlaves();
            this.clientList = commandServer.GetRegisteredClients();
            this.editorList = commandServer.GetRegisteredEditors();
            this.serverList = new ArrayList();

            // build server's "command"
            MOG_Command command = new MOG_Command();

            command.SetComputerName(MOG_ControllerSystem.GetComputerName());
            command.SetComputerIP(MOG_ControllerSystem.GetComputerIP());
            command.SetNetworkID(1);
            command.SetCommandType(0);
            command.SetDescription("");
            this.serverList.Add(command);
        }
Esempio n. 2
0
        public void DisplayUpdateExistingConnections()
        {
            //first let's kill the existing ones.
            foreach (ListViewItem item in mainForm.lviewMonitor.Items)
            {
                mainForm.lviewMonitor.Items.Remove(item);
            }

            //this needs to walk the connections and add all the connected computers.
            MOG_CommandServerCS commandServer = (MOG_CommandServerCS)MOG_ControllerSystem.GetCommandManager();

            if (commandServer == null)
            {
                return;
            }

            ArrayList slavesArray  = new ArrayList(commandServer.GetRegisteredSlaves());
            ArrayList clientsArray = new ArrayList(commandServer.GetRegisteredClients());
            ArrayList editorsArray = new ArrayList(commandServer.GetRegisteredEditors());

            //show the server first.
            DislayAddConnection(MOG_ControllerSystem.GetComputerName(), MOG_ControllerSystem.GetComputerIP(), 1, 0, "");

            foreach (Object item in clientsArray)
            {
                MOG_Command connection = (MOG_Command)item;

                // Describe the current command of this connection
                string description = FilterDesiredCommand(connection);
                if (description != null)
                {
                    DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterClient, description);
                }
            }

            foreach (Object item in editorsArray)
            {
                MOG_Command connection = (MOG_Command)item;

                // Describe the current command of this connection
                string description = FilterDesiredCommand(connection);
                if (description != null)
                {
                    DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterEditor, description);
                }
            }

            foreach (Object item in slavesArray)
            {
                MOG_Command connection = (MOG_Command)item;
                string      description;

                // Check if this Slave is actively assigned anything?
                MOG_Command workingCommand = connection.GetCommand();
                if (workingCommand == null)
                {
                    // Describe the current command of this connection
                    description = FilterDesiredCommand(connection);
                }
                else
                {
                    // Describe the current command of this connection's command
                    description = FilterDesiredCommand(workingCommand);
                }

                if (description != null)
                {
                    DislayAddConnection(connection.GetComputerName(), connection.GetComputerIP(), connection.GetNetworkID(), MOG_COMMAND_TYPE.MOG_COMMAND_RegisterSlave, description);
                }
            }
        }