public ReadLog ( string nodePath, string xmlBuildPath ) : List |
||
nodePath | string | 获取节点的路径 |
xmlBuildPath | string | 读取的xml文件的路径 |
리턴 | List |
/// <summary> /// 初始化项目列表显示 /// </summary> public void InitProjectList() { ListView.Items.Clear(); ProjectController projectController = new ProjectController(); _projectInfos = projectController.ReadLog("/config/Projects", "../../../common/res/BuildResultLogs.xml"); ProjectInfo lastestInfo = projectController.ProjectQuery("config/lastest", false, "../../../common/res/LastestInfo.xml").First(); foreach (var projectInfo in _projectInfos) { var flag = projectInfo.Result; //如果是最近一次编译的项目,则以最近一次编译的结果为准 if (projectInfo.Nameproperty.Equals(lastestInfo.Nameproperty)) { flag = lastestInfo.Result; } string imageSource; switch (flag) { case "successful": imageSource = "../images/dot_green.png"; break; case "running": imageSource = "../images/dot_yellow.png"; break; case "failed": imageSource = "../images/dot_red.png"; break; default: imageSource = "../images/dot_black.png"; break; } // 每一项ListViewItem包含的控件 var img = new Image(); var tb = new TextBlock(); var stp = new StackPanel(); var lvi = new ListViewItem(); //设置控件相关属性 img.Width = 12; img.Height = 12; img.Source = new BitmapImage(new Uri(imageSource, UriKind.Relative)); img.Margin = new Thickness(2, 0, 5, 0); tb.Text = projectInfo.Nameproperty; tb.Height = 12; stp.Orientation = Orientation.Horizontal; var convertFromString = ColorConverter.ConvertFromString("#999"); if (convertFromString != null) lvi.BorderBrush = new SolidColorBrush((Color)convertFromString); lvi.BorderThickness = new Thickness(2, 0, 2, 2); lvi.Height = 30; var fromString = ColorConverter.ConvertFromString("#eee"); if (fromString != null) lvi.Background = new SolidColorBrush((Color)fromString); stp.Children.Add(img); stp.Children.Add(tb); lvi.Content = stp; ListView.Items.Add(lvi); } }
/// <summary> /// 初始化日志显示 /// </summary> private void InitDetailLogs() { AllLog.Text = ""; ProjectController projectController = new ProjectController(); //获取log信息 List<ProjectInfo> logs = projectController.ReadLog("/config/Projects", "../../../common/res/BuildResultLogs.xml"); foreach (var proLog in logs) { AllLog.Text += proLog.Nameproperty + "编译日志" + "\n" + proLog.Log + "\n"; } }