Ejemplo n.º 1
0
        private void reamoveCollect_Click(object sender, EventArgs e)//移除收藏
        {
            try
            {
                SqlOperate.CollectStruct collectInfo;

                foreach (ListViewItemInfo i in resultListView.SelectedItems)
                {
                    resultListView.Items.Remove(i);
                    collectInfo = opt.SearchCollectByName(i.Text, i.ReferUrl);

                    if (showImageList.Images.Count >= i.ImageIndex)
                    {
                        showImageList.Images[i.ImageIndex].Dispose();
                        showImageList.Images.RemoveAt(i.ImageIndex);
                    }

                    if (collectInfo.ImagePath != null)
                    {
                        File.Delete(collectInfo.ImagePath);
                        opt.DeleteCollect(collectInfo);
                    }
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 2
0
        private void reamoveCollect_Click(object sender, EventArgs e)
        {
            SqlOperate.CollectStruct collectInfo;

            foreach (ListViewItem i in resultListView.SelectedItems)
            {
                resultListView.Items.Remove(i);
                collectInfo = opt.SearchCollectByName(i.Text, resourse.SearchResultURL[i.Text]);
                resourse.SearchResultURL.Remove(i.Text);
                showImageList.Images[i.ImageIndex].Dispose();
                showImageList.Images.RemoveAt(i.ImageIndex);
                File.Delete(collectInfo.ImagePath);
                opt.DeleteCollect(collectInfo);
            }
        }