Example #1
0
        private void UserControlServices_Load(object sender, EventArgs e)
        {
            LoadServicesList();
            LoadAutoComplete();
            UobForm UobForm = (UobForm)Parent;

            if (UobForm.userControlServices.Visible == true)
            {
                AddLogs("Accessed Services");
            }
        }
        private void AddLogs(string command, bool success = true)
        {
            UobForm  UobForm    = (UobForm)this.Parent;
            var      ListNumber = UobForm.userControlLogs.LogsDisplay.Items.Count + 1;
            DateTime now        = DateTime.Now;

            ListViewItem items = new ListViewItem(ListNumber.ToString());

            if (ListNumber % 2 == 0)
            {
                items.BackColor = Color.LightGoldenrodYellow;
            }
            else
            {
                items.BackColor = Color.LightGray;
            }
            UobForm.userControlLogs.LogsDisplay.Items.Add(items);
            if (success == true)
            {
                ListViewSubItem listViewSubItem = new ListViewSubItem
                {
                    Text = command + ", succesfully."
                };
                ListViewSubItem subitems1 = listViewSubItem;
                items.SubItems.Add(subitems1);
                ListViewSubItem subitems2 = new ListViewSubItem
                {
                    Text = now.ToString()
                };
                items.SubItems.Add(subitems2);
            }
            else
            {
                ListViewSubItem listViewSubItem = new ListViewSubItem
                {
                    Text = command + ", unsuccesfully."
                };
                ListViewSubItem subitems1 = listViewSubItem;
                items.SubItems.Add(subitems1);
                ListViewSubItem subitems2 = new ListViewSubItem
                {
                    Text = now.ToString()
                };
                items.SubItems.Add(subitems2);
            }
        }