public static void ToFeat(XmlNode Node, FeatCollection Receiver, String Type, String Name) { SimpleInfo Feat = new SimpleInfo(Name, String.Empty); if (Type == "Racial Trait") { Receiver.RacialFeats.Add(Feat); } else if (Type == "Class Feature") { Receiver.ClassFeats.Add(Feat); } else if (Type == "Feat") { Receiver.Feats.Add(Feat); } Int32 Count = Node.ChildNodes.Count; XmlNode Child; for (Int32 I = 0; I < Count; I++) { Child = Node.ChildNodes[I]; if (Child.AttributeToString("name") == "Short Description") { Feat.Text = Child.InnerText.Trim(); } } }
private void PopulateFeatCollectionAsync() { if (Global.Instance.FeatCollection.Count <= 0) { var uiThread = TaskScheduler.FromCurrentSynchronizationContext(); Task bk2Thread = Task.Factory.StartNew(() => ClearFeatInfo()) .ContinueWith(t1 => IoC.Get <IEventAggregator>().PublishOnUIThread("OpenProgressDialog"), uiThread) .ContinueWith(t2 => PopulateFeatCollection()) .ContinueWith(t3 => ClearFeatInfo()) .ContinueWith(t4 => IoC.Get <IEventAggregator>().PublishOnUIThread("CancelRootDialog"), uiThread); } else if (FeatCollection.Count <= 0) { FeatCollection = new BindableCollection <FeatCollection>(Global.Instance.FeatCollection); } else { if (!FeatCollection.SequenceEqual(Global.Instance.FeatCollection)) { var uiThread = TaskScheduler.FromCurrentSynchronizationContext(); Task bk2Thread = Task.Factory.StartNew(() => ClearFeatInfo()) .ContinueWith(t1 => IoC.Get <IEventAggregator>().PublishOnUIThread("OpenProgressDialog"), uiThread) .ContinueWith(t2 => PopulateFeatCollection()) .ContinueWith(t3 => ClearFeatInfo()) .ContinueWith(t4 => IoC.Get <IEventAggregator>().PublishOnUIThread("CancelRootDialog"), uiThread); } } }
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 { } }