private void getComputersButton_Click(object sender, EventArgs e)
        {
            computerBindingSource.DataSource = null;
            ConsoleServiceClient client = new ConsoleServiceClient();
            Action but = () => getComputersButton.Enabled = false;

            BeginInvoke(but);

            DateTime started = DateTime.UtcNow;

            client.GetComputersAsync().ContinueWith(task =>
            {
                Action action = () =>
                {
                    computerBindingSource.DataSource = task.Result;
                    getComputersButton.Enabled       = true;
                    elapsedLabel.Text = String.Format("Elapsed: {0}", DateTime.UtcNow - started);
                };

                if (InvokeRequired)
                {
                    BeginInvoke(action);
                }
                ;
            });
        }
 static void Main(string[] args)
 {
     ConsoleServiceClient csr = new ConsoleServiceClient();
     CommandType comm = new CommandType();
     comm.Command = "dir";
     comm.Parameters = "c:\\";
     System.Console.Write(csr.processCommand(comm));
     System.Console.ReadLine();
     //comm = new CommandType();
     //comm.Path = "precomm://";
     //comm.Command = "Processes";
     //System.Console.Write(csr.processCommand(comm));
     //System.Console.ReadLine();
     //comm = new CommandType();
     //comm.Path = "precomm://";
     //comm.Command = "Services";
     //System.Console.Write(csr.processCommand(comm));
     //System.Console.ReadLine();
     //comm = new CommandType();
     //comm.Path = "precomm://";
     //comm.Command = "Networking";
     //System.Console.Write(csr.processCommand(comm));
     //System.Console.ReadLine();
     //comm = new CommandType();
     //comm.Path = "precomm://";
     //comm.Command = "Performance";
     //System.Console.Write(csr.processCommand(comm));
     //System.Console.ReadLine();
 }
        private void getComputersButton_Click( object sender, EventArgs e )
        {
            computerBindingSource.DataSource = null;
            ConsoleServiceClient client = new ConsoleServiceClient();
            Action but = () => getComputersButton.Enabled = false;
            BeginInvoke( but );

            DateTime started = DateTime.UtcNow;
            client.GetComputersAsync().ContinueWith( task =>
            {
                Action action = () =>
                {
                    computerBindingSource.DataSource = task.Result;
                    getComputersButton.Enabled = true;
                    elapsedLabel.Text = String.Format( "Elapsed: {0}", DateTime.UtcNow - started );
                };

                if( InvokeRequired ) { BeginInvoke( action ); };
            } );
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     csr = new ConsoleServiceClient();
 }