/// <summary>
        /// Processes the response to the SupportedCultures command.
        /// </summary>
        /// <param name="supportedCulturesResponse">Command response data.</param>
        private void ProcessSupportedCulturesResponse(XElement supportedCulturesResponse)
        {
            //Expected response
            //<SupportedCultures>
            //  <Culture Key="..." Name="..."/>
            //  ...
            //</SupportedCultures>

            using (SupportedCultures.AcquireLock())
            {
                SupportedCultures.Clear();

                foreach (var languageElement in supportedCulturesResponse.Elements("Culture"))
                {
                    var key  = languageElement.Attribute("Key").Value;
                    var name = languageElement.Attribute("Name").Value;

                    SupportedCultures.Add(new LanguageElement(key, name));
                }

                if (SupportedCultures.Count > 0)
                {
                    SelectedLanguage = SupportedCultures[0];
                }
            }
        }
        /// <summary>
        /// Called when a property change notification is raised on this view model. This view model
        /// uses this method to monitor when the Connected property is changed. This logic could have
        /// been placed in the Connected property setter, but putting it here keeps the property setter simple.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event arguments.</param>
        void ConnectionViewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "Connected")
            {
                LoggedOn    = false;
                LogOnResult = String.Empty;

                if (Connected)
                {
                    //We have become connected, so send a to get general information about
                    //the instrument we have connected to. These commands can be executed without
                    //first executing a Logon command.
                    SendData(new SendDataEventArgs(_versionCommandDocument.ToString(), this));
                    SendData(new SendDataEventArgs(_supportedCulturesCommandDocument.ToString(), this));
                    SendData(new SendDataEventArgs(_instrumentInfoCommandDocument.ToString(), this));
                }
                else
                {
                    //We have become disconnected, so clear out our data.
                    InstrumentVersion = String.Empty;
                    ProtocolVersion   = String.Empty;
                    SelectedLanguage  = null;
                    Options           = String.Empty;
                    Family            = string.Empty;

                    using (SupportedCultures.AcquireLock())
                    {
                        SupportedCultures.Clear();
                    }

                    using (InstrumentInfo.AcquireLock())
                    {
                        InstrumentInfo.Clear();
                    }
                }
            }
        }