//显示页面详情 public void ShowDetail() { _SystemLogBean = SelectedSystemLogItem; _SystemLogBean.CurrentScale = (SystemLogItems.IndexOf(SelectedSystemLogItem) + 1) + "/" + SystemLogItems.Count; SystemLogXaml = new SystemLogDetail(); SystemLogXaml.ShowDialog(); }
/// <summary> /// 切换选择的条目,主要用于查看上一条和下一条记录 /// 0是上一条记录,1是下一条记录 /// </summary> /// <param name="type"></param> private void SwitchSelectedItem(int type) { switch (type) { case 0: currentItem = SystemLogItems.IndexOf(SelectedSystemLogItem) - 1; break; case 1: currentItem = SystemLogItems.IndexOf(SelectedSystemLogItem) + 1; break; } if (currentItem < 0) { MessageBox.Show("已经是第一条记录了!"); currentItem = 0; return; } if (currentItem > SystemLogItems.Count - 1) { MessageBox.Show("已经是最后一条记录了!"); currentItem = SystemLogItems.Count - 1; return; } SelectedSystemLogItem = SystemLogItems.ElementAt(currentItem); SystemLogBean = SelectedSystemLogItem; SystemLogBean.CurrentScale = (currentItem + 1) + "/" + SystemLogItems.Count; }
/// <summary> /// 加载小树下面的所有日志 /// </summary> /// <param name="c"></param> private void LoadTreeItem(TreeNodeModel c) { List <SystemLog> sls = _LoggerService.FindAllSystemLogByModuleId(c.Id); SystemLogItems.Clear(); if (sls != null) { for (int x = 0; x < sls.Count; x++) { var s = sls.ElementAt(x); SystemLogBean sb = new SystemLogBean(); sb.CreateSystemLogBean(s); sb.LineNumber = SystemLogItems.Count + 1 + ""; if (x == 0) { SelectedSystemLogItem = sb; } SystemLogItems.Add(sb); } } }
/// <summary> /// 加载基本数据 /// </summary> private void LoadBaseData() { OperatorItems = _UserService.QueryUsers(); SelectedOperatorItem = OperatorItems.ElementAt(0); List <SystemLog> sls = _LoggerService.FindAllSystemLog(); SystemLogItems.Clear(); if (sls != null) { for (int x = 0; x < sls.Count; x++) { var s = sls.ElementAt(x); SystemLogBean sb = new SystemLogBean(); sb.CreateSystemLogBean(s); sb.LineNumber = SystemLogItems.Count + 1 + ""; if (x == 0) { SelectedSystemLogItem = sb; } SystemLogItems.Add(sb); } } }