コード例 #1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            //int port;
            //try
            //{
            //    port = int.Parse(txtPort.Text);
            //}
            //catch (System.FormatException)
            //{
            //    MessageBox.Show("Invalid name for 'Port' field.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    return;
            //}

            connection = new GConnection();
            //config.Host = connection.Host = txtHost.Text;
            //config.Port = connection.Port = port;
            config.Username = connection.Username = txtUsername.Text;
            config.Password = connection.Password = txtPassword.Text;
            if (config.EndPointConfig == null)
            {
                config.EndPointConfig = new EndPointConfiguration();
            }
            ucEndPointConfig.WriteEndPointConfiguration(config.EndPointConfig);
            connection.RemoteEP = config.EndPointConfig.GetEndPoint();
            config.Write(Role);

            IManager          mgr;
            EndPointReference mgrEpr = null;

            try
            {
                mgrEpr = GNode.GetRemoteManagerRef(connection.RemoteEP);
                mgr    = (IManager)mgrEpr.Instance;
            }
            catch (RemotingException)
            {
                MessageBox.Show("Could not connect to grid at " + connection.Host + ":" + connection.Port + ".", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                mgr.AuthenticateUser(new SecurityCredentials(config.Username, config.Password));
            }
            catch (AuthenticationException)
            {
                MessageBox.Show("Access denied.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (mgrEpr != null)
            {
                mgrEpr.Dispose();
                mgrEpr = null;
            }

            DialogResult = DialogResult.OK;
        }
コード例 #2
0
        /// <summary>
        /// Constructor that takes the given connection and the thread buffer capacity.
        /// </summary>
        /// <param name="oConnection"></param>
        /// <param name="nThreadBufferCapacity"></param>
        public GApplicationBuffered(GConnection oConnection, int nThreadBufferCapacity) : this(nThreadBufferCapacity)
        {
            if (oConnection == null)
            {
                throw new ArgumentNullException("oConnection");
            }

            Connection = oConnection;
        }
コード例 #3
0
        /// <summary>
        /// Constructor that takes the given connection and the thread buffer capacity.
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="threadBufferCapacity"></param>
        public GApplicationBuffered(GConnection connection, int threadBufferCapacity)
            : this(threadBufferCapacity)
        {
            if (connection == null)
            {
                throw new ArgumentNullException("connection");
            }

            Connection = connection;
        }
コード例 #4
0
        /// <summary>
        /// Constructor that takes the given connection.
        /// </summary>
        /// <param name="connection">connection to alchemi manager</param>
        public GApplicationBuffered(GConnection connection)
            : this(DefaultThreadBufferCapacity)
        {
            if (connection == null)
            {
                throw new ArgumentNullException("connection may not be null");
            }

            Connection = connection;
        }
コード例 #5
0
        /// <summary>
        /// Constructor that takes the given connection and the thread buffer capacity.
        /// </summary>
        /// <param name="oConnection"></param>
        /// <param name="nThreadBufferCapacity"></param>
        public GApplicationBuffered(GConnection oConnection, int nThreadBufferCapacity)
            : this(nThreadBufferCapacity)
        {
            if (oConnection == null)
            {
                throw new ArgumentNullException("oConnection");
            }

            Connection = oConnection;
        }
コード例 #6
0
        /// <summary>
        /// Constructor that takes the given connection and the thread buffer capacity.
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="threadBufferCapacity"></param>
        public GApplicationBuffered(GConnection connection, int threadBufferCapacity)
            : this(threadBufferCapacity)
        {
            if (connection == null)
            {
                throw new ArgumentNullException("connection");
            }

            Connection = connection;
        }
コード例 #7
0
        /// <summary>
        /// Constructor that takes the given connection.
        /// </summary>
        /// <param name="connection">connection to alchemi manager</param>
        public GApplicationBuffered(GConnection connection)
            : this(DefaultThreadBufferCapacity)
        {
            if (connection == null)
            {
                throw new ArgumentNullException("connection may not be null");
            }

            Connection = connection;
        }
コード例 #8
0
ファイル: Tutorial_OTF.cs プロジェクト: JamesTryand/alchemi
        static void Main(string[] args)
        {
            Console.WriteLine("[enter] to start grid application ...");
            Console.ReadLine();

            // create standard grid connection
            GConnection gc = new GConnection("localhost", 9000, "user", "user");

            // create multi-use grid application
            ga = new GApplication(true);
            ga.ApplicationName = "Tutorial OTF - Alchemi sample";

            // use standard grid connection
            ga.Connection = gc;

            // add GridThread module (this executable) as a dependency
            ga.Manifest.Add(new ModuleDependency(typeof(MultiplierThread).Module));

            // set the thread finish callback method
            ga.ThreadFinish += new GThreadFinish(ThreadFinished);

            // start application
            ga.Start();

            int i = -1;
            string input = "";

            while (input != "x")
            {
                i++;
                // create thread
                MultiplierThread thread = new MultiplierThread(i, i + 1);

                // add thread to application
                ga.StartThread(thread);

                Console.WriteLine("[enter] to start a new thread, [x] + [enter] to stop");
                input = Console.ReadLine();
            }

            ga.Stop();

            ApplicationStopped();
            Console.ReadLine();
        }
コード例 #9
0
ファイル: ConsoleNode.cs プロジェクト: abhishek-kumar/AIGA
 public ConsoleNode(GConnection gc)
     : base(gc)
 {
 }
コード例 #10
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            //int port;
            //try
            //{
            //    port = int.Parse(txtPort.Text);
            //}
            //catch (System.FormatException)
            //{
            //    MessageBox.Show("Invalid name for 'Port' field.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    return;
            //}

            connection = new GConnection();
            //config.Host = connection.Host = txtHost.Text;
            //config.Port = connection.Port = port;
            config.Username = connection.Username = txtUsername.Text;
            config.Password = connection.Password = txtPassword.Text;
            if(config.EndPointConfig == null) config.EndPointConfig = new EndPointConfiguration();
            ucEndPointConfig.WriteEndPointConfiguration(config.EndPointConfig);
            connection.RemoteEP = config.EndPointConfig.GetEndPoint();
            config.Write(Role);

            IManager mgr;
            EndPointReference mgrEpr = null;

            try
            {
                mgrEpr = GNode.GetRemoteManagerRef(connection.RemoteEP);
                mgr = (IManager)mgrEpr.Instance;
            }
            catch (RemotingException)
            {
                MessageBox.Show("Could not connect to grid at " + connection.Host + ":" + connection.Port + ".", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                mgr.AuthenticateUser(new SecurityCredentials(config.Username, config.Password));
            }
            catch (AuthenticationException)
            {
                MessageBox.Show("Access denied.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (mgrEpr != null)
            {
                mgrEpr.Dispose();
                mgrEpr = null;
            }

            DialogResult = DialogResult.OK;
        }
コード例 #11
0
 /// <summary>
 /// Creates an instance of the GApplication
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="multiUse">specifies if the GApplication instance is re-usable</param>
 public GApplication(GConnection connection, bool multiUse) : this(connection)
 {
     InitializeComponent();
     _MultiUse = multiUse;
 }
コード例 #12
0
 /// <summary>
 /// Creates an instance of the GApplication
 /// </summary>
 /// <param name="connection"></param>
 public GApplication(GConnection connection) : base(connection)
 {
     InitializeComponent();
 }
コード例 #13
0
ファイル: GApplication.cs プロジェクト: JamesTryand/alchemi
 /// <summary>
 /// Creates an instance of the GApplication
 /// </summary>
 /// <param name="connection"></param>
 public GApplication(GConnection connection)
     : base(connection)
 {
     InitializeComponent();
 }
コード例 #14
0
ファイル: GApplication.cs プロジェクト: JamesTryand/alchemi
 /// <summary>
 /// Creates an instance of the GApplication
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="multiUse">specifies if the GApplication instance is re-usable</param>
 public GApplication(GConnection connection, bool multiUse)
     : this(connection)
 {
     InitializeComponent();
     _MultiUse = multiUse;
 }
コード例 #15
0
        private void btOk_Click(object sender, System.EventArgs e)
        {
            int port;
                try
                {
                    port = int.Parse(txPort.Text);
                }
                catch (System.FormatException)
                {
                    MessageBox.Show("Invalid value for 'Port' field.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                connection = new GConnection();
                config.Host = connection.Host = txHost.Text;
                config.Port = connection.Port = port;
                config.Username = connection.Username = txUsername.Text;
                config.Password = connection.Password = txPassword.Text;
                config.Write();

                IManager mgr;

                try
                {
                    mgr = GNode.GetRemoteManagerRef(new RemoteEndPoint(connection.Host, connection.Port, RemotingMechanism.TcpBinary));
                }
                catch (RemotingException)
                {
                    MessageBox.Show("Could not connect to grid at " + connection.Host + ":" + connection.Port + ".", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                try
                {
                    mgr.AuthenticateUser(new SecurityCredentials(config.Username, config.Password));
                }
                catch (AuthenticationException)
                {
                    MessageBox.Show("Access denied.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                DialogResult = DialogResult.OK;
        }
コード例 #16
0
ファイル: GNode.cs プロジェクト: abhishek-kumar/AIGA
 /// <summary>
 /// Creates a new instance of the GConnection class
 /// </summary>
 /// <param name="connection"></param>
 public GNode(GConnection connection)
 {
     Connection = connection;
     Init();
 }