Beispiel #1
0
        private void FrmConfiguration_Load(object sender, EventArgs e)
        {
            string clientID = GetConfiguration.GetConfigurationValueClientID();

            if (!string.IsNullOrEmpty(clientID.Trim()))
            {
                try
                {
                    string[] clientidArr = clientID.Split('-');
                    textBox1.Text = clientidArr[0];
                    textBox2.Text = clientidArr[1];
                    textBox3.Text = clientidArr[2];
                    textBox4.Text = clientidArr[3];
                    textBox5.Text = clientidArr[4];
                }
                catch
                {
                    //assume no client id
                }
            }

            servRef.Endpoint.Binding.SendTimeout = new TimeSpan(0, 30, 0);
            if (string.IsNullOrEmpty(textBox1.Text.Trim()))
            {
                textBox1.Select();
            }
            else
            {
                maskedTextBox1.Select();
            }
        }
Beispiel #2
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            clientID = string.Empty;
            secret   = maskedTextBox1.Text.Trim();
            LoggedIn = false;

            if (tableLayoutPanel2.Visible == true)
            {
                string clientConfig1 = textBox1.Text.Replace("-", "").Trim().Replace(" ", "");
                string clientConfig2 = textBox2.Text.Replace("-", "").Trim().Replace(" ", "");
                string clientConfig3 = textBox3.Text.Replace("-", "").Trim().Replace(" ", "");
                string clientConfig4 = textBox4.Text.Replace("-", "").Trim().Replace(" ", "");
                string clientConfig5 = textBox5.Text.Replace("-", "").Trim().Replace(" ", "");

                clientID = clientConfig1 + "-" + clientConfig2 + "-" + clientConfig3 + "-" + clientConfig4 + "-" + clientConfig5;
                GetConfiguration.ConfigurationValueClientID(clientID);
            }
            else
            {
                clientID = GetConfiguration.GetConfigurationValueClientID();
            }

            string login = string.Empty;

            TimeOut = false;
            try
            {
                login = servRef.CheckKeyInfo(clientID, secret);
            }
            catch (Exception exe)
            {
                MessageBox.Show(exe.ToString());
                TimeOut = true;
                return;
            }
            if (login.ToUpper().Trim().Equals("SUCCESS"))
            {
                LoggedIn = true;
            }
            else
            {
                LoggedIn = false;
            }
        }