예제 #1
0
        private void buttonConnect_Click(object sender, EventArgs e)
        {
            if (textBoxLogin.Text == "" || textBoxPassw.Text == "")
            {
                new FormError("Заполните поля");
                return;
            }

            if (checkBoxSaveLP.Checked)
            {
                FileStream fs = new FileStream(@"Config/lastLogin.cfg", FileMode.Create);
                using (StreamWriter sw = new StreamWriter(fs))
                {
                    sw.WriteLine(Crypt.EncryptStringToBytes(textBoxLogin.Text, myTripleDES.Key, myTripleDES.IV));
                    sw.WriteLine(Crypt.EncryptStringToBytes(textBoxPassw.Text, myTripleDES.Key, myTripleDES.IV));
                    sw.WriteLine(Crypt.EncryptStringToBytes(textBox1server.Text, myTripleDES.Key, myTripleDES.IV));
                }
            }

               // try
            {
                //тут пойдет подключение
                svc = new pingInterClient("BasicHttpBinding_pingInter", textBox1server.Text);
                int[] res = login();
                if (res[1] == -1) throw new Exception("Авторизация не удалась");
                Program.fm = new FormMain(res[1], svc, res[0]);
                this.Hide();
                Program.fm.ShowDialog();
            }
            //catch(Exception ex)
            {
            //    new FormError(ex.Message);
            }
            this.Close();
        }
예제 #2
0
 public FormMain(int root, pingInterClient pi, int id)
 {
     InitializeComponent();
     this.svc = pi;
     this.root = root;
     this.consId = id;
     this.Text = "Ваш номер: " + consId.ToString();
     tempQid = -1;
 }
예제 #3
0
        public FormDataGrid(string[]columns, string header, object request, string addHeader, pingInterClient svc)
        {
            InitializeComponent();
            this.request = request;
            this.svc = svc;
            this.addHeader = addHeader;
            label1.Text = header;

            dataGridView2.ColumnCount = dataGridView1.ColumnCount = columns.GetLength(0);
            for (int i = 0; i < columns.GetLength(0); i++)
            {
                dataGridView1.Columns[i].HeaderText = columns[i];
            }
            dataGridView2.RowCount = 1;
            load();
        }