Пример #1
0
        private void lvwTests_ItemChecked(object sender, ItemCheckedEventArgs e)
        {
            ListViewItem4Log item4 = e.Item as ListViewItem4Log;

            bool b = item4.Checked;

            this.lvwTests.ItemChecked -= this.lvwTests_ItemChecked;
            switch (item4.IemLogType)
            {
            case ListViewItemLog4Type.Empty:
                item4.Checked = false;
                break;

            case ListViewItemLog4Type.PassStart:
            case ListViewItemLog4Type.PassEnd:
                item4.ParentPasses[0].Checked = b;
                item4.ParentPasses[1].Checked = b;
                foreach (var item in item4.ChildrenTestItems)
                {
                    item.Checked = b;
                }
                break;

            case ListViewItemLog4Type.Test:
            default:
                break;
            }
            this.lvwTests.ItemChecked += this.lvwTests_ItemChecked;
        }
Пример #2
0
        /// <summary>
        /// 显示所有Pass
        /// </summary>
        /// <param name="lstP"></param>
        private void DisplayPasses(List <Pass> lstP)
        {
            this.lvwTests.ItemChecked -= this.lvwTests_ItemChecked;
            this.lvwTests.BeginUpdate();
            this.lvwTests.Items.Clear();

            foreach (var p in this.listPasses) //按日期排序
            {
                //开始符号
                ListViewItem4Log item0 = new ListViewItem4Log(p, true);
                ListViewItem4Log itemz = new ListViewItem4Log(p, false);

                IList <ListViewItem4Log> passes = new List <ListViewItem4Log>()
                {
                    item0, itemz
                };

                item0.ParentPasses = passes;
                itemz.ParentPasses = passes;

                this.lvwTests.Items.Add(item0);

                IList <ListViewItem4Log> children = new List <ListViewItem4Log>();
                //每个Test
                foreach (var t in p.listTests)
                {
                    ListViewItem4Log item = new ListViewItem4Log(p, t);
                    item.ParentPasses = passes;
                    this.lvwTests.Items.Add(item);
                    children.Add(item);
                }

                this.lvwTests.Items.Add(itemz);

                item0.ChildrenTestItems = children;
                itemz.ChildrenTestItems = children;

                //空白行
                ListViewItem4Log itemSpace = new ListViewItem4Log();
                this.lvwTests.Items.Add(itemSpace);
            }

            //自动调整列宽
            this.lvwTests.AutoResizeColumns(
                ColumnHeaderAutoResizeStyle.ColumnContent);
            this.lvwTests.EndUpdate();
            this.lvwTests.ItemChecked += this.lvwTests_ItemChecked;
        }