void OnXpathCreated(object sender, RoutedEventArgs e) { //user created a xpath var editor = (MessageQueryEditor)sender; //get its value var query = editor.Query; if (null != query) { //get reference to message query set dictionary var messageQuerySet = this.MessageQuerySetContainer.Properties[this.querySetPropertyName].Dictionary; //create unique key name var name = messageQuerySet.GetUniqueName(key, p => (string)p.GetCurrentValue()); //add new entry with created key and query messageQuerySet.Add(name, query); //look for created key value pair var entry = messageQuerySet.First(p => string.Equals(p.Key.GetCurrentValue(), name)); //wrap it var wrapper = new MessageQueryEntry(entry); //and add it to the ui this.messageQueriesDGHelper.Source <IList>().Add(wrapper); } //reset editor, so new query can be created editor.SelectedItem = null; }
//method called whenever Activity or MessageQuerySetContainer changes void OnInitialzeView() { //cleanup previous ui binding this.dataSource.Clear(); //if we have activity and valid message query set container if (null != this.Activity && null != this.MessageQuerySetContainer && !string.IsNullOrEmpty(this.querySetPropertyName)) { //check if message query set is initialized if (!this.MessageQuerySetContainer.Properties[this.querySetPropertyName].IsSet) { //initialize if required this.MessageQuerySetContainer.Properties[this.querySetPropertyName].SetValue(new MessageQuerySet()); } //get reference to message query set var input = this.MessageQuerySetContainer.Properties[this.querySetPropertyName].Dictionary; if (null != input) { //create all model objects into ux collection foreach (var entry in input) { var wrapper = new MessageQueryEntry(entry); this.dataSource.Add(wrapper); } this.IsTypeExpanderEnabled = true; } } }
void OnXpathCreated(object sender, RoutedEventArgs e) { //user created a xpath var editor = (MessageQueryEditor)sender; //get its value var query = editor.Query; if (null != query) { //get reference to message query set dictionary var messageQuerySet = this.MessageQuerySetContainer.Properties[this.querySetPropertyName].Dictionary; //create unique key name var name = messageQuerySet.GetUniqueName(key, p => (string)p.GetCurrentValue()); //add new entry with created key and query messageQuerySet.Add(name, query); //look for created key value pair var entry = messageQuerySet.First(p => string.Equals(p.Key.GetCurrentValue(), name)); //wrap it var wrapper = new MessageQueryEntry(entry); //and add it to the ui this.messageQueriesDGHelper.Source<IList>().Add(wrapper); } //reset editor, so new query can be created editor.SelectedItem = null; }