static void Main(string[] args)
        {
            Console.WriteLine("[enter] to start grid application ...");
            Console.ReadLine();

            // create grid application
            ga = new GApplication(new GConnection("localhost", 9000, "user", "user"));
            ga.ApplicationName = "Alchemi Tutorial - Alchemi sample";

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

            // create and add 10 threads to the application
            for (int i = 0; i < 10; i++)
            {
                // create thread
                MultiplierThread thread = new MultiplierThread(i, i + 1);

                // add thread to application
                ga.Threads.Add(thread);
            }

            // subscribe to events
            ga.ThreadFinish += new GThreadFinish(ThreadFinished);
            ga.ThreadFailed += new GThreadFailed(ThreadFailed);
            ga.ApplicationFinish += new GApplicationFinish(ApplicationFinished);

            // start application
            ga.Start();

            Console.ReadLine();
        }
Exemple #2
0
        public void SetApplicationTestSimpleScenario()
        {
            GApplication application = new GApplication();

            GThread thread = new GThreadMock();

            thread.SetApplication(application);

            Assert.AreSame(application, thread.Application);
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("[enter] to start grid application ....");
            Console.ReadLine();

            // create grid application
            ga = new GApplication(new GConnection("localhost", 80, "user", "user"));
            ga.ApplicationName = "Alchemi Tutorial - Alchemi sample";

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

            System.Console.WriteLine("successfully connected to manager and now going to start thread...");

            string I="Hello";
            while (true)
            {
                flag = false;

                int i;
                for (i = 0; i < 100; i++)
                {
                    System.Console.Write("\nYour Query/You say: ");
                    I = System.Console.ReadLine();

                    //check for break signal
                    if ((I.ToLower() == "quit") || (I.ToLower() == "exit"))
                        break;

                    // create thread
                    MultiplierThread thread = new MultiplierThread(I);

                    // add thread to application
                    ga.Threads.Add(thread);

                }

                // subscribe to events
                ga.ThreadFinish += new GThreadFinish(ThreadFinished);
                ga.ThreadFailed += new GThreadFailed(ThreadFailed);
                ga.ApplicationFinish += new GApplicationFinish(ApplicationFinished);

                // start application
                ga.Start();

                break;
                while (!flag)
                {
                    //do nothing but wait...
                }
            }
            Console.ReadLine();
        }
Exemple #4
0
        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();
        }
        /// <summary>
        /// 
        /// Const.Tor
        /// </summary>
        public eduGRID_botwrapper(string ManIP, int Port)
        {
            // create grid application
            ga = new GApplication(true);
            ga.GConnection = new GConnection(ManIP, Port, "user", "user");
            ga.Connection = new GConnection(ManIP, Port, "user", "user");

            ga.ApplicationName = "eduGRID Bot Client";

            // add GridThread module (this current one!) as a dependency
            ga.Manifest.Add(new ModuleDependency(typeof(eduGRID_Thread).Module));

            // subscribe to events
            ga.ThreadFinish += new GThreadFinish(ThreadFinished);
            ga.ThreadFailed += new GThreadFailed(ThreadFailed);
            //ga.ApplicationFinish += new GApplicationFinish(ApplicationFinished);

            ga.Start();
        }
Exemple #6
0
        static void Main(string[] args)
        {
            Console.WriteLine("Press [enter] to start ...");
            Console.ReadLine();

            try
            {
                ga = new GApplication(GConnection.FromConsole("localhost", "9000", "user", "user"));
                ga.ApplicationName = "Grid Reverser - Alchemi sample";

                ga.ThreadFinish += new GThreadFinish(JobFinished);
                ga.ApplicationFinish += new GApplicationFinish(ApplicationFinished);

                ga.Manifest.Add(new EmbeddedFileDependency("Reverse.exe", @"..\..\..\Reverse\bin\Debug\Reverse.exe"));

                for (int jobNum=0; jobNum<2; jobNum++)
                {
                    GJob job = new GJob();
                    string inputFileName = string.Format("input{0}.txt", jobNum);
                    string outputFileName = string.Format("output{0}.txt", jobNum);

                    job.InputFiles.Add(new EmbeddedFileDependency(inputFileName, @"..\..\" + inputFileName));
                    job.RunCommand = string.Format("Reverse {0} > {1}", inputFileName, outputFileName);
                    job.OutputFiles.Add(new EmbeddedFileDependency(outputFileName));

                    ga.Threads.Add(job);
                }

                ga.Start();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.GetType() + " : " + e.Message);
                Console.ReadLine();
                return;
            }
            Console.WriteLine("Started .. Waiting for jobs to finish ..\n");
            Console.ReadLine();
        }
Exemple #7
0
        private void btn_Start_Click(object sender, EventArgs e)
        {
            try
            {
                // create grid application
                ga = new GApplication(true);
                ga.GConnection = new GConnection(txtIP.Text, int.Parse(txtPort.Text), "user", "user");
                ga.Connection = new GConnection(txtIP.Text, int.Parse(txtPort.Text), "user", "user");

                ga.ApplicationName = "eduGRID Bot Client";

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

                // subscribe to events
                ga.ThreadFinish += new GThreadFinish(ThreadFinished);
                ga.ThreadFailed += new GThreadFailed(ThreadFailed);
                //ga.ApplicationFinish += new GApplicationFinish(ApplicationFinished);

                ga.Start();
                Connect.Visible = false;

                chatgrp.Visible = true;
                chatgrp.BringToFront();
                txt_chat.Focus();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Connection Failure!");
            }
        }
 public void Disconnect()
 {
     if (ga != null)
         ga.Stop();
     ga = null;
 }
Exemple #9
0
 /// <summary>
 /// Sets the application to which this grid thread belongs
 /// </summary>
 /// <param name="application"></param>
 public void SetApplication(GApplication application)
 {
     _Application = application;
 }
        protected override void StartTraining(bool aIsRunning)
        {
            if (aIsRunning)
            {
                mStopWatch = new Stopwatch();
                mStopWatch.Start();

                Stopwatch st = new Stopwatch();
                st.Start();

                min = Double.MaxValue;
                mintest = Double.MaxValue;

                // create grid application
                Settings settings = Settings.LoadSettings();
                GA = new GApplication(new GConnection(settings.AlchemiURL, settings.AlchemiPort, settings.AlchemiUser, settings.AlchemiPassword));
                GA.ApplicationName = "Plain Neural Network model";

                // add GridThread module (this executable) as a dependency
                GA.Manifest.Add(new ModuleDependency(typeof(AForge.PolishExpression).Module));
                GA.Manifest.Add(new ModuleDependency(typeof(AForge.Neuro.ActivationNetwork).Module));
                GA.Manifest.Add(new ModuleDependency(typeof(SingleNNTraining).Module));

                // subscribe to events
                GA.ThreadFinish += new GThreadFinish(ThreadFinished);
                GA.ThreadFailed += new GThreadFailed(ThreadFailed);
                GA.ApplicationFinish += new GApplicationFinish(ApplicationFinished);

                // Набор от данни използван за обучение
                mInput = new double[ExtractEnd - ExtractBegin + 1][];
                mOutput = new double[ExtractEnd - ExtractBegin + 1][];
                // Тестов набор от данни
                mTestInput = new double[TestEnd - TestBegin + 1][];
                mTestOutput = new double[TestEnd - TestBegin + 1][];
                for (int i = 0; i < ExtractEnd - ExtractBegin + 1; i++)
                {
                    mInput[i] = new double[IndependentVariables.Count];
                    mOutput[i] = new double[DependentVariables.Count];
                }

                for (int i = 0; i < TestEnd - TestBegin + 1; i++)
                {
                    mTestInput[i] = new double[IndependentVariables.Count];
                    mTestOutput[i] = new double[DependentVariables.Count];
                }

                MainDataSetTableAdapters.VARIABLESTableAdapter adptVariables = new Plig.TimeSeries.Client.MainDataSetTableAdapters.VARIABLESTableAdapter();

                mReinitializations = Convert.ToInt32(txtReinitializations.Text);
                results = new List<NNResultSet>(mReinitializations);

                mEpochs = Convert.ToInt32(txtEpochs.Text);
                ReinitsFinished = 0;

                int index_of_variable = 0;
                foreach (int variable_id in IndependentVariables.Keys)
                {
                    double minObsValue = adptVariables.MinObservationValue(ExtractBegin, ExtractEnd, variable_id).Value;
                    double factor = 1.7 / (adptVariables.MaxObservationValue(ExtractBegin, ExtractEnd, variable_id).Value - adptVariables.MinObservationValue(ExtractBegin, ExtractEnd, variable_id).Value);
                    Dictionary<int, double?> observations = VariableObservations(variable_id);
                    foreach (int counter in observations.Keys)
                    {
                        if ((counter >= ExtractBegin) && (counter <= ExtractEnd))
                        {
                            mInput[counter - ExtractBegin][index_of_variable] = (observations[counter].Value - minObsValue) * factor - 0.85;
                        }

                        if ((counter >= TestBegin) && (counter <= TestEnd))
                        {
                            mTestInput[counter - TestBegin][index_of_variable] = (observations[counter].Value - minObsValue) * factor - 0.85;
                        }

                    }
                    index_of_variable++;
                }

                index_of_variable = 0;
                foreach (int variable_id in DependentVariables.Keys)
                {
                    double minObsValue = adptVariables.MinObservationValue(ExtractBegin, ExtractEnd, variable_id).Value;
                    double factor = 1.7 / (adptVariables.MaxObservationValue(ExtractBegin, ExtractEnd, variable_id).Value - adptVariables.MinObservationValue(ExtractBegin, ExtractEnd, variable_id).Value);
                    Dictionary<int, double?> observations = VariableObservations(variable_id);
                    foreach (int counter in observations.Keys)
                    {
                        if ((counter >= ExtractBegin) && (counter <= ExtractEnd))
                        {
                            mOutput[counter - ExtractBegin][index_of_variable] = (observations[counter].Value - minObsValue) * factor - 0.85;
                        }

                        if ((counter >= TestBegin) && (counter <= TestEnd))
                        {
                            mTestOutput[counter - TestBegin][index_of_variable] = (observations[counter].Value - minObsValue) * factor - 0.85;
                        }
                    }
                    index_of_variable++;
                }

                double momentum = 0.0;
                double learning_rate = 0.1;

                learning_rate = Convert.ToDouble(txtLearningRate.Text);
                momentum = Convert.ToDouble(txtMomentum.Text);

                int min_neurons = 1;
                int max_neurons = 1;
                if (rbFixedHiddenNeurons.Checked)
                {
                    min_neurons = Convert.ToInt32(txtHiddenNeurons.Text);
                    max_neurons = min_neurons;
                }

                if (rbFlexibleHiddenNeurons.Checked)
                {
                    min_neurons = Convert.ToInt32(txtMinHiddenNeurons.Text);
                    max_neurons = Convert.ToInt32(txtMaxHiddenNeurons.Text);
                }

                int TotalNNCalculations = 0;
                for (int hidden_neurons = min_neurons; hidden_neurons <= max_neurons; hidden_neurons++)
                {

                    for (int i = 0; i < mReinitializations; i++)
                    //              Parallel.For(0, mReinitializations - 1, i =>
                    {
                        // create thread
                        SingleNNTraining single_nn = new SingleNNTraining(mInput, mOutput, mEpochs);
                        single_nn.HiddenNeurons = hidden_neurons;
                        single_nn.Iterations = mEpochs;
                        single_nn.Momentum = momentum;
                        single_nn.LearningRate = learning_rate;

                        // добавяне на набора от данни за тестване
                        single_nn.TestInput = mTestInput;
                        single_nn.TestOutput = mTestOutput;

                        // add thread to application
                        GA.Threads.Add(single_nn);
                        TotalNNCalculations++;
                    }
                    //                );
                }

                pbProgressTraining.Minimum = 0;
                pbProgressTraining.Maximum = TotalNNCalculations - 1;

                GA.Start();

                st.Stop();
                lbResults.Items.Add("Време необходимо за конструиране на данните: " + st.Elapsed.ToString());

                int populationCount = Convert.ToInt32(txtPopulationCount.Text);
                Population population = new Population(populationCount,
                    new DoubleArrayChromosome(new AForge.Math.Random.UniformOneGenerator(),
                        new AForge.Math.Random.GaussianGenerator(0, 1),new AForge.Math.Random.GaussianGenerator(0, 1),
                        (mOutput.Length + mInput.Length + 1) * 10 + mOutput.Length),
                    new NeuralNetworkFitness(mInput, mOutput, new int[] { IndependentVariables.Count, 10, DependentVariables.Count }),
                    new EliteSelection());

                int geneticEpochs = Convert.ToInt32(txtGeneticEpochs.Text);
                pbGeneticProgress.Maximum = geneticEpochs;

                for (int i = 0; i < geneticEpochs; i++)
                {
                    population.RunEpoch();
                    pbGeneticProgress.Value = i + 1;
                    Application.DoEvents();
                }

                NeuralNetworkFitness nnf = new NeuralNetworkFitness(mInput, mOutput, new int[] { IndependentVariables.Count, 5, DependentVariables.Count });
                mBestGeneticActivationNetwork = (ActivationNetwork)nnf.Translate(population.BestChromosome);

            }
            else
            {
                if (GA.Running)
                {
                    foreach (GThread thread in GA.Threads)
                    {
                        thread.Abort();
                    }
            //                     GA.Stop();
                    lbResults.Items.Add("Обучението е прекъснато.");
                }
            }
        }
Exemple #11
0
 /// <summary>
 /// Sets the application to which this grid thread belongs
 /// </summary>
 /// <param name="application"></param>
 public void SetApplication(GApplication application)
 {
     _Application = application;
 }
Exemple #12
0
        private void render_Click(object sender, EventArgs e)
        {
            stop.Enabled = true;
            render.Enabled = !stop.Enabled;

            drawnFirstSegment = false;
            showSplash();

            // model path
            modelPath = paths[modelCombo.SelectedIndex];
            // get width and height from combo box
            imageWidth = Int32.Parse(widthCombo.SelectedItem.ToString());
            imageHeight = Int32.Parse(heightCombo.SelectedItem.ToString());

            // get cols and rows from up downs
            columns = Decimal.ToInt32(columnsUpDown.Value);
            rows = Decimal.ToInt32(rowsUpDown.Value);

            segmentWidth = imageWidth/columns;
            segmentHeight = imageHeight/rows;

            int x = 0;
            int y = 0;

            logger.Debug("WIDTH:"+imageWidth);
            logger.Debug("HEIGHT:"+imageHeight);
            logger.Debug("COLUMNS:"+columns);
            logger.Debug("ROWS:"+rows);
            logger.Debug(""+modelPath);

            // reset the display
            clearImage();

            if (!initted)
            {
                GConnectionDialog gcd = new GConnectionDialog();
                gcd.ShowDialog();

                ga = new GApplication(true);
                ga.ApplicationName = "Alchemi POV-Ray Renderer - Alchemi sample";
                ga.Connection = gcd.Connection;
                ga.ThreadFinish += new GThreadFinish(ga_ThreadFinish);
                ga.ThreadFailed += new GThreadFailed(ga_ThreadFailed);
                ga.ApplicationFinish += new GApplicationFinish(ga_ApplicationFinish);

                ga.Manifest.Add(new ModuleDependency(typeof(RenderThread).Module));

                initted = true;
            }

            if (ga!=null && ga.Running)
            {
                ga.Stop();
            }

            pbar.Maximum = columns*rows;
            pbar.Minimum = 0;
            pbar.Value = 0;
            lbProgress.Text = "Starting to render image ... ";

            for (int col=0; col<columns; col++)
            {
                for (int row=0; row<rows; row++)
                {
                    x = col*segmentWidth;
                    y = row*segmentHeight;

                    int startRowPixel = y + 1;
                    int endRowPixel = y + segmentHeight;
                    int startColPixel = x + 1;
                    int endColPixel = x + segmentWidth;

                    RenderThread rth = new RenderThread(modelPath,
                        imageWidth, imageHeight,
                        segmentWidth, segmentHeight,
                        startRowPixel, endRowPixel,
                        startColPixel, endColPixel,
                        "");

                    rth.BasePath = this.basepath;
                    rth.Col = col+1;
                    rth.Row = row+1;

                    ga.Threads.Add(rth);

                }
            }

            try
            {
                ga.Start();
            }
            catch (Exception ex)
            {
                Console.WriteLine(""+ex.StackTrace);
                MessageBox.Show("Alchemi Rendering Failed!"+ex.ToString());
            }

            lbProgress.Text = "Rendering image ... ";
            ShowBusyGif();
        }
Exemple #13
0
        private void Generate()
        {
            try
            {
                totalHorzMaps = int.Parse(txHorz.Text);
                totalVertMaps = int.Parse(txVert.Text);
            }
            catch
            {
                MessageBox.Show("Invalid value(s) for 'No. Cells'.");
                return;
            }

            if (!initted)
            {
                GConnectionDialog gcd = new GConnectionDialog();
                if (gcd.ShowDialog() == DialogResult.OK)
                {
                    // initialise application
                    ga = new GApplication(true);
                    ga.ApplicationName = "Alchemi Fractal Generator - Alchemi sample";

                    ga.Connection = gcd.Connection;
                }
                else
                {
                    return;
                }

                // set dependencies
                ga.Manifest.Add(new ModuleDependency(typeof(KarlsTools.Complex).Module));
                ga.Manifest.Add(new ModuleDependency(typeof(MandelThread).Module));

                // subscribe to events
                ga.ThreadFinish += new GThreadFinish(UpdateBitmap);
                ga.ApplicationFinish += new GApplicationFinish(AppDone);

                try
                {

                    ga.Start();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.ToString());
                }

                initted = true;
            }

            startTime = DateTime.Now;

            for (int mapNumX=0; mapNumX<totalHorzMaps; mapNumX++)
            {
                for (int mapNumY=0; mapNumY<totalVertMaps; mapNumY++)
                {
                    MandelThread mandel = new MandelThread(
                        mapNumX,
                        mapNumY,
                        width/totalHorzMaps,
                        height/totalVertMaps,
                        xOffset + mapNumX * width/totalHorzMaps,
                        yOffset + mapNumY * height/totalVertMaps,
                        zoom,
                        pbColorOne.BackColor,
                        pbColorTwo.BackColor
                        );
                    //ga.Threads.Add(mandel);
                    ga.StartThread(mandel);
                }
            }

            pb.Minimum = 0;
            pb.Value = 0;
            pb.Maximum = totalHorzMaps * totalVertMaps;
        }
Exemple #14
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (ga != null)
     {
         ga.Stop();
         ga = null;
     }
     FlushOP = false;
     if(OPFlush!=null)
         OPFlush.Join();
 }
        static void Main(string[] args)
        {
            Console.WriteLine("Enter furmula: ");
            var formula = Console.ReadLine();
            var expr = new Expression(formula, new []{ "x"});

            Console.WriteLine("Enter interval [start end]");
            var border_input = Console.ReadLine().Split(' ');
            var start = Convert.ToDouble(border_input[0]);
            var end = Convert.ToDouble(border_input[1]);

            Console.WriteLine("Enter number of threads: ");
            var num_threads = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("[enter] to start grid application ...");
            Console.ReadLine();

            ga = new GApplication(new GConnection("localhost", 9000, "user", "user"));
            ga.ApplicationName = "Integral calculator";

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

            var thread_step = (end - start) / num_threads;
            for (int i = 0; i < num_threads; i++)
            {
                var s = start + i * thread_step;
                var e = start + (i + 1) * thread_step;
                var thread = new IntegralCalculationThread(s, e, expr);

                ga.Threads.Add(thread);
            }

            ga.ThreadFinish += new GThreadFinish(ThreadFinished);
            ga.ThreadFailed += new GThreadFailed(ThreadFailed);
            ga.ApplicationFinish += new GApplicationFinish(ApplicationFinished);

            ga.Start();
            Console.ReadLine();
        }
Exemple #16
0
        static void Main()
        {
            Console.WriteLine("[Pi Calculator Grid Application]\n--------------------------------\n");

            Console.WriteLine("Press <enter> to start ...");
            Console.ReadLine();

            Logger.LogHandler += new LogEventHandler(LogHandler);

            try
            {
                // get the number of digits from the user
                bool numberOfDigitsEntered = false;

                while (!numberOfDigitsEntered)
                {
                    try
                    {
                        NumberOfDigits = Int32.Parse(Utils.ValueFromConsole("Digits to calculate", "100"));

                        if (NumberOfDigits > 0)
                        {
                            numberOfDigitsEntered = true;
                        }
                    }
                    catch (Exception)
                    {
                        Console.WriteLine("Invalid numeric value.");
                        numberOfDigitsEntered = false;
                    }
                }

                // get settings from user
                GConnection gc = GConnection.FromConsole("localhost", "9000", "user", "user");

                StartTiming();

                // create a new grid application
                App = new GApplication(gc);
                App.ApplicationName = "PI Calculator - Alchemi sample";

                // add the module containing PiCalculatorThread to the application manifest
                App.Manifest.Add(new ModuleDependency(typeof(PiCalculatorThread).Module));

                NumThreads = (Int32)Math.Floor((double)NumberOfDigits / DigitsPerThread);
                if (DigitsPerThread * NumThreads < NumberOfDigits)
                {
                    NumThreads++;
                }

                // create and add the required number of grid threads
                for (int i = 0; i < NumThreads; i++)
                {
                    int StartDigitNum = 1 + (i * DigitsPerThread);

                    /// the number of digits for each thread
                    /// Each thread will get DigitsPerThread digits except the last one
                    /// which might get less
                    int DigitsForThisThread = Math.Min(DigitsPerThread, NumberOfDigits - i * DigitsPerThread);

                    Console.WriteLine(
                        "starting a thread to calculate the digits of pi from {0} to {1}",
                        StartDigitNum,
                        StartDigitNum + DigitsForThisThread - 1);

                    PiCalculatorThread thread = new PiCalculatorThread(
                        StartDigitNum,
                        DigitsForThisThread
                        );

                    App.Threads.Add(thread);
                }

                // subcribe to events
                App.ThreadFinish += new GThreadFinish(ThreadFinished);
                App.ApplicationFinish += new GApplicationFinish(ApplicationFinished);

                // start the grid application
                App.Start();

                logger.Debug("PiCalc started.");
            }
            catch (Exception e)
            {
                Console.WriteLine("ERROR: {0}", e.ToString());
            }

            Console.ReadLine();
        }
Exemple #17
0
        private void Connect(object sender, EventArgs e)
        {
            //start the process of connecting...
            try
            {
                // create grid application
                ga = new GApplication(true);
                ga.GConnection = new GConnection(ManagerIP, Port, "user", "user");
                ga.Connection = new GConnection(ManagerIP, Port, "user", "user");

                ga.ApplicationName = "eduGRID Bot Client";

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

                // subscribe to events
                ga.ThreadFinish += new GThreadFinish(ThreadFinished);
                ga.ThreadFailed += new GThreadFailed(ThreadFailed);
                ga.ApplicationFinish += new GApplicationFinish(ApplicationFinished);

                ga.Start();
                connected = true;
                Append_Queryset(Queryset.GetUpperBound(0), "Bot", "Connected. Done!", "", "");
                Refresh_Display();
            }
            catch (Exception ex)
            {
                Append_Queryset(Queryset.GetUpperBound(0), "Bot", "Attempt failed! Disconnected", "Error", (ex.ToString()));
                Refresh_Display();
            }
            finally
            {
                tmr_connect.Enabled = false;
            }
        }