private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.Source is TabControl)
            {
                ApplicationViewModel app = (ApplicationViewModel)DataContext;

                if (TabItemConfiguration.IsSelected)
                {
                    if (_configurationViewModel == null)
                    {
                        _configurationViewModel = new ConfigurationViewModel(app);
                    }

                    app.ChangeViewModel(_configurationViewModel);
                }
                else if (TabItemParticipants.IsSelected)
                {
                    if (_participantsViewModel == null)
                    {
                        _participantsViewModel = new ParticipantsViewModel(app);
                    }

                    app.ChangeViewModel(_participantsViewModel);
                }
                else if (TabItemTests.IsSelected)
                {
                    if (_testsViewModel == null)
                    {
                        _testsViewModel = new TestsViewModel(app);
                        app.ChangeViewModel(_testsViewModel);
                    }
                    else
                    {
                        PoseCalibrationViewModel dcVM = (PoseCalibrationViewModel)app.PageViewModels.Find(r => r.Name == "DS" || r.Name == "SS" || r.Name == "TS");

                        if (dcVM != null)
                        {
                            app.ChangeViewModel(dcVM);
                        }
                        else
                        {
                            app.ChangeViewModel(_testsViewModel);
                        }
                    }
                }
                else if (TabItemReview.IsSelected)
                {
                    if (_reviewViewModel == null)
                    {
                        _reviewViewModel = new ReviewViewModel(app);
                    }

                    app.ChangeViewModel(_reviewViewModel);
                }
            }
        }
        /// <summary>
        /// Gets the participant id. It is used for operations onto participant profile (delete, edit, new).
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lbId_TextChanged(object sender, TextChangedEventArgs e)
        {
            ParticipantsViewModel participant = (ParticipantsViewModel)this.DataContext;
            TextBox txt = (TextBox)sender;

            if (txt.Text != "")
            {
                participant.SessionId = Int32.Parse(txt.Text);
            }
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ParticipantsViewModel participant = (ParticipantsViewModel)this.DataContext;
            XmlDataProvider       resource    = this.FindResource("Participants") as XmlDataProvider;

            if (resource != null)
            {
                System.Collections.ICollection participants = (System.Collections.ICollection)resource.Data;

                foreach (XmlNode xn in participants)
                {
                    if (Int32.Parse(xn.Attributes["Id"].Value) == participant.SessionId)
                    {
                        participant.ParticipantName = xn.Attributes["Name"].Value;
                        break;
                    }
                }
            }
        }