private void StringList_SelectedIndexChanged(object sender, EventArgs e) { //change selected string var ind = SelectedStringInd; SaveButton.Enabled = false; bool enableMod = (ind != -1); StringBox.Enabled = enableMod; CommentBox.Enabled = enableMod; RemoveButton.Enabled = enableMod; UpButton.Enabled = enableMod; DownButton.Enabled = enableMod; SaveButton.Enabled = enableMod; if (ind == -1) { StringBox.Text = ""; CommentBox.Text = ""; } else { StringBox.Text = ActiveString.GetString(ind, ActiveLanguage); CommentBox.Text = ActiveString.GetComment(ind, ActiveLanguage); } OldStr = StringBox.Text; OldComment = CommentBox.Text; }
public void UpdateStrings() { StringList.SelectedItems.Clear(); StringList.Items.Clear(); for (int i = 0; i < ActiveSLOT.Chronological.Count; i++) { var type = ActiveSLOT.Chronological[i].Type; StringList.Items.Add(new ListViewItem(new string[] { Convert.ToString(i), (ActiveSLOTLabel == null) ? "SLOT" : ActiveSLOTLabel.GetString(i), SLOTTypes.FirstOrDefault(x => x.Value == type)?.Name ?? type.ToString(), (ActiveSLOTLabel == null) ? "" : ActiveSLOTLabel.GetComment(i) })); } StringList_SelectedIndexChanged(StringList,new EventArgs()); }