Example #1
0
        public void ClientReadEH(object sender, ClientRecievedEventArgs e)
        {
            Server serv = (Server)sender;
            ClientList.Invoke((MethodInvoker)delegate
            {
                int i = 0;
                ClientList.Items.Clear();
                BindingClients.Clear();
                foreach (Client c in serv.Manager.Clients.Values)
                {
                    if (c.Status == Internet.Status.AnswersVerified)
                    {
                        ListViewItem item = new ListViewItem(new string[6] { c.Status.ToString(),c.Data.Group, c.Data.Name, c.Data.LastName, c.Data.Result.Percent.ToString(), c.Data.Result.Mark.ToString() });
                        ClientList.Items.Add(item);
                        BindingClients.Add(i, c);
                    }
                    if (c.Status == Internet.Status.RecieveTest)
                    {
                        ListViewItem item = new ListViewItem(new string[6] { c.Status.ToString(),c.Data.Group, c.Data.Name, c.Data.LastName, " ", " " });
                        ClientList.Items.Add(item);
                        BindingClients.Add(i, c);
                    }
                    i++;
                }

            });
        }
Example #2
0
        private void OnRequestSetResult(Client client, TcpClient tcp_client)
        {
            try
            {
                string res = AddClient(client);
                if (Manager.Clients.ContainsKey(client.ID))
                {
                    client = Manager.Clients[client.ID];
                }

                if (res.Equals("") == false)
                {
                    Client.Write(tcp_client,"#"+res);
                }
                else
                {
                    client.Verify(ref this.OriginalTest, client.Buffer);

                    client.Status = Status.AnswersVerified;
                    Client.WriteInfo(client.Data.Result, tcp_client);
                }
            }
            catch (Exception ex)
            {
                Client.SendError(tcp_client, ex);
            }

               // manager.Clients.Add(client.ID, client);

            ClientRecievedEventArgs Re = new ClientRecievedEventArgs(client);
            this.OnClientRecieved(this, Re);
        }
Example #3
0
 /// <summary>
 /// событие изменения списка клиентов
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public virtual void OnClientRecieved(object sender, ClientRecievedEventArgs e)
 {
     if (this.ClientRecieved != null)
     {
         this.ClientRecieved(this, e);
     }
 }
Example #4
0
        private void OnRequestGetTest(Client client,TcpClient tcp_client)
        {
            try
            {
                client.Data.Name = client.CurrentXml.Element("Client").Attribute("Name").Value;
                client.Data.LastName = client.CurrentXml.Element("Client").Attribute("LastName").Value;
                client.Data.Group = client.CurrentXml.Element("Client").Attribute("Group").Value;
                client.Data.TimeStart = DateTime.Now;
                client.Status = Internet.Status.RecieveTest;
            }
            catch
            {
                Exception ex = new Exception("неправильный xml");
                Client.SendError(tcp_client,ex);
            }

            try
            {
                Client.Write(tcp_client,SerializedTest);
            }
            catch
            {
                Exception ex = new Exception("невозможно передать тест");
                Client.SendError(tcp_client, ex);
            }

            manager.Clients.Add(client.ID, client);
            ClientRecievedEventArgs Re = new ClientRecievedEventArgs(client);
            this.OnClientRecieved(this, Re);
        }
Example #5
0
        public virtual void OnClientAdd(object sender, ClientRecievedEventArgs e)
        {
            if (e.Client != null)
            {
                //if (this.ThatQuery != null)
                //{
                //    this.ThatQuery.ShowQuery(this.ClientsList, this.ThatQuery.MakeQuery(this.server.Manager.Clients));
                //}
                //else
                //{
                //    StandartCliensQuery q = new StandartCliensQuery();
                //    q.ShowQuery(this.ClientsList, q.MakeQuery(this.server.Manager.Clients));
                //}

                this.ClientsList.Invoke((MethodInvoker)delegate
                {
                    UpdateListView();
                });
               // UpdateListView();
               // UpdateStatusStrip("Клиент добавлен: " + e.Client.Data.Name + " " + e.Client.Data.LastName + " " + e.Client.Data.Group);
            }
        }