Пример #1
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            //pre - start
            lblStatus.Text = "Initializing...";
            panel_Login.Visible = true;
            panel_Login.Refresh();

            //start login process

            lblStatus.Text = "Connecting to bot manager...";
            panel_Login.Refresh();
            //currently proceeding with ip and port as uname and pwd
            //TODO: add ref to webservice, connect and get info of ip and port

            #region connect to bot manager
            string ManagerIP = "localhost";
            long ManagerPort = 81;
            if (txtUName.Text.Trim() != "")
                ManagerIP = txtUName.Text.Trim();
            if (txtPsswd.Text.Trim() != "")
                ManagerPort = int.Parse(txtPsswd.Text.Trim());
            try
            {
                if (Program.eduGRIDBOT == null)
                    Program.eduGRIDBOT = new eduGRID_botwrapper(ManagerIP, (int)ManagerPort);

            }
            catch (Exception ex)
            {
                try
                {
                    Initialize_HelpBot();
                    //show the helperbot
                    panel_Login.Visible = false;
                    txtHelp.AppendText(Environment.NewLine + ":: HelperBot: You seem to be having problems in connecting to the Bot Manager");
                    txtHelp.AppendText(Environment.NewLine + ":: HelperBot: " + Helperbot.Query("I have a Problem connecting to the Bot Manager" + Environment.NewLine));
                    txtHelp.ScrollToCaret();
                    txtHelp.Refresh();
                    panel_Help.Visible = true;
                    txtHelp.Refresh();
                    return;

                }
                catch(Exception exx)
                {
                    MessageBox.Show("Error while connecting!");
                    return;
                }
            }

            #endregion

            //TODO: connect to other managers
            lblStatus.Text = "Connecting to other managers...";
            panel_Login.Refresh();

            //Initialize second form
            lblStatus.Text = "Initializing...";
            panel_Login.Refresh();
            FormCompact F = new FormCompact();

            //end login process

            //successfull login...transfer to the main form
            panel_Login.Visible = false;
            this.Hide();
            F.Location = new Point(this.Location.X, this.Location.Y);
            F.Show();
            F.Location = new Point(this.Location.X, this.Location.Y);
            F.Refresh();
        }
Пример #2
0
        private void btn_Login_Click(object sender, EventArgs e)
        {
            //pre - start
            lblStatus.Text      = "Initializing...";
            panel_Login.Visible = true;
            panel_Login.Refresh();

            //start login process

            lblStatus.Text = "Connecting to bot manager...";
            panel_Login.Refresh();
            //currently proceeding with ip and port as uname and pwd
            //TODO: add ref to webservice, connect and get info of ip and port

            #region connect to bot manager
            string ManagerIP   = "localhost";
            long   ManagerPort = 81;
            if (txtUName.Text.Trim() != "")
            {
                ManagerIP = txtUName.Text.Trim();
            }
            if (txtPsswd.Text.Trim() != "")
            {
                ManagerPort = int.Parse(txtPsswd.Text.Trim());
            }
            try
            {
                if (Program.eduGRIDBOT == null)
                {
                    Program.eduGRIDBOT = new eduGRID_botwrapper(ManagerIP, (int)ManagerPort);
                }
            }
            catch (Exception ex)
            {
                try
                {
                    Initialize_HelpBot();
                    //show the helperbot
                    panel_Login.Visible = false;
                    txtHelp.AppendText(Environment.NewLine + ":: HelperBot: You seem to be having problems in connecting to the Bot Manager");
                    txtHelp.AppendText(Environment.NewLine + ":: HelperBot: " + Helperbot.Query("I have a Problem connecting to the Bot Manager" + Environment.NewLine));
                    txtHelp.ScrollToCaret();
                    txtHelp.Refresh();
                    panel_Help.Visible = true;
                    txtHelp.Refresh();
                    return;
                }
                catch (Exception exx)
                {
                    MessageBox.Show("Error while connecting!");
                    return;
                }
            }


            #endregion

            //TODO: connect to other managers
            lblStatus.Text = "Connecting to other managers...";
            panel_Login.Refresh();

            //Initialize second form
            lblStatus.Text = "Initializing...";
            panel_Login.Refresh();
            FormCompact F = new FormCompact();


            //end login process

            //successfull login...transfer to the main form
            panel_Login.Visible = false;
            this.Hide();
            F.Location = new Point(this.Location.X, this.Location.Y);
            F.Show();
            F.Location = new Point(this.Location.X, this.Location.Y);
            F.Refresh();
        }