/// <summary> /// Intializes the combox box containing the searchable properties available. /// </summary> private void InitializePropertyComboBox() { //get the entire extended list of properties PropDef[] defs = m_connection.WebServiceManager.PropertyService.GetPropertyDefinitionsByEntityClassId(VDF.Vault.Currency.Entities.EntityClassIds.Files); if (defs != null && defs.Length > 0) { Array.Sort(defs, new PropertyDefinitionSorter()); //wait to draw the combo box until we've added all of the properties m_propertyComboBox.BeginUpdate(); m_propertyComboBox.Items.Clear(); foreach (PropDef def in defs) { //create a list item type that will hold the property ListBoxPropDefItem item = new ListBoxPropDefItem(def); m_propertyComboBox.Items.Add(item); } //indicate that we've finished updated the combobox and it can now be re-drawn m_propertyComboBox.EndUpdate(); } }
private void AddCriteriaButton_Click(object sender, System.EventArgs e) { //get a local reference of the currently selected PropertyDefinition object ListBoxPropDefItem propertyItem = m_propertyComboBox.SelectedItem as ListBoxPropDefItem; PropDef property; property = (propertyItem == null) ? null : propertyItem.PropDef; //get local reference of the condition combo boxes currently selected item Condition condition = m_conditionComboBox.SelectedItem as Condition; if (property == null || condition == null) { return; } //create a SearchCondition object SrchCond searchCondition = new SrchCond(); searchCondition.PropDefId = property.Id; searchCondition.PropTyp = PropertySearchType.SingleProperty; searchCondition.SrchOper = condition.Code; searchCondition.SrchTxt = m_valueTextBox.Text; //create the list item to contain the condition ListBoxSrchCondItem searchItem = new ListBoxSrchCondItem(searchCondition, property); //add the SearchCondition object to the search criteria list box m_criteriaListBox.Items.Add(searchItem); }