private void OpenFile()
 {
     if (m_searchResultsListBox.SelectedItem != null)
     {
         ListBoxFileItem fileItem = (ListBoxFileItem)m_searchResultsListBox.SelectedItem;
         OpenFileCommand.Execute(fileItem.File, m_connection);
     }
 }
        private void FindButton_Click(object sender, System.EventArgs e)
        {
            //make sure search conditions have been added
            if (m_criteriaListBox.Items.Count > 0)
            {
                //clear out previous search results if they exist
                m_searchResultsListBox.Items.Clear();

                //build our array of SearchConditions to use for the file search
                SrchCond[] conditions = new SrchCond[m_criteriaListBox.Items.Count];

                for (int i = 0; i < m_criteriaListBox.Items.Count; i++)
                {
                    conditions[i] = ((ListBoxSrchCondItem)m_criteriaListBox.Items[i]).SrchCond;
                }

                string     bookmark = string.Empty;
                SrchStatus status   = null;

                //search for files
                List <File> fileList = new List <File>();

                while (status == null || fileList.Count < status.TotalHits)
                {
                    File[] files = m_connection.WebServiceManager.DocumentService.FindFilesBySearchConditions(
                        conditions, null, null, true, true,
                        ref bookmark, out status);

                    if (files != null)
                    {
                        fileList.AddRange(files);
                    }
                }

                if (fileList.Count > 0)
                {
                    //iterate through found files and display them in the search results list box
                    foreach (File file in fileList)
                    {
                        //create the list item that will wrap the File
                        ListBoxFileItem fileItem = new ListBoxFileItem(new VDF.Vault.Currency.Entities.FileIteration(m_connection, file));

                        m_searchResultsListBox.Items.Add(fileItem);
                    }
                }

                //update the items count label
                m_itemsCountLabel.Text = (fileList.Count > 0) ? fileList.Count + " Items" : "0 Items";
            }
        }