private void AcceptDialog(object sender, RoutedEventArgs e) { if (!Validation.GetHasError(FeatName) && !Validation.GetHasError(FeatDescription) && !Validation.GetHasError(FeatBenefit)) { string featName = FeatName.Text; string featDes = FeatDescription.Text; string featBen = FeatBenefit.Text; string featPre = FeatPrerequisites.Text; string featSpe = FeatSpecial.Text; string featType = FeatType.Text; string featNormal = FeatNormal.Text; var forgeDatabase = Global.Instance.ForgeDatabase(); FEAT feat = new FEAT() { Name = featName, Description = featDes, Benefit = featBen, Prerequisites = featPre, Special = featSpe, Type = featType, Normal = featNormal }; forgeDatabase.Feats.InsertOnSubmit(feat); forgeDatabase.SubmitChanges(); PopulateFeatCollection(); IoC.Get <IEventAggregator>().PublishOnUIThread("AcceptAddFeatDialog"); IoC.Get <IEventAggregator>().PublishOnUIThread("AcceptRootDialog"); } }
public void DeleteFeat() { try { int featID = FeatCollection[SelectedIndex].FeatID; var forgeDatabase = Global.Instance.ForgeDatabase(); FEAT feat = forgeDatabase.Feats.Single(x => x.ID == featID); forgeDatabase.Feats.DeleteOnSubmit(feat); forgeDatabase.SubmitChanges(); FeatCollection.RemoveAt(SelectedIndex); Global.Instance.FeatCollection = new BindableCollection <FeatCollection>(FeatCollection); ClearFeatInfo(); SelectedIndex = -1; } catch { } }