/// <summary>
        /// Handles the saved event of the Single Concept matching control.
        /// Adds the encoded term to the encoded list box.
        /// </summary>
        /// <param name="sender">The single concept matching control.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void SingleConceptMatching_Saved(object sender, System.Windows.RoutedEventArgs e)
        {
            if (this.connected && this.SingleConceptMatching.InputBoxSelectedItem != null)
            {
                ObservableCollection <AdditionalTextBoxResult> additionalTextBoxResults = new ObservableCollection <AdditionalTextBoxResult>();

                foreach (object o in this.SingleConceptMatching.AdditionalTextBoxSelectedTerms)
                {
                    AdditionalTextBoxResult additionalTextBoxResult = o as AdditionalTextBoxResult;

                    if (additionalTextBoxResult != null)
                    {
                        additionalTextBoxResults.Add(additionalTextBoxResult);
                    }
                }

                this.ShowProgressBar();

                TerminologyManager.EncodeConcept(this.SingleConceptMatching.InputBoxSelectedItem as InputFieldResult, additionalTextBoxResults);
            }
            else
            {
                this.EncodeOutput(CreateUnencodedConcept(this.SingleConceptMatching.InputBoxText));

                this.SingleConceptMatching.Clear();
                this.SingleConceptMatching.FocusInputBox();
            }

            this.lastInputBoxResults          = null;
            this.lastInputBoxSearch           = string.Empty;
            this.lastAdditionalTextBoxSearch  = string.Empty;
            this.lastAdditionalTextBoxResults = null;
        }
 /// <summary>
 /// Handles the filter combo box selected index changed.
 /// </summary>
 /// <param name="sender">The Single Concept Matching control.</param>
 /// <param name="e">Selection Changed Event Args.</param>
 private void SingleConceptMatching_FilterSelectedIndexChanged(object sender, SelectionChangedEventArgs e)
 {
     this.lastInputBoxSearch           = string.Empty;
     this.lastInputBoxResults          = null;
     this.lastAdditionalTextBoxSearch  = string.Empty;
     this.lastAdditionalTextBoxResults = null;
     this.SingleConceptMatching.InputBoxItemsSource  = null;
     this.SingleConceptMatching.InputBoxSelectedItem = null;
     this.Search();
 }
        /// <summary>
        /// Handles the Reset Button click event which clears the form.
        /// </summary>
        /// <param name="sender">The reset form button.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void ResetFormButtonClick(object sender, System.Windows.RoutedEventArgs e)
        {
            this.SingleConceptMatching.Clear();
            this.lastInputBoxResults          = null;
            this.lastInputBoxSearch           = string.Empty;
            this.lastAdditionalTextBoxSearch  = string.Empty;
            this.lastAdditionalTextBoxResults = null;
            this.outputs.Clear();
            this.SelectedOutputContentPresenter.Content = new SingleConceptMatchingOutput();

            if (this.connected)
            {
                this.StatusText.Text = string.Empty;
            }

            this.ScenarioComboBox.SelectedIndex   = 0;
            this.SearchTypeComboBox.SelectedIndex = 0;
            this.ScenarioComboBox.Focus();
        }
 /// <summary>
 /// Handles the selection changed event of the Scenario ComboBox control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Windows.Controls.SelectionChangedEventArgs"/> instance containing the event data.</param>
 private void ScenarioComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     this.lastInputBoxResults          = null;
     this.lastInputBoxSearch           = string.Empty;
     this.lastAdditionalTextBoxSearch  = string.Empty;
     this.lastAdditionalTextBoxResults = null;
     this.SingleConceptMatching.InputBoxSelectedItem = null;
     this.SingleConceptMatching.InputBoxItemsSource  = null;
     this.SingleConceptMatching.AdditionalTextBoxMatchingTermItemsSource = null;
     if (e.AddedItems != null && e.AddedItems.Count > 0)
     {
         Scenario scenario;
         if ((scenario = (e.AddedItems[0] as Scenario)) != null)
         {
             this.SingleConceptMatching.SubsetPickerItemsSource   = scenario.FilterItemCollection;
             this.SingleConceptMatching.InputBoxLabelText         = scenario.TitleText;
             this.SingleConceptMatching.InputBoxWatermark         = scenario.WatermarkText;
             this.SingleConceptMatching.SubsetPickerSelectedIndex = 0;
         }
     }
 }
        /// <summary>
        /// Handles the input box search completed event of the Terminology Manager.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="InputFieldSearchCompletedEventArgs"/> instance containing the event data.</param>
        private void TerminologyManagerInputBoxSearchCompleted(object sender, InputFieldSearchCompletedEventArgs e)
        {
            // Check search is for the latest value in the text box
            if (SingleConceptMatchingPage.FixupInputText(this.SingleConceptMatching.InputBoxText) != e.SearchTextOriginal)
            {
                return;
            }

            if (e.Successful)
            {
                if (e.InputFieldResults != null && e.InputFieldResults.Count > 0)
                {
                    this.lastInputBoxResults = e;
                    this.SingleConceptMatching.InputBoxItemsSource = e.InputFieldResults;

                    if (e.ExceedsMaxTotal)
                    {
                        this.StatusText.Text = string.Format(System.Globalization.CultureInfo.CurrentCulture, SingleConceptMatchingPage.MoreMatchesFoundText, e.InputFieldResults.Count);
                    }
                    else
                    {
                        this.StatusText.Text = string.Format(System.Globalization.CultureInfo.CurrentCulture, SingleConceptMatchingPage.MatchesFound, e.InputFieldResults.Count);
                    }
                }
                else
                {
                    this.StatusText.Text = SingleConceptMatchingPage.NoMatchesFoundText;
                }
            }
            else
            {
                this.StatusText.Text = SingleConceptMatchingPage.NoMatchesFoundDueToErrorText;
            }

            this.HideProgressBar();
        }
 /// <summary>
 /// Handles the filter combo box selected index changed.
 /// </summary>
 /// <param name="sender">The Single Concept Matching control.</param>
 /// <param name="e">Selection Changed Event Args.</param>
 private void SingleConceptMatching_FilterSelectedIndexChanged(object sender, SelectionChangedEventArgs e)
 {
     this.lastInputBoxSearch = string.Empty;
     this.lastInputBoxResults = null;
     this.lastAdditionalTextBoxSearch = string.Empty;
     this.lastAdditionalTextBoxResults = null;
     this.SingleConceptMatching.InputBoxItemsSource = null;
     this.SingleConceptMatching.InputBoxSelectedItem = null;
     this.Search();
 }
        /// <summary>
        /// Handles the saved event of the Single Concept matching control.
        /// Adds the encoded term to the encoded list box.
        /// </summary>
        /// <param name="sender">The single concept matching control.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void SingleConceptMatching_Saved(object sender, System.Windows.RoutedEventArgs e)
        {
            if (this.connected && this.SingleConceptMatching.InputBoxSelectedItem != null)
            {
                ObservableCollection<AdditionalTextBoxResult> additionalTextBoxResults = new ObservableCollection<AdditionalTextBoxResult>();

                foreach (object o in this.SingleConceptMatching.AdditionalTextBoxSelectedTerms)
                {
                    AdditionalTextBoxResult additionalTextBoxResult = o as AdditionalTextBoxResult;

                    if (additionalTextBoxResult != null)
                    {
                        additionalTextBoxResults.Add(additionalTextBoxResult);
                    }
                }

                this.ShowProgressBar();

                TerminologyManager.EncodeConcept(this.SingleConceptMatching.InputBoxSelectedItem as InputFieldResult, additionalTextBoxResults);
            }
            else
            {
                this.EncodeOutput(CreateUnencodedConcept(this.SingleConceptMatching.InputBoxText));

                this.SingleConceptMatching.Clear();
                this.SingleConceptMatching.FocusInputBox();
            }

            this.lastInputBoxResults = null;
            this.lastInputBoxSearch = string.Empty;
            this.lastAdditionalTextBoxSearch = string.Empty;
            this.lastAdditionalTextBoxResults = null;
        }
        /// <summary>
        /// Handles the Reset Button click event which clears the form.
        /// </summary>
        /// <param name="sender">The reset form button.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void ResetFormButtonClick(object sender, System.Windows.RoutedEventArgs e)
        {
            this.SingleConceptMatching.Clear();
            this.lastInputBoxResults = null;
            this.lastInputBoxSearch = string.Empty;
            this.lastAdditionalTextBoxSearch = string.Empty;
            this.lastAdditionalTextBoxResults = null;
            this.outputs.Clear();
            this.SelectedOutputContentPresenter.Content = new SingleConceptMatchingOutput();

            if (this.connected)
            {
                this.StatusText.Text = string.Empty;
            }

            this.ScenarioComboBox.SelectedIndex = 0;
            this.SearchTypeComboBox.SelectedIndex = 0;
            this.ScenarioComboBox.Focus();
        }
 /// <summary>
 /// Handles the selection changed event of the Scenario ComboBox control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Windows.Controls.SelectionChangedEventArgs"/> instance containing the event data.</param>
 private void ScenarioComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     this.lastInputBoxResults = null;
     this.lastInputBoxSearch = string.Empty;
     this.lastAdditionalTextBoxSearch = string.Empty;
     this.lastAdditionalTextBoxResults = null;
     this.SingleConceptMatching.InputBoxSelectedItem = null;
     this.SingleConceptMatching.InputBoxItemsSource = null;
     this.SingleConceptMatching.AdditionalTextBoxMatchingTermItemsSource = null;
     if (e.AddedItems != null && e.AddedItems.Count > 0)
     {
         Scenario scenario;
         if ((scenario = (e.AddedItems[0] as Scenario)) != null)
         {
             this.SingleConceptMatching.SubsetPickerItemsSource = scenario.FilterItemCollection;
             this.SingleConceptMatching.InputBoxLabelText = scenario.TitleText;
             this.SingleConceptMatching.InputBoxWatermark = scenario.WatermarkText;
             this.SingleConceptMatching.SubsetPickerSelectedIndex = 0;
         }
     }
 }
        /// <summary>
        /// Handles the input box search completed event of the Terminology Manager.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="InputFieldSearchCompletedEventArgs"/> instance containing the event data.</param>
        private void TerminologyManagerInputBoxSearchCompleted(object sender, InputFieldSearchCompletedEventArgs e)
        {
            // Check search is for the latest value in the text box
            if (SingleConceptMatchingPage.FixupInputText(this.SingleConceptMatching.InputBoxText) != e.SearchTextOriginal)
            {
                return;
            }

            if (e.Successful)
            {
                if (e.InputFieldResults != null && e.InputFieldResults.Count > 0)
                {
                    this.lastInputBoxResults = e;
                    this.SingleConceptMatching.InputBoxItemsSource = e.InputFieldResults;

                    if (e.ExceedsMaxTotal)
                    {
                        this.StatusText.Text = string.Format(System.Globalization.CultureInfo.CurrentCulture, SingleConceptMatchingPage.MoreMatchesFoundText, e.InputFieldResults.Count);
                    }
                    else
                    {
                        this.StatusText.Text = string.Format(System.Globalization.CultureInfo.CurrentCulture, SingleConceptMatchingPage.MatchesFound, e.InputFieldResults.Count);
                    }
                }
                else
                {
                    this.StatusText.Text = SingleConceptMatchingPage.NoMatchesFoundText;
                }
            }
            else
            {
                this.StatusText.Text = SingleConceptMatchingPage.NoMatchesFoundDueToErrorText;
            }

            this.HideProgressBar();
        }