Esempio n. 1
0
        public void Write(AppCommon.MODULES module, string str)
        {
            if (m_enable == false)
            {
                return;
            }

            lock (this)
            {
                DateTime d     = DateTime.Now;
                string   dname = "Logs\\" + d.Year + "_" + d.Month + "_" + d.Day;
                if (dname != m_dateName)
                {
                    m_dateName        = dname;
                    m_fullLogPathName = dname + "_" + m_logFileName;
                }

                using (FileStream fs = new FileStream(m_fullLogPathName, FileMode.Append, FileAccess.Write))
                    using (StreamWriter sw = new StreamWriter(fs))
                    {
                        sw.WriteLine("{0}, {1} , {2}", module.ToString(), d, str);
                    }
                if (pMsgCallback != null)
                {
                    pMsgCallback(100, module, d, str);
                }
            }
        }
Esempio n. 2
0
        void InsertToDataGrid(AppCommon.MODULES module, DateTime dtime, string msg)
        {
            dataGridView1.Rows.Add();
            int index = dataGridView1.RowCount - 1;

            dataGridView1.Rows[index].Cells[0].Value = module.ToString();
            dataGridView1.Rows[index].Cells[1].Value = dtime.ToString();
            dataGridView1.Rows[index].Cells[2].Value = msg;
        }