private void scanListView_DragDrop(object sender, DragEventArgs e) { if (scanListView.SelectedItems.Count == 0) { return; } Point cp = scanListView.PointToClient(new Point(e.X, e.Y)); ListViewItem dragToItem = scanListView.GetItemAt(cp.X, cp.Y); if (dragToItem == null) { return; } int dragIndex = dragToItem.Index; ListViewItem[] sel = new ListViewItem[scanListView.SelectedItems.Count]; MainScanItem[] vsel = new MainScanItem[scanListView.SelectedItems.Count]; for (int i = 0; i < scanListView.SelectedItems.Count; i++) { sel[i] = scanListView.SelectedItems[i]; vsel[i] = scanItems[scanListView.SelectedIndices[i]]; } for (int i = 0; i < sel.GetLength(0); i++) { ListViewItem dragItem = sel[i]; MainScanItem vdragItem = vsel[i]; int itemIndex = dragIndex; if (itemIndex == dragItem.Index) { return; } bool isStart = false; if (vdragItem.Steam.scaninProg) { vdragItem.Steam.CancelScan(); isStart = true; } if (dragItem.Index < itemIndex) itemIndex++; else itemIndex = dragIndex + i; MainScanItem insertVItem = new MainScanItem(new saveTab(vdragItem.Steam.scanInput), steam_srch.cookieCont, new eventDelegate(Event_Message), settings.ignoreWarn, settings.resellDelay); insertVItem.LogCont = vdragItem.LogCont; if (isStart) { insertVItem.Steam.ScanPrices(); } scanItems.Insert(itemIndex, insertVItem); scanItems.Remove(vdragItem); scanItems.UpdateIds(); ListViewItem insertItem = (ListViewItem)dragItem.Clone(); scanListView.Items.Insert(itemIndex, insertItem); scanListView.Items.Remove(dragItem); insertItem.Selected = true; } }
private void button3_Click_1(object sender, EventArgs e) { //Buggy? int sel = 0; if (isFirstTab) { sel = scanListView.SelectedIndices[0]; var tocopy = new MainScanItem(new saveTab(scanItems[sel].Steam.scanInput), steam_srch.cookieCont, new eventDelegate(Event_Message), settings.ignoreWarn, settings.resellDelay); tocopy.Steam.scanInput.Name += " Copy"; scanItems.Insert(sel + 1, tocopy); scanListView.Items.Insert(sel, (ListViewItem)scanListView.Items[sel].Clone()); scanListView.Items[sel + 1].SubItems[1].Text = tocopy.Steam.scanInput.Name; SetColumnWidths(scanListView, true); scanItems.UpdateIds(); BindToControls(scanListView); } else { sel = recentListView.SelectedIndices[0]; var tocopy = new saveTab(steam_srch.recentInputList[sel]); tocopy.Name += " Copy"; steam_srch.recentInputList.Insert(sel + 1, tocopy); recentListView.Items.Insert(sel, (ListViewItem)recentListView.Items[sel].Clone()); recentListView.Items[sel + 1].SubItems[1].Text = tocopy.Name; SetColumnWidths(recentListView, true); BindToControls(recentListView); } }
private void LoadTabs(saveTabLst lst) { if (lst != null) { for (int i = 0; i < lst.Count; i++) { var ourItem = lst[i]; string[] row = {string.Empty, ourItem.Name, ourItem.Price }; var lstItem = new ListViewItem(row); scanListView.Items.Add(lstItem); var scanItem = new MainScanItem(ourItem, steam_srch.cookieCont, new eventDelegate(Event_Message), settings.ignoreWarn, settings.resellDelay); if (isScanValid(ourItem, true)) { ourItem.StatId = status.Ready; setStatImg(i, ourItem.StatId, scanListView); } else { ourItem.StatId = status.Warning; setStatImg(i, ourItem.StatId, scanListView); } //new scanItems.Add(scanItem); } if (scanListView.Items.Count != 0) { if (scanListView.Items.Count > lst.Position) { scanListView.Items[lst.Position].Selected = true; scanListView.Focus(); BindToControls(scanListView); } scanItems.UpdateIds(); SetColumnWidths(scanListView, true); } else panel1.Enabled = false; } }