private void _UpdateSalvagePanel() { try { int Scroll = lstNotifySalvage.ScrollPosition; List<Salvage> SortedSalvageHash = mSearchListHolder.SalvageHash.OrderByDescending(x => x.Checked).ThenBy(x => x.SalvageName).ToList(); lstNotifySalvage.ClearRows(); if (mSelectedSalvage == null) { mSelectedSalvage = mSearchListHolder.SalvageHash.FirstOrDefault();} HudList.HudListRowAccessor lstNotifySalvageHashRow = new HudList.HudListRowAccessor(); foreach (Salvage element in SortedSalvageHash) { lstNotifySalvageHashRow = lstNotifySalvage.AddRow(); ((HudCheckBox)lstNotifySalvageHashRow[0]).Checked = element.Checked; if(element.SellorTrade == 0) {((HudPictureBox)lstNotifySalvageHashRow[1]).Image = GearGraphics.Salv_KEEP_ICON;} if(element.SellorTrade == 1) {((HudPictureBox)lstNotifySalvageHashRow[1]).Image = GearGraphics.Salv_STORE_ICON;} if(element.SellorTrade == 2) {((HudPictureBox)lstNotifySalvageHashRow[1]).Image = GearGraphics.Salv_SELL_ICON;} ((HudStaticText)lstNotifySalvageHashRow[2]).Text = element.SalvageName; ((HudStaticText)lstNotifySalvageHashRow[3]).Text = element.CombineString; ((HudStaticText)lstNotifySalvageHashRow[4]).Text = element.SalvageMaterial.ToString(); } lblSalvageName.Text = mSelectedSalvage.SalvageName; txtSalvageString.Text = mSelectedSalvage.CombineString; chkSalvageEnabled.Checked = mSelectedSalvage.Checked; if(mSelectedSalvage.SellorTrade == 0) {imgSalvageAuto.Image = GearGraphics.Salv_KEEP_ICON;} if(mSelectedSalvage.SellorTrade == 1) {imgSalvageAuto.Image = GearGraphics.Salv_STORE_ICON;} if(mSelectedSalvage.SellorTrade == 2) {imgSalvageAuto.Image = GearGraphics.Salv_SELL_ICON;} lstNotifySalvage.ScrollPosition = Scroll; } catch (Exception ex) { LogError(ex); } }
private void lstNotifySalvage_Click(object sender, int row, int col) { try { HudList.HudListRowAccessor HudRow = lstNotifySalvage[row]; mSelectedSalvage = mSearchListHolder.SalvageHash.Where(x => x.SalvageMaterial == Convert.ToInt32(((HudStaticText)HudRow[4]).Text)).First(); if (col == 0) { if(mSelectedSalvage.Checked){mSelectedSalvage.Checked = false;} else{mSelectedSalvage.Checked = true;} SaveSalvage(); } if (col == 1) { mSelectedSalvage.SellorTrade++; if(mSelectedSalvage.SellorTrade > 2) {mSelectedSalvage.SellorTrade = 0;} SaveSalvage(); } else { _UpdateSalvagePanel(); } } catch (Exception ex) { LogError(ex); } }