示例#1
0
        public void Run()
        {
            try
            {
                clientForm = new ClientForm(this);

                Thread tcpThread = new Thread(() => { TcpProcessServerResponse(); });
                tcpThread.Start();

                Thread udpThread = new Thread(() => { UdpProcessServerResponse(); });
                udpThread.Start();

                TcpSendMessage(new LoginPacket((IPEndPoint)udpClient.Client.LocalEndPoint, PublicKey));

                clientForm.ShowDialog();
            }
            catch (Exception exception)
            {
                Console.WriteLine("Client Run Exception: " + exception.Message);
            }
            finally
            {
                tcpClient.Close();
                udpClient.Close();
            }
        }
示例#2
0
        public Form_Main()
        {
            InitializeComponent();

            TestClient client = new TestClient();

            client.Strart();
            ClientForm clientForm = new ClientForm();

            if (clientForm.ShowDialog() == DialogResult.OK)
            {
                var login = clientForm.textBox1.Text;
                var pwd   = clientForm.textBox2.Text;
                user = client.Login(login, pwd);
                if (user.Id == -1)
                {
                    MessageBox.Show("Access denied");
                    Load += (s, e) => Close();
                    return;
                }
                tests = user.Groups.SelectMany(g => g.Tests).ToList();
                dataGridView1.DataSource = tests
                                           .Select(x => new { Id = x.Id, Title = x.Title, Author = x.Author, DtCreate = x.DtCreate })
                                           .ToList();
            }
        }
示例#3
0
        public void Run()
        {
            clientForm = new ClientForm(this);
            Thread thread = new Thread(() => { ProcessServerResponce(); });

            thread.Start();
            clientForm.ShowDialog();
            tcpClient.Close();
        }
示例#4
0
        private void ReceiveAnswer(Socket serverSocket)
        {
            byte[] buffer = new byte[10];
            serverSocket.Receive(buffer);
            string message = Encoding.UTF8.GetString(buffer).Replace("\0", string.Empty);

            if (message.Equals("Enter"))
            {
                ClientForm form = new ClientForm(serverSocket);
                form.ShowDialog();
            }
        }
        public void Run()
        {
            m_clientForm = new ClientForm(this);

            Thread tcpThread = new Thread(() => { TcpProcessServerResponse(); });

            tcpThread.Start();

            //Thread udpThread = new Thread(() => { UdpProcessServerResponse(); });
            //udpThread.Start();
            //Login(); //TODO FIX

            m_clientForm.ShowDialog();
        }
        //TCP FUNCTIONALITY

        public void Run()
        {
            _clientForm = new ClientForm(this);

            //start TCP thread for recieving packets
            _tcpThread = new Thread(() => { TCPProcessServerResponse(); });
            _tcpThread.Start();

            _udpThread = new Thread(() => { UDPProcessServerResponse(); });
            _udpThread.Start();

            Login();

            _clientForm.ShowDialog(); //show window
        }
示例#7
0
文件: LoginForm.cs 项目: vgamula/Lana
        private void loginButton_Click(object sender, EventArgs e)
        {
            using (var db = new DatabaseEntities())
            {
                String username = textBoxUsername.Text;
                String password = Utils.GetMD5Hash(textBoxPassword.Text);

                String message = String.Empty;
                Boolean isGood = true;

                var result = db.Users.FirstOrDefault(t => t.Username == username);

                if (result == null)
                {
                    message = String.Format("There is no user with username {0}!", username);
                    isGood = false;
                }
                else
                {
                    if (result.Password != password)
                    {
                        message = "Password is wrong!";
                        isGood = false;
                    }
                }

                if (!isGood)
                {
                    MessageBox.Show(message);
                    return;
                }
                Form form = null;
                switch (result.Access)
                {
                    case 0:
                        form = new AdminForm();
                        break;
                    case 1:
                        form = new ClientForm(result);
                        break;
                    default:
                        break;
                }
                if (form != null)
                {
                    this.Hide();
                    form.ShowDialog();
                    this.Show();
                }
            }
        }
示例#8
0
        static void Main(string[] args)
        {
            Form f = new ClientForm();

            f.ShowDialog();
        }
示例#9
0
 private void ShowForm(ClientForm window)
 {
     window.ShowDialog();
 }
示例#10
0
文件: ClientForm.cs 项目: Ikthios/P2P
 private void newClientToolStripMenuItem_Click(object sender, EventArgs e)
 {
     /*
     Create a new client window selection in menu list 'Client'
     */
     ClientForm newForm = new ClientForm();
     newForm.ShowDialog();
 }
示例#11
0
 public Client()
 {
     clientForm = new ClientForm(this);
     clientForm.ShowDialog();
 }