Пример #1
0
 private void ra1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         ra2.Focus();
     }
 }
Пример #2
0
 private void m_txtREGISTERTYPENO_VCHR_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         ra1.Focus();
     }
 }
Пример #3
0
        private void cbServer_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            string sLogin = string.Empty;

            if (cbServer.SelectedItem != null)
            {
                sLogin = ((SqlLogin)cbServer.SelectedItem).Login;
            }

            if (sLogin == string.Empty)
            {
                rbAuthNT.Checked = true;
                txtLogin.Clear();
                txtPassword.Clear();
                rbAuthNT.Focus();
            }
            else
            {
                rbAuthSQL.Checked = true;
                txtLogin.Text     = sLogin;
                txtPassword.Clear();
                rbAuthSQL.Focus();
            }
        }
Пример #4
0
 private void frmBeforeAnaSummary_Load(object sender, System.EventArgs e)
 {
     m_rdbA1.Focus();
 }
Пример #5
0
        private void GetPoll()
        {
            pollGroupBox.Controls.Clear();
            selectedChoice = -1;

            Label lblTopText = new Label();
            Label lblTopText2 = new Label();
            Label lblTopText3 = new Label();
            lblTopText.Name = "lblTopText";
            lblTopText.Text = "Poll #" + (currentPoll + 1);
            lblTopText.Location = new System.Drawing.Point(10, 15);
            lblTopText.Width = pollGroupBox.Width;
            lblTopText.TextAlign = ContentAlignment.MiddleLeft;
            lblTopText.ForeColor = Color.Brown;
            lblTopText.Font = new Font("Times New Roman", 11, FontStyle.Bold);
            lblTopText.Height = 17;
            pollGroupBox.Controls.Add(lblTopText);
            lblTopText2.Name = "lblTopText2";
            lblTopText2.Text = "Name: " + survey.Polls[currentPoll].Name;
            lblTopText2.Location = new System.Drawing.Point( 10, lblTopText.Top + lblTopText.Height );
            lblTopText2.Width = pollGroupBox.Width;
            lblTopText2.TextAlign = ContentAlignment.MiddleLeft;
            lblTopText2.ForeColor = Color.Green;
            lblTopText2.Font = new Font("Times New Roman", 11);
            lblTopText2.Height = 17;
            pollGroupBox.Controls.Add(lblTopText2);
            lblTopText3.Name = "lblTopText3";
            lblTopText3.Text = StringWorkHelper.WrapString("Description: " + survey.Polls[currentPoll].Description,65);
            lblTopText3.Location = new System.Drawing.Point( 10, lblTopText2.Top + lblTopText2.Height );
            lblTopText3.Width = pollGroupBox.Width;
            lblTopText3.TextAlign = ContentAlignment.MiddleLeft;
            lblTopText3.ForeColor = Color.Green;
            lblTopText3.Font = new Font("Times New Roman", 11);
            lblTopText3.AutoSize = true;
            pollGroupBox.Controls.Add(lblTopText3);

            int index = 0;
            foreach (Choice curChoice in survey.Polls[currentPoll].Choices)
            {
                index++;

                RadioButton radioButton = new RadioButton();
                radioButton.Name = index.ToString();
                radioButton.Text = index.ToString() + ". " + curChoice.choice;
                radioButton.Width = 300;
                radioButton.Location = new System.Drawing.Point(10, lblTopText3.Top + lblTopText3.Height + 20 * (index - 1));
                radioButton.CheckedChanged += delegate(Object sender2, EventArgs e2)
                {
                    selectedChoice = Convert.ToInt32(((RadioButton)sender2).Name) - 1;
                };
                pollGroupBox.Controls.Add(radioButton);

                if ( index == 1 )
                    radioButton.Focus();
            }

            TextBox customChoiceBox = new TextBox();
            if (!(survey.TestMode) && (survey.Polls[currentPoll].CustomChoiceEnabled))
            {
                index++;
                RadioButton radioButton = new RadioButton();
                radioButton.Name = index.ToString();
                radioButton.Text = index.ToString() + ". " + "Other choice:";
                radioButton.Location = new System.Drawing.Point(10, lblTopText3.Top + lblTopText3.Height + 20 * (index - 1));
                radioButton.CheckedChanged += delegate(Object sender2, EventArgs e2)
                {
                    selectedChoice = Convert.ToInt32(((RadioButton)sender2).Name) - 1;
                };
                customChoiceBox.Name = "customChoiceBox";
                customChoiceBox.Text = String.Empty;
                customChoiceBox.Location = new System.Drawing.Point(radioButton.Left + radioButton.Width + 10, lblTopText3.Top + lblTopText3.Height + 20 * (index - 1));
                customChoiceBox.Width = 200;
                pollGroupBox.Controls.Add(radioButton);
                pollGroupBox.Controls.Add(customChoiceBox);
            }

            Button btnSubmit = new Button();
            btnSubmit.Name = "btnSubmit";
            btnSubmit.Text = "Next";
            btnSubmit.TextAlign = ContentAlignment.MiddleLeft;
            btnSubmit.Image = Ilsrep.PollApplication.PollClientGUI.Properties.Resources.bullet_go;
            btnSubmit.ImageAlign = ContentAlignment.MiddleRight;
            btnSubmit.Padding = new Padding(11, 0, 11, 0);
            btnSubmit.Location = new System.Drawing.Point(this.pollGroupBox.Width - btnSubmit.Width-10, lblTopText3.Top + lblTopText.Height + 20 * (index + 1));
            btnSubmit.Click += delegate
            {
                if (selectedChoice == -1)
                {
                    MessageBox.Show("Select a choice", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                if (!(survey.TestMode) && (survey.Polls[currentPoll-1].CustomChoiceEnabled))
                {
                    customChoice = customChoiceBox.Text;
                }

                ProcessResult();
                if (currentPoll < survey.Polls.Count)
                {
                    GetPoll();
                }
                else
                {
                    ProcessResults();
                }
            };
            pollGroupBox.Controls.Add(btnSubmit);
            this.AcceptButton = btnSubmit;

            currentPoll++;
        }
Пример #6
0
        private void ConnectNow_Click(object sender, System.EventArgs e)
        {
            switch (windowState)
            {
            case ConnectionWindowState.NotConnected:
            {
                if (ServerAddress.Text == "")
                {
                    ServerAddress.Focus();
                    MessageBox.Show("You must enter a server.");
                    return;
                }
                if (PortNumber.Text == "")
                {
                    PortNumber.Focus();
                    MessageBox.Show("You must enter a port.");
                    return;
                }
                if (Email.Text == "")
                {
                    Email.Focus();
                    MessageBox.Show("You must enter an e-mail.");
                    return;
                }
                if ((!NetworkProtocolTypeTCP.Checked) &&
                    (!NetworkProtocolTypeUDP.Checked))
                {
                    NetworkProtocolTypeTCP.Focus();
                    MessageBox.Show("You must select a protocol type.");
                    return;
                }
                Strive.Network.Messages.NetworkProtocolType protocol;
                if (NetworkProtocolTypeTCP.Checked)
                {
                    protocol = Strive.Network.Messages.NetworkProtocolType.TcpOnly;
                }
                else
                {
                    protocol = Strive.Network.Messages.NetworkProtocolType.UdpAndTcp;
                }

                Settings.SettingsManager.AddRecentServer(ServerAddress.Text,
                                                         int.Parse(PortNumber.Text),
                                                         protocol);
                Settings.SettingsManager.AddRecentPlayer(ServerAddress.Text, int.Parse(PortNumber.Text), protocol, Email.Text, Password.Text);

                // TODO: is this teh ghey? might flicker
                loadRecentServers();

                StriveWindowState = ConnectionWindowState.Connecting;
                Application.DoEvents();

                ConnectionProgress.Visible = true;
                ConnectionProgress.Value   = 0;
                timer1.Start();
                Game.Play(ServerAddress.Text, Email.Text, Password.Text, int.Parse(PortNumber.Text), protocol, Game.CurrentMainWindow.RenderTarget);
                break;
            }

            case ConnectionWindowState.Connecting:
            case ConnectionWindowState.Connected:
            case ConnectionWindowState.Playing:
            {
                // disconnect:
                Game.CurrentServerConnection.Logout();
                StriveWindowState = ConnectionWindowState.NotConnected;
                Game.Stop();
                break;
            }
            }
        }