示例#1
0
        private void thisFunctionNeverGetsCalled(ServerCommunicator temp)
        {
            // The purpose of this function is to be found by perplexed programmers
            // who have attempted to search for references to ServerCommunicator methods.

            // The reason this is necessary is that there are NO direct calls made to any ServerCommunicator
            // methods. There is an added layer of complexity which was added to allow for better performance.

            // The added complexity is that instead of just calling methods on ServerCommunicator, I am instead
            // calling them from the function InvokeMethodOnServer_Proc, run in its own thread. This allows me
            // to kill or cancel the call to ServerCommunicator if it times out, due for instance to a network
            // disconnection or a server shutting down.

            // As a result of this, and in order to make the InvokeMethodOnServer_Proc function more general purpose,
            // there are no direct calls to ServerCommunicator functions. Instead, they are referenced by name
            // through the .NET reflection MethodInfo class. To see how this works, look at the function
            // setSettingsOnConnectedServers and work your way down.

            // Should you need to add new methods to ServerCommunicator, and thus corresponding new
            // methods to ServerManager, it should be straightforward to copy the technique I used.

            // Alas, this is a bit confusing and not particularly transparent, which is why I have
            // created this note.

            // -- Aviv Keshet

            temp.armTasks(0);
            temp.generateBuffers(0);
            temp.generateTrigger();
            temp.getHardwareChannels();
            temp.getServerName();
            temp.getServerSettings();
            temp.nextRunTimeStamp(DateTime.Now);
            temp.outputGPIBGroup(null, null);
            temp.outputRS232Group(null, null);
            temp.outputSingleTimestep(null, null);
            temp.ping();
            temp.runSuccess();
            temp.setSequence(null);
            temp.setSettings(null);
            temp.stop();
        }
        private static void ping_server_proc(object obj)
        {
            bool success            = false;
            ServerCommunicator comm = (ServerCommunicator)obj;

            while (!success)
            {
                try
                {
                    comm.ping();
                    success = true;
                }
                catch (Exception e)
                {   //If the user is trying to exit then we should let them. Otherwise, continue looping.
                    if (e.ToString() == "Thread was being aborted.")
                    {
                        success = true;
                    }
                }
            }
        }
        private void thisFunctionNeverGetsCalled(ServerCommunicator temp)
        {
            // The purpose of this function is to be found by perplexed programmers
            // who have attempted to search for references to ServerCommunicator methods.

            // The reason this is necessary is that there are NO direct calls made to any ServerCommunicator
            // methods. There is an added layer of complexity which was added to allow for better performance.

            // The added complexity is that instead of just calling methods on ServerCommunicator, I am instead
            // calling them from the function InvokeMethodOnServer_Proc, run in its own thread. This allows me
            // to kill or cancel the call to ServerCommunicator if it times out, due for instance to a network
            // disconnection or a server shutting down.

            // As a result of this, and in order to make the InvokeMethodOnServer_Proc function more general purpose,
            // there are no direct calls to ServerCommunicator functions. Instead, they are referenced by name
            // through the .NET reflection MethodInfo class. To see how this works, look at the function
            // setSettingsOnConnectedServers and work your way down.

            // Should you need to add new methods to ServerCommunicator, and thus corresponding new
            // methods to ServerManager, it should be straightforward to copy the technique I used.

            // Alas, this is a bit confusing and not particularly transparent, which is why I have
            // created this note.

            // -- Aviv Keshet

            temp.armTasks(0);
            temp.generateBuffers(0);
            temp.generateTrigger();
            temp.getHardwareChannels();
            temp.getServerName();
            temp.getServerSettings();
            temp.nextRunTimeStamp(DateTime.Now);
            temp.outputGPIBGroup(null, null);
            temp.outputRS232Group(null, null);
            temp.outputSingleTimestep(null, null);
            temp.ping();
            temp.runSuccess();
            temp.setSequence(null);
            temp.setSettings(null);
            temp.stop();
        }
示例#4
0
        private static void ping_server_proc(object obj)
        {
            ServerCommunicator comm = (ServerCommunicator)obj;

            comm.ping();
        }