private void btnTrophyAddSelected_Hit(object sender, EventArgs e) { try { string TrophyName = AetherObjects.Collection[Core.Actions.CurrentSelection].Name.Trim(); Trophy nt = new Trophy(@TrophyName, 0, true, false); if(mSearchListHolder.TrophyHash.Add(nt)) { mSelectedTrophy = nt; WriteToChat("Added selected item to trophy list."); } else { WriteToChat("Trophy is already in list. Existing trophy selected."); mSelectedTrophy = mSearchListHolder.TrophyHash.Where(x => @x.TrophyName == @TrophyName).First(); _UpdateTrophyTab(); return; } SyncAndSaveTrophies(); } catch (Exception ex) { LogError(ex); } }
private void _UpdateTrophyTab() { try { int scroll = lstmyTrophies.ScrollPosition; lstmyTrophies.ClearRows(); HudList.HudListRowAccessor trophyrow = new HudList.HudListRowAccessor(); foreach(Trophy Tro in mSearchListHolder.TrophyHash) { trophyrow = lstmyTrophies.AddRow(); ((HudCheckBox)trophyrow[0]).Checked = Tro.Checked; ((HudStaticText)trophyrow[1]).Text = Tro.TrophyName; ((HudPictureBox)trophyrow[2]).Image = GearGraphics.RemoveCircle; } if(mSelectedTrophy == null) {mSelectedTrophy = mSearchListHolder.TrophyHash.FirstOrDefault();} if(mSelectedTrophy == null) {return;} chkTrophyEnabled.Checked = mSelectedTrophy.Checked; txtTrophyName.Text = mSelectedTrophy.TrophyName; chkTrophyStartsWith.Checked = mSelectedTrophy.StartsWith; txtTrophyMax.Text = mSelectedTrophy.TrophyLootMax.ToString(); lstmyTrophies.ScrollPosition = scroll; }catch(Exception ex){LogError(ex);} }
private void btnAddTrophyItem_Hit(object sender, EventArgs e) { try { int lootmax = 0; Int32.TryParse(txtTrophyMax.Text.Trim(), out lootmax); Trophy nt = new Trophy("New Trophy " + DateTime.Now.ToString(), lootmax, chkTrophyEnabled.Checked, chkTrophyStartsWith.Checked); mSearchListHolder.TrophyHash.Add(nt); mSelectedTrophy = nt; SyncAndSaveTrophies(); } catch (Exception ex) { LogError(ex); } }
private void txtTrophyName_LostFocus(object sender, EventArgs e) { try { if (@txtTrophyName.Text == null || @txtTrophyName.Text == String.Empty || @txtTrophyName.Text.Trim().Length == 0) { WriteToChat("Trophy name can not be blank."); WriteToChat("Name set to a default."); txtTrophyName.Text = "New Trophy " + DateTime.Now.ToString(); } if(mSearchListHolder.TrophyHash.Any(x => @x.TrophyName == @txtTrophyName.Text.Trim())) { WriteToChat("Trophy name already exists. Existing trophy selected."); mSelectedTrophy = mSearchListHolder.TrophyHash.Where(x => @x.TrophyName == @txtTrophyName.Text.Trim()).First(); _UpdateTrophyTab(); return; } mSelectedTrophy.TrophyName = txtTrophyName.Text.Trim(); SyncAndSaveTrophies(); }catch(Exception ex){LogError(ex);} }
private void lstmyTrophies_Click(object sender, int row, int col) { try { HudList.HudListRowAccessor trophyrow = new HudList.HudListRowAccessor(); trophyrow = lstmyTrophies[row]; mSelectedTrophy = mSearchListHolder.TrophyHash.Where(x => x.TrophyName == ((HudStaticText)trophyrow[1]).Text).First(); if(col == 2) { mSearchListHolder.TrophyHash.RemoveWhere(x => x.TrophyName == ((HudStaticText)trophyrow[1]).Text); mSelectedTrophy = mSearchListHolder.TrophyHash.FirstOrDefault(); SyncAndSaveTrophies(); } else { _UpdateTrophyTab(); } if(col == 0) { if(mSelectedTrophy.Checked) {mSelectedTrophy.Checked = false;} else{mSelectedTrophy.Checked = true;} SyncAndSaveTrophies(); } }catch(Exception ex){LogError(ex);} }