private void listViewTribes_SelectedIndexChanged(object sender, EventArgs e) { bool tribeSelected = listViewTribes.SelectedIndices.Count > 0; if (tribeSelected) { panelPlayerSettings.Visible = false; panelTribeSettings.Visible = true; selectedTribe = (Tribe)listViewTribes.SelectedItems[0].Tag; selectedTribeRow = listViewTribes.SelectedItems[0]; textBoxTribeName.Text = selectedTribe.TribeName; switch (selectedTribe.TribeRelation) { case Tribe.Relation.Allied: radioButtonAllied.Checked = true; break; case Tribe.Relation.Friendly: radioButtonFriendly.Checked = true; break; case Tribe.Relation.Neutral: radioButtonNeutral.Checked = true; break; case Tribe.Relation.Hostile: radioButtonHostile.Checked = true; break; } textBoxTribeNotes.Text = selectedTribe.Note; } panelTribeSettings.Enabled = tribeSelected; }
private void listViewTribes_SelectedIndexChanged(object sender, EventArgs e) { if (listViewTribes.SelectedIndices.Count > 0) { selectedTribe = (Tribe)listViewTribes.SelectedItems[0].Tag; selectedTribeRow = listViewTribes.SelectedItems[0]; textBoxTribeName.Text = selectedTribe.TribeName; switch (selectedTribe.TribeRelation) { case Tribe.Relation.Allied: radioButtonAllied.Checked = true; break; case Tribe.Relation.Friendly: radioButtonFriendly.Checked = true; break; case Tribe.Relation.Neutral: radioButtonNeutral.Checked = true; break; case Tribe.Relation.Hostile: radioButtonHostile.Checked = true; break; } textBoxTribeNotes.Text = selectedTribe.Note; tabControl1.SelectedTab = tabPageTribe; } }
public void addTribe(string name = "") { Tribe t = new Tribe(); t.TribeName = (name.Length > 0 ? name : "<new Tribe>"); tribes.Add(t); updateTribeList(); int i = listViewTribes.Items.Count - 1; listViewTribes.Items[i].Selected = true; listViewTribes.Items[i].Focused = true; textBoxTribeName.SelectAll(); textBoxTribeName.Focus(); }
public void addTribe(string name = "") { Tribe t = new Tribe(); t.TribeName = (name.Length > 0 ? name : "<new Tribe>"); tribes.Add(t); updateTribeList(); int i = listViewTribes.Items.Count - 1; listViewTribes.Items[i].Selected = true; listViewTribes.Items[i].Focused = true; textBoxTribeName.SelectAll(); textBoxTribeName.Focus(); }
/// <summary> /// Add tribe to tribe list. /// </summary> /// <param name="name"></param> public void AddTribe(string name = null) { Tribe t = new Tribe { TribeName = string.IsNullOrEmpty(name) ? "<new Tribe>" : name }; tribes.Add(t); UpdateTribeList(); int i = listViewTribes.Items.Count - 1; listViewTribes.Items[i].Selected = true; listViewTribes.Items[i].Focused = true; textBoxTribeName.SelectAll(); textBoxTribeName.Focus(); }
private void updateTribeRowRelation(ListViewItem tribeRow, Tribe.Relation rel) { string tribe = tribeRow.SubItems[0].Text; tribeRow.SubItems[1].Text = rel.ToString(); Color c = relationColor(rel); tribeRow.SubItems[1].BackColor = c; updatePlayerList(); }
private Color relationColor(Tribe.Relation r) { switch (r) { case Tribe.Relation.Allied: return Color.LightBlue; case Tribe.Relation.Friendly: return Color.LightGreen; case Tribe.Relation.Neutral: return Color.Yellow; case Tribe.Relation.Hostile: return Color.LightSalmon; } return Color.White; }
private void listViewTribes_SelectedIndexChanged(object sender, EventArgs e) { bool tribeSelected = listViewTribes.SelectedIndices.Count > 0; if (tribeSelected) { panelPlayerSettings.Visible = false; panelTribeSettings.Visible = true; selectedTribe = (Tribe)listViewTribes.SelectedItems[0].Tag; selectedTribeRow = listViewTribes.SelectedItems[0]; textBoxTribeName.Text = selectedTribe.TribeName; switch (selectedTribe.TribeRelation) { case Tribe.Relation.Allied: radioButtonAllied.Checked = true; break; case Tribe.Relation.Friendly: radioButtonFriendly.Checked = true; break; case Tribe.Relation.Neutral: radioButtonNeutral.Checked = true; break; case Tribe.Relation.Hostile: radioButtonHostile.Checked = true; break; } textBoxTribeNotes.Text = selectedTribe.Note; } panelTribeSettings.Enabled = tribeSelected; }