Example #1
0
 private void updateClients()
 {
     this.lbxContacts.Items.Clear();
     this.contacts = ClientList.GetClients();
     this.contacts.Sort();
     for (int index = 0; index < this.contacts.Count(); index++)
     {
         string contact = this.contacts[index].Format();
         this.lbxContacts.Items.Add(new ListItem(contact));
     }
 }
Example #2
0
 /// <summary>
 /// Handles the Click event of the btnAddToContactList control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 protected void btnAddToContactList_Click(object sender, EventArgs e)
 {
     try
     {
         ClientList.GetClients().AddItem((Client)Session["CurrentClient"]);
         this.lblError.Text = "";
     }
     catch (ArgumentException exception)
     {
         this.lblError.Text = exception.Message;
     }
 }
        /// <summary>
        /// Populates the ListView.
        /// </summary>
        private void populateListView()
        {
            ClientList clientList = ClientList.GetClients();
            List<ListItem> clientListBoxItems = new List<ListItem>();

            foreach (Client currentClient in clientList.Clients)
            {
                clientListBoxItems.Add(new ListItem(currentClient.ViewOutput(), Convert.ToString(currentClient.ID)));
            }

            this.lbxContactList.Items.AddRange(clientListBoxItems.ToArray());
            Session["ClientListBoxItems"] = clientListBoxItems;
        }
Example #4
0
        public void Handle(CommandLine commandLine)
        {
            var argument = commandLine.Arguments.FirstOrDefault(x => x.Name == "unknown");

            if (argument == null)
            {
                WriteWarning("You should define the client index.");
            }
            else
            {
                var index = int.Parse(argument.Value);
                _context.CurrentClient = _clientList.GetClients().ElementAt(index - 1);
            }
        }
Example #5
0
        /// <summary>
        /// Handles the Click event of the AddContact control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void AddContact_Click(object sender, EventArgs e)
        {
            this.clients = ClientList.GetClients();
            bool clientAdded = this.clients.AddClient(this.selectedClient);

            HttpContext.Current.Session["Clients"] = this.clients;
            if (clientAdded)
            {
                this.lblContactAdded.Text = "[" + this.selectedClient.Name + "] added";
            }
            else
            {
                this.lblContactAdded.Text = "[" + this.selectedClient.Name + "] has already been added";
            }
        }
Example #6
0
        protected void btnRemoveClient_Click(object sender, EventArgs e)
        {
            try
            {
                ClientList temporaryList = ClientList.GetClients();

                temporaryList.RemoveAt(this.lbxContacts.SelectedIndex);
                HttpContext.Current.Session["Clients"] = temporaryList;
            }
            catch (IndexOutOfRangeException)
            {
                Console.WriteLine("There are no more clients to remove");
            }

            this.updateClients();
        }
Example #7
0
        public void Handle(CommandLine commandLine)
        {
            var clients = _clientList.GetClients().ToList();

            for (var index = 0; index < clients.Count; index++)
            {
                var client = clients[index];
                WriteInfo(string.Format("{0} {1} {2} {3} {4} {5}",
                                        (index + 1).ToString().PadRight(3),
                                        client.MachineName.PadRight(15),
                                        client.UserName.PadRight(15),
                                        client.OperatingSystem.PadRight(15),
                                        (client.Ip ?? string.Empty).PadRight(15),
                                        (client.Latency + "ms").PadLeft(5)));
            }
        }
 /// <summary>
 /// Handles the Click event of the btnClearList control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 protected void btnClearList_Click(object sender, EventArgs e)
 {
     Session["ClientListBoxItems"] = null;
     ClientList.GetClients().Clear();
     this.lbxContactList.Items.Clear();
 }