public EditQuestData(QuestData data) { InitializeComponent(); foreach( QuestItem item in data.Receive) { lstItemsWanted.Items.Add(item); } foreach (QuestItem item in data.Give) { lstRewards.Items.Add(item); } txtCompleteMsg.Text = data.Complete; txtDisappearMsg.Text = data.Disappear; }
public QuestData GetQuestData() { QuestData data = new QuestData(); data.Complete = txtCompleteMsg.Text; data.Disappear = txtDisappearMsg.Text; foreach (object obj in lstItemsWanted.Items) { if (obj is QuestItem) { data.Receive.Add((QuestItem)obj); } } foreach (object obj in lstRewards.Items) { if (obj is QuestItem) { data.Give.Add((QuestItem)obj); } } return data; }