예제 #1
0
 private void btn_EditChannel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (listView_Channel.SelectedItems.Count > 0)
     {
         Dictionary <int, int> templist = new Dictionary <int, int>();
         foreach (ListViewItem item in listView_Channel.Items)
         {
             templist.Add(Convert.ToInt32(item.SubItems[0].Text), Convert.ToInt32(item.Tag));
         }
         //修改通道构造函数
         DialogCollectChannel dcc = new DialogCollectChannel(Convert.ToInt32(com_MaxChannel.Text), templist, Convert.ToInt32(listView_Channel.SelectedItems[0].SubItems[0].Text), Convert.ToInt32(listView_Channel.SelectedItems[0].Tag));
         dcc.ShowDialog(this);
         //刷新通道列表(有条目,说明一定不是新建的基站。故不判断 StationRow==null)
         RefreshChannelListView(StationRow["CollectChannelIDStr"].ToString());
     }
     else
     {
         MessageBox.Show("请先选择一个欲修改的通道。", "修改通道", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
예제 #2
0
        private void btn_AddChannel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Dictionary <int, int> templist = new Dictionary <int, int>();

            foreach (ListViewItem item in listView_Channel.Items)
            {
                templist.Add(Convert.ToInt32(item.SubItems[0].Text), Convert.ToInt32(item.Tag));
            }
            //添加通道构造函数
            DialogCollectChannel dcc = new DialogCollectChannel(this, Convert.ToInt32(com_MaxChannel.Text), templist);

            dcc.ShowDialog(this);
            //如果添加通道字符串不为空,说明成功添加了通道。则更新ListView
            if (this.AddCollectChannelStr != "")
            {
                string[]     tempArray = this.AddCollectChannelStr.Split('|');
                ListViewItem item      = new ListViewItem(new string[] { tempArray[0], tempArray[1], tempArray[2] });
                //将Channel_ID放到Item的Tag里
                item.Tag = tempArray[3];
                //添加Item
                listView_Channel.Items.Add(item);
                this.AddCollectChannelStr = "";
            }
        }