private void lstCodes_SelectedIndexChanged(object sender, EventArgs e) { if (panel1.Enabled = lstCodes.SelectedIndices.Count > 0) { _updating = true; _codeEntry = lstCodes.Items[lstCodes.SelectedIndices[0]].Tag as GCTCodeEntryNode; txtDesc.Text = _codeEntry._description; txtCode.Text = _codeEntry.DisplayLines; textBox1.Text = _codeEntry._name; string s = _codeEntry.LinesNoSpaces; int i = 0; _codeEntrySavedIndex = -1; foreach (CodeStorage c in BrawlLib.Properties.Settings.Default.Codes) { if (c._code == s) { btnAddRemoveCode.Text = "Forget Code"; _codeEntrySavedIndex = i; break; } i++; } if (_codeEntrySavedIndex == -1) { btnAddRemoveCode.Text = "Remember Code"; } _updating = false; } status.Text = ""; }
private void saveAllRememberedCodesToGCTToolStripMenuItem_Click(object sender, EventArgs e) { GCTNode g = new GCTNode(); foreach (CodeStorage w in BrawlLib.Properties.Settings.Default.Codes) { GCTCodeEntryNode r = new GCTCodeEntryNode(); r.LinesNoSpaces = w._code; r._name = w._name; r._description = w._description; g.AddChild(r); } SaveAs(g, true); }
private void btnNewCode_Click(object sender, EventArgs e) { if (_updating) { return; } if (TargetNode == null) { TargetNode = new GCTNode(); } GCTCodeEntryNode n = new GCTCodeEntryNode() { _name = "New Code" }; TargetNode.AddChild(n); lstCodes.Items.Add(new ListViewItem() { Text = n.Name, Checked = n._enabled, Tag = n }); }