Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the VGBrowser class.
 /// Clone Constructor. Creates new VGBrowser that is
 /// identical to the given <see cref="VGBrowser"/>.
 /// </summary>
 /// <param name="oldBrowser">Browser element to clone.</param>
 private VGBrowser(VGBrowser oldBrowser)
     : base(
         oldBrowser.ShapeDrawAction,
         oldBrowser.Pen,
         oldBrowser.Brush,
         oldBrowser.Font,
         oldBrowser.FontColor,
         oldBrowser.Bounds,
         oldBrowser.StyleGroup,
         oldBrowser.Name,
         oldBrowser.ElementGroup,
         oldBrowser.Sound)
 {
     this.InitializeFields();
     this.BrowserURL  = oldBrowser.BrowserURL;
     this.BrowseDepth = oldBrowser.BrowseDepth;
 }
Exemplo n.º 2
0
    /// <summary>
    /// This method initializes the next slide in the given
    ///   <see cref="SlidePresentationContainer"/>.
    ///   That is setting a time stop condition timer,
    ///   setup audio replay, and load flash objects.
    ///   Because this can last a significant amount of time
    ///   it should be done in a background thread.
    /// </summary>
    /// <param name="slideContainer">
    /// The <see cref="SlidePresentationContainer"/>
    ///   that should be initialized.
    /// </param>
    private void InitializeNextSlide(SlidePresentationContainer slideContainer)
    {
      try
      {
        // Reset Timer to 1ms period indicating that it should not be used during
        // call to PlaySlideContainer
        slideContainer.Timer.Period = 1;

        // Reset the timer according to stop condition if applicable.
        foreach (StopCondition condition in slideContainer.Slide.StopConditions)
        {
          if (condition is TimeStopCondition)
          {
            var timeCondition = (TimeStopCondition)condition;
            slideContainer.Timer.Period = timeCondition.Duration;
            break;
          }
        }

        // Search for audio files
        this.ParseElementsForAudio(slideContainer);

        // Load background sound
        if (slideContainer.Slide.BackgroundSound != null)
        {
          if (slideContainer.Slide.BackgroundSound.ShouldPlay)
          {
            slideContainer.AudioPlayer.AddAudioChannel(slideContainer.Slide.BackgroundSound.FullFilename);
          }
        }

        // Check for flash stimuli and load them into the
        // flashObject activeX control.
        foreach (VGElement element in slideContainer.Slide.ActiveXStimuli)
        {
          if (element is VGFlash)
          {
            var flash = element as VGFlash;
            flash.InitializeOnControl(slideContainer.ContainerControl, true, new System.Drawing.Drawing2D.Matrix());
          }
          else if (element is VGBrowser)
          {
            var browser = element as VGBrowser;
            this.currentVgBrowser = browser;
            browser.InitializeOnControl(slideContainer.ContainerControl, true);
            browser.WebBrowser.NewWindow += this.WebBrowser_NewWindow;
            browser.WebBrowser.DocumentCompleted += this.WebBrowserDocumentCompleted;
            browser.WebBrowser.Navigating += this.WebBrowserNavigating;

            // if (browser.WebBrowser.Url != null && browser.WebBrowser.Document != null)
            // {
            // // Attach Scroll events in document completed handler
            // browser.WebBrowser.Document.MouseDown += this.WebBrowserMouseDown;
            // }
            browser.WebBrowser.Navigate(browser.BrowserURL);
            this.numberOfTimesNavigated = 0;
            this.maxBrowseDepth = browser.BrowseDepth;
            this.currentBrowserTreeNode =
              (BrowserTreeNode)Document.ActiveDocument.ExperimentSettings.SlideShow.GetNodeByID(slideContainer.Trial.ID);
          }
        }
      }
      catch (Exception ex)
      {
        ExceptionMethods.HandleExceptionSilent(ex);
      }
    }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the VGBrowser class.
 /// Clone Constructor. Creates new VGBrowser that is
 /// identical to the given <see cref="VGBrowser"/>.
 /// </summary>
 /// <param name="oldBrowser">Browser element to clone.</param>
 private VGBrowser(VGBrowser oldBrowser)
   : base(
   oldBrowser.ShapeDrawAction,
   oldBrowser.Pen,
   oldBrowser.Brush,
   oldBrowser.Font,
   oldBrowser.FontColor,
   oldBrowser.Bounds,
   oldBrowser.StyleGroup,
   oldBrowser.Name,
   oldBrowser.ElementGroup,
   oldBrowser.Sound)
 {
   this.InitializeFields();
   this.BrowserURL = oldBrowser.BrowserURL;
   this.BrowseDepth = oldBrowser.BrowseDepth;
 }
Exemplo n.º 4
0
    /// <summary>
    /// This method creates a <see cref="Slide"/> containing the<see cref="VGBrowser"/>
    /// that can be used to display the website described in the 
    /// given <see cref="BrowserTreeNode"/>
    /// </summary>
    /// <param name="browserSlide">The <see cref="BrowserTreeNode"/> to be converted into a 
    /// presentation slide.</param>
    /// <returns>A <see cref="Slide"/> containing the <see cref="VGBrowser"/>
    /// that displays the web site.</returns>
    private Slide CreateBrowserSlide(BrowserTreeNode browserSlide)
    {
      Slide slide = (Slide)browserSlide.Slide.Clone();

      VGBrowser browser = new VGBrowser(
        ShapeDrawAction.None,
        browserSlide.OriginURL,
        browserSlide.BrowseDepth,
        Pens.Black,
        Brushes.Black,
        SystemFonts.DefaultFont,
        Color.Black,
        PointF.Empty,
        Document.ActiveDocument.PresentationSize,
        VGStyleGroup.ACTIVEX,
        browserSlide.Name,
        string.Empty);
      slide.ActiveXStimuli.Add(browser);
      return slide;
    }