private void lvLooting_SelectedIndexChanged(object sender, EventArgs e) { if (lvLooting.SelectedItems.Count > 0) { ListViewItem lvi = lvLooting.SelectedItems[0]; if (lvi != null && lvi.Tag != null && lvi.Tag.GetType() == typeof(SHLoot)) { SHLoot loot = (SHLoot)lvi.Tag; if (loot != null) { pgLoot.SelectedObject = loot; pgLoot.Tag = lvi; ProcessLoot(loot, lvLootList); SHListViewUtil.SelectIndex(lvLootList, 0); if (lvLootList.Items.Count == 0) { pgLootableDetail.SelectedObject = null; pgLootableDetail.Tag = null; } Global._mainForm.SetStatusLabelText(loot.CompiledMessage); } } } m_ListViewController.OnSelectedIndexChanged(); }
private void subLootDel_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to delete?", Application.ProductName, MessageBoxButtons.YesNo) == DialogResult.Yes) { ListViewItem lvi = lvLootList.SelectedItems[0]; int nSelected = lvi.Index; if (lvi != null && lvi.Tag != null && ((lvi.Tag.GetType() == typeof(SHLootSoul) || lvi.Tag.GetType() == typeof(SHLootSilver) || lvi.Tag.GetType() == typeof(SHLootItem)))) { SHLoot loot = lvLootList.Tag as SHLoot; if (loot != null) { loot.dataList.Remove(lvi.Tag); m_ListViewController.SetListText(pgLoot.Tag as ListViewItem, loot); ProcessLoot(loot, lvLootList); lvLootList.SelectedIndices.Clear(); SHListViewUtil.SelectIndex(lvLootList, nSelected); Global._VelixianForms.FindForm("LOOTING").Touch(); } } } }
public override void SetListText(ListViewItem lvi, SHDataObject selDataObject) { SHLoot loot = (SHLoot)(selDataObject); if (lvi == null) { return; } if (lvi.SubItems.Count > 1) { lvi.SubItems.Clear(); } loot.Compile(); loot.Build(m_XmlCore); lvi.Text = (loot.idSpecified) ? loot.id.ToString() : String.Empty; lvi.SubItems.AddRange(new String[] { (loot.comment != null) ? loot.comment : String.Empty, (loot.maxSpecified) ? loot.max.ToString() : String.Empty, (loot.dataList.Count > 0) ? loot.dataList.Count.ToString() + "개" : "0개" }); if (!loot.Passed) { lvi.ImageIndex = 7; } lvi.Tag = loot; lvi.ForeColor = (loot.Passed) ? Color.Black : Color.Red; lvi.BackColor = (loot.Passed) ? Color.White : Color.Yellow; }
private void ProcessLoot(SHLoot loot, ListView lvTarget) { if (loot == null) { return; } int nSelectedIndex = (lvTarget.SelectedItems.Count > 0) ? lvTarget.SelectedIndices[0] : 0; lvTarget.Items.Clear(); for (int i = 0; i < loot.dataList.Count; i++) { ListViewItem lvi = new ListViewItem(); if (loot.dataList[i].GetType() == typeof(SHLootSilver)) { ProcessLootSilver(lvi, loot.dataList[i] as SHLootSilver); } else if (loot.dataList[i].GetType() == typeof(SHLootItem)) { ProcessLootItem(lvi, loot.dataList[i] as SHLootItem); } else if (loot.dataList[i].GetType() == typeof(SHLootSoul)) { ProcessLootSoul(lvi, loot.dataList[i] as SHLootSoul); } lvTarget.Items.Add(lvi); } lvTarget.Tag = loot; }
protected override int GetDataObjectID(object listViewItemTag) { if (listViewItemTag.GetType() != typeof(SHLoot)) { return(0); } SHLoot selLoot = (SHLoot)listViewItemTag; if (selLoot != null) { return(selLoot.id); } return(0); }
private void subLootingsAdd_Click(object sender, EventArgs e) { SHLoot newLoot = new SHLoot(); int nNewLootID = m_ListViewController.MakeNewID(); newLoot.id = nNewLootID; newLoot.max = 1; xmlCore.Lootings.Add(newLoot); m_ListViewController.AddItem(newLoot); Global._VelixianForms.FindForm("LOOTING").Touch(); }
private void pgLoot_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { if (pgLoot.Tag.GetType() == typeof(ListViewItem)) { SHLoot loot = (SHLoot)(pgLoot.SelectedObject as SHLoot); if (loot != null) { if (e.ChangedItem.Label == "(Username)" && loot.id != (int)e.OldValue) { m_ListViewController.SortListView(loot); } } m_ListViewController.SetListText(pgLoot.Tag as ListViewItem, pgLoot.SelectedObject as SHLoot); } Global._VelixianForms.FindForm("LOOTING").Touch(); }
protected override bool CheckFilter(SHDataObject dataObject, string strHead, string strFilter) { SHLoot loot = (SHLoot)(dataObject); int nDataListCount = (loot.dataList != null) ? loot.dataList.Count : 0; if (strHead.ToLower() == "id") { return(ExistFilterString(strFilter, loot.id.ToString())); } if (strHead.ToLower() == "comment" || strHead == "주석") { return(ExistFilterString(strFilter, loot.comment)); } if (strHead.ToLower() == "max" || strHead == "최대갯수") { return(ExistFilterString(strFilter, loot.max.ToString())); } if (strHead == "종류") { return(ExistFilterString(strFilter, nDataListCount.ToString())); } if (ExistFilterString(strFilter, loot.id.ToString())) { return(true); } if (ExistFilterString(strFilter, loot.comment)) { return(true); } if (ExistFilterString(strFilter, loot.max.ToString())) { return(true); } return(false); }