Beispiel #1
0
        private void Stat(int icon, string action, string message, string color)
        {
            Globals.StatIcon    = icon;
            Globals.StatAction  = action;
            Globals.StatMessage = message;
            Globals.StatColor   = color;

            if (ControlInvokeRequired(StatMon, () => ExecStat()))
            {
                return;
            }

            DateTime     now  = DateTime.Now;
            string       dt   = String.Format("{0:M/d/yyyy - HH:mm:ss}", now);
            ListViewItem item = new ListViewItem(dt, 0);

            item.UseItemStyleForSubItems = false;
            item.SubItems.Add(Globals.StatAction);
            item.SubItems.Add(Globals.StatMessage);

            item.SubItems[1].Font      = new System.Drawing.Font(ChatMon.Font, System.Drawing.FontStyle.Bold);
            item.SubItems[1].ForeColor = System.Drawing.Color.FromName(Globals.StatColor);
            item.SubItems[2].ForeColor = System.Drawing.Color.FromName(Globals.StatColor);

            StatMon.Items.Add(item);
            StatMon.EnsureVisible(StatMon.Items.Count - 1);
            //Console.WriteLine("I'm NOT in the threadpool, fool!");
        }
Beispiel #2
0
        private void ExecStat()
        {
            DateTime     now  = DateTime.Now;
            string       dt   = String.Format("{0:M/d/yyyy - HH:mm:ss}", now);
            ListViewItem item = new ListViewItem(dt, 0);

            item.UseItemStyleForSubItems = false;
            item.SubItems.Add(Globals.StatAction);
            item.SubItems.Add(Globals.StatMessage);

            item.SubItems[1].Font      = new System.Drawing.Font(ChatMon.Font, System.Drawing.FontStyle.Bold);
            item.SubItems[1].ForeColor = System.Drawing.Color.FromName(Globals.StatColor);
            item.SubItems[2].ForeColor = System.Drawing.Color.FromName(Globals.StatColor);

            StatMon.Items.Add(item);
            StatMon.EnsureVisible(StatMon.Items.Count - 1);
            //Console.WriteLine("I'm in the threadpool, fool!");
        }