private void btnDuplicateWeatherTypeListItem_Click(object sender, EventArgs e) { if (lbxWeatherTypeListItems.SelectedIndex >= 0) { WeatherTypeListItem newCopy = prntForm.weathersList[lbxWeathers.SelectedIndex].weatherTypeLists[lbxWeatherTypeLists.SelectedIndex].weatherTypeListItems[lbxWeatherTypeListItems.SelectedIndex].DeepCopy(); newCopy.tag = "newWeatherTypeListItemTag_" + prntForm.mod.nextIdNumber.ToString(); prntForm.weathersList[lbxWeathers.SelectedIndex].weatherTypeLists[lbxWeatherTypeLists.SelectedIndex].weatherTypeListItems.Add(newCopy); refreshListBox(); } }
private void btnAddWeatherTypeListItem_Click(object sender, EventArgs e) { if ((lbxWeathers.SelectedIndex >= 0) && (lbxWeatherTypeLists.SelectedIndex >= 0)) { WeatherTypeListItem newTS = new WeatherTypeListItem(); newTS.name = "newWeatherTypeListItem"; newTS.tag = "newWeatherTypeListItemTag_" + prntForm.mod.nextIdNumber.ToString(); prntForm.weathersList[lbxWeathers.SelectedIndex].weatherTypeLists[lbxWeatherTypeLists.SelectedIndex].weatherTypeListItems.Add(newTS); refreshListBoxAdd3(); } }
public WeatherTypeList DeepCopy() { //WeatherTypeList other = (WeatherTypeList)this.MemberwiseClone(); WeatherTypeList other = new WeatherTypeList(); other._name = this._name; other.name = this.name; other._tag = this._tag; other.tag = this.tag; foreach (WeatherTypeListItem wtli in this.weatherTypeListItems) { WeatherTypeListItem wtli2 = wtli.DeepCopy(); other.weatherTypeListItems.Add(wtli2); } return(other); }
public WeatherTypeListItem DeepCopy() { //WeatherTypeListItem other = (WeatherTypeListItem)this.MemberwiseClone(); //WeatherTypeListItem other = (WeatherTypeListItem)this.Clone(); WeatherTypeListItem other = new WeatherTypeListItem(); other._name = this._name; other.name = this.name; other._tag = this._tag; other.tag = this.tag; other._chance = this._chance; other.chance = this.chance; other._duration = this._duration; other.duration = this.duration; other._weatherEffectName = this._weatherEffectName; other.weatherEffectName = this.weatherEffectName; return(other); }