Example #1
0
        /// <summary>
        /// Handles the completion event on the tag expression editor to begin
        /// the test run using the user-provided settings.
        /// </summary>
        /// <param name="sender">The source object.</param>
        /// <param name="e">The event arguments.</param>
        protected virtual void OnTagExpressionSelected(object sender, TagExpressionEventArgs e)
        {
            TagEditor te = sender as TagEditor;

            if (te != null)
            {
                te.Complete -= OnTagExpressionSelected;
            }

            //TagEditorHolder.Children.Clear();
            TagEditorHolder.Visibility = Visibility.Collapsed;
            TestExecution.Visibility   = Visibility.Visible;

            if (_harness != null)
            {
                if (e != null && _harness.Settings != null)
                {
                    _harness.Settings.TagExpression = e.TagExpression;
                }

                // Start the test run
                StartTestRun();
            }
        }
Example #2
0
        /// <summary>
        /// Waits for the Settings to become available, either by the service or
        /// system setting the instance property.
        /// </summary>
        /// <param name="sender">The source timer.</param>
        /// <param name="e">The event arguments.</param>
        private void OnDelayedInitializationTick(object sender, EventArgs e)
        {
            if (_harness != null && _harness.Settings != null)
            {
                _delayedInitializationTimer.Stop();
                _delayedInitializationTimer.Tick -= OnDelayedInitializationTick;
                _delayedInitializationTimer       = null;

                PassButton.Style  = this.Resources["CounterButtonStyle"] as Style;
                FailButton.Style  = this.Resources["CounterButtonStyle"] as Style;
                TotalButton.Style = this.Resources["CounterButtonStyle"] as Style;

                UIElement rootVisual = Application.Current.RootVisual;
                if (rootVisual is PhoneApplicationFrame)
                {
                    PhoneApplicationPage mainPage = (((PhoneApplicationFrame)rootVisual).Content as PhoneApplicationPage);

                    mainPage.BackKeyPress += OnBackKeyPress;
                }

                // Tag expression support
                TagEditor tagEditor = null;
                if (_harness.Settings != null)
                {
                    if (_harness.Settings.StartRunImmediately)
                    {
                        tagEditor = null;
                    }
                    else
                    {
                        if (_harness.Settings.TagExpression != null)
                        {
                            if (_harness.Settings.SampleTags != null)
                            {
                                tagEditor = new TagEditor(_harness.Settings.TagExpression, _harness.Settings.SampleTags);
                            }
                            else
                            {
                                tagEditor = new TagEditor(_harness.Settings.TagExpression);
                            }
                        }
                        else
                        {
                            tagEditor = new TagEditor();
                        }
                    }
                }
                else
                {
                    tagEditor = new TagEditor();
                }

                if (tagEditor == null)
                {
                    StartTestRun();
                    return;
                }

                TagEditorHolder.Children.Add(tagEditor);

                // Hide Current content and display TagEditor Interface
                TestExecution.Visibility   = Visibility.Collapsed;
                TagEditorHolder.Visibility = Visibility.Visible;

                tagEditor.Complete += OnTagExpressionSelected;
            }
        }
Example #3
0
    /// <summary>
    /// Waits for the Settings to become available, either by the service or
    /// system setting the instance property.
    /// </summary>
    /// <param name="sender">The source timer.</param>
    /// <param name="e">The event arguments.</param>
    private void OnDelayedInitializationTick(object sender, EventArgs e)
    {
      if (_harness != null && _harness.Settings != null)
      {
        _delayedInitializationTimer.Stop();
        _delayedInitializationTimer.Tick -= OnDelayedInitializationTick;
        _delayedInitializationTimer = null;

        PassButton.Style = this.Resources["CounterButtonStyle"] as Style;
        FailButton.Style = this.Resources["CounterButtonStyle"] as Style;
        TotalButton.Style = this.Resources["CounterButtonStyle"] as Style;

        UIElement rootVisual = Application.Current.RootVisual;
        if (rootVisual is PhoneApplicationFrame)
        {
          PhoneApplicationPage mainPage = (((PhoneApplicationFrame)rootVisual).Content as PhoneApplicationPage);

          mainPage.BackKeyPress += OnBackKeyPress;
        }

        // Tag expression support
        TagEditor tagEditor = null;
        if (_harness.Settings != null)
        {
          if (_harness.Settings.StartRunImmediately)
          {
            tagEditor = null;
          }
          else
          {
            if (_harness.Settings.TagExpression != null)
            {
              if (_harness.Settings.SampleTags != null)
              {
                tagEditor = new TagEditor(_harness.Settings.TagExpression, _harness.Settings.SampleTags);
              }
              else
              {
                tagEditor = new TagEditor(_harness.Settings.TagExpression);
              }
            }
            else
            {
              tagEditor = new TagEditor();
            }
          }
        }
        else
        {
          tagEditor = new TagEditor();
        }

        if (tagEditor == null)
        {
          StartTestRun();
          return;
        }

        TagEditorHolder.Children.Add(tagEditor);

        // Hide Current content and display TagEditor Interface
        TestExecution.Visibility = Visibility.Collapsed;
        TagEditorHolder.Visibility = Visibility.Visible;

        tagEditor.Complete += OnTagExpressionSelected;
      }
    }