itemlistform.cs

来自「how to use RSS services on windows mobil」· CS 代码 · 共 54 行

CS
54
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace LiveQnA3
{
    public partial class ItemListForm : Form
    {
        private DataRow channelRow;

        public ItemListForm(DataRow channelRow)
        {
            InitializeComponent();
            this.channelRow = channelRow;
        }

        private void ItemListForm_Load(object sender, EventArgs e)
        {
            DataRow[] itemRows = channelRow.GetChildRows("channel_item");

            if (itemRows.Length == 0)
                return;

            foreach (DataRow itemRow in itemRows)
            {
                //only title, link and description are required elements
                string title = itemRow["title"].ToString();
                string[] displayInfo = new string[2];
                displayInfo[0] = title;
                if (itemRow.Table.Columns.Contains("pubDate"))
                {
                    displayInfo[1] = itemRow["pubDate"].ToString();
                }
                else
                {
                    displayInfo[1] = string.Empty;
                }
 
                ListViewItem item = new ListViewItem(displayInfo);
                item.Tag = itemRow;
                listView1.Items.Add(item);
            }
            if (listView1.Items.Count > 0)
                listView1.Items[0].Selected = true;

        }


    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?