Пример #1
0
        private void Print(Log log)
        {
            // 保证render的时间必须短。否则界面会假死
            Color  color = EnvChecker.GetColor(TraceItem.ToTraceItem(log).type);
            string mess  = log.serverName + "   " + DataUtil.ToDateString(log.dateTime) + " " + log.text;

            this.BeginInvoke(new Action(() => {
                Render(color, mess);
            }));
        }
Пример #2
0
 private void ChangeConfCenter(string selectedName)
 {
     if (config.ChangeConfCenter(selectedName, out string errMsg))
     {
         if (!EnvChecker.Check(out errMsg))
         {
             MessageBox.Show("该项目配置不可用,请重新选择--" + errMsg, "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         MessageBox.Show("解决方案已切换到 (" + selectedName + ")", "成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
         ReloadSolutionList();
     }
     else
     {
         MessageBox.Show("切换解决方案出错:" + errMsg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #3
0
        private void RenderTable(DataTable dt, int totalNum)
        {
            FormLog_SizeChanged(null, null);
            this.pagerControl.RecordCount = totalNum;
            if (dt.Rows.Count == 0)
            {
                return;
            }

            List <ListViewItem> items = new List <ListViewItem>();

            foreach (DataRow dr in dt.Rows)
            {
                ListViewItem lvi = new ListViewItem();
                Log          log = new Log()
                {
                    id         = DataUtil.ToString(dr["ID"]),
                    serverName = DataUtil.ToString(dr["系统名称"]),
                    type       = DataUtil.ToString(dr["类型"]),
                    dateTime   = DataUtil.ToString(dr["插入时间"]),
                    text       = DataUtil.ToString(dr["信息文本"])
                };
                // 文本绑定
                lvi.Tag  = log.id;
                lvi.Text = log.id;
                lvi.SubItems.Add(log.serverName);
                lvi.SubItems.Add(log.dateTime);
                lvi.SubItems.Add(log.type);
                lvi.SubItems.Add(log.text);
                // 配色
                lvi.UseItemStyleForSubItems = false;
                TraceItem item = TraceItem.ToTraceItem(log);
                lvi.BackColor = EnvChecker.GetColor(TraceItem.ToTraceItem(log).type);
                items.Add(lvi);
            }
            this.Invoke(new Action(() => { this.listViewLog.Items.AddRange(items.ToArray()); }));
        }