/// <summary> /// Initializes a new instance of the Slideshow class by cloneing the given <see cref="Slideshow"/> /// </summary> /// <param name="slideshow">A <see cref="Slideshow"/> to be cloned.</param> public Slideshow(Slideshow slideshow) { this.Name = slideshow.Name; this.Text = slideshow.Text; this.ImageKey = slideshow.ImageKey; this.shuffling = slideshow.Shuffling; foreach (SlideshowTreeNode node in slideshow.Nodes) { this.Nodes.Add((SlideshowTreeNode)node.Clone()); } }
/// <summary> /// This method iterates recursively through the tree to return only the trials /// contained in the tree. /// </summary> /// <param name="trials">Ref. The output <see cref="TrialCollection"/> of trials.</param> /// <param name="node">The <see cref="TreeNode"/> to parse.</param> private void ParseNodeForTrials(ref TrialCollection trials, TreeNode node) { Trial trial = null; // Add trial if this node is marked to be a trial if (node.Tag != null && node.Tag.ToString() == "Trial") { trial = new Trial(node.Text, Slideshow.GetIdOfNode(node)); trials.Add(trial); } foreach (TreeNode subNode in node.Nodes) { SlideshowTreeNode subSlideNode = subNode as SlideshowTreeNode; Slide slide = subSlideNode.Slide; if (slide != null) { // By default use a new trial for each slide trial = new Trial(subNode.Text, Slideshow.GetIdOfNode(subNode)); // If parent is already marked as trial use this // instead. if (subNode.Parent != null && subNode.Parent.Tag != null && subNode.Parent.Tag.ToString() == "Trial") { trial = trials[trials.Count - 1]; } // Add slide to correct trial trial.Add(slide); } // Iterate through the tree. this.ParseNodeForTrials(ref trials, subNode); // If a trial was found, add it to the list. if (trial != null && !trials.Contains(trial)) { trials.Add(trial); } } }
/////////////////////////////////////////////////////////////////////////////// // Eventhandler for Custom Defined Events // /////////////////////////////////////////////////////////////////////////////// #region CUSTOMEVENTHANDLER #endregion //CUSTOMEVENTHANDLER #endregion //EVENTS /////////////////////////////////////////////////////////////////////////////// // Methods and Eventhandling for Background tasks // /////////////////////////////////////////////////////////////////////////////// #region BACKGROUNDWORKER #endregion //BACKGROUNDWORKER /////////////////////////////////////////////////////////////////////////////// // Methods for doing main class job // /////////////////////////////////////////////////////////////////////////////// #region PRIVATEMETHODS /// <summary> /// This method populates the dialogs <see cref="TreeView"/> /// with the given slideshow. /// </summary> /// <param name="slideshow">The <see cref="Slideshow"/> to be used.</param> private void PopulateTreeview(Slideshow slideshow) { Slideshow clone = (Slideshow)slideshow.Clone(); clone.Remove(); this.trvSlideshow.BeginUpdate(); this.trvSlideshow.Nodes.Clear(); this.trvSlideshow.Nodes.Add(clone); this.trvSlideshow.EndUpdate(); this.trvSlideshow.ExpandAll(); }
/// <summary> /// Submits given <see cref="Slideshow"/> to the <see cref="TreeView"/> <see cref="trvSlideshow"/>. /// </summary> /// <param name="slideshow">A <see cref="Slideshow"/> with the slides to import.</param> private void PopulateTreeView(Slideshow slideshow) { this.Cursor = Cursors.WaitCursor; this.trvSlideshow.BeginUpdate(); this.trvSlideshow.Nodes.Clear(); this.trvSlideshow.Nodes.Add(slideshow); this.trvSlideshow.EndUpdate(); this.trvSlideshow.ExpandAll(); this.trvSlideshow.Nodes[0].EnsureVisible(); this.Cursor = Cursors.Default; }
/////////////////////////////////////////////////////////////////////////////// // Construction and Initializing methods // /////////////////////////////////////////////////////////////////////////////// #region CONSTRUCTION /// <summary> /// Initializes a new instance of the ExperimentSettings class. /// </summary> public ExperimentSettings() { this.widthStimulusScreen = 1024; this.heightStimulusScreen = 768; this.documentPath = string.Empty; this.experimentName = string.Empty; this.sqlInstanceName = "SQLEXPRESS"; this.gazeSamplingRate = 60; this.mouseSamplingRate = 10; this.gazeMaxDistance = 20; this.mouseMaxDistance = 20; this.gazeMinSamples = 5; this.mouseMinSamples = 10; this.gazeDiameterDiv = 2; this.mouseDiameterDiv = 5; this.fixationRingSize = 31; this.mergeConsecutiveFixations = true; this.eliminateFirstFixation = false; this.limitForFirstFixation = 300; this.eliminateFirstFixationSimple = false; this.slideShow = new Slideshow(); this.customConnectionString = string.Empty; this.gazeColorParams = new ColorizationParameters(); this.mouseColorParams = new ColorizationParameters(); this.ogamaVersion = new Version(); // Assembly.GetExecutingAssembly().GetName().Version; this.ScreenCaptureFramerate = 10; }
/// <summary> /// The <see cref="Form.Load"/> event handler. /// Initializes this form with the slides from the experiment settings. /// </summary> /// <param name="sender">Source of the event.</param> /// <param name="e">An empty <see cref="EventArgs"/></param> private void frmStimuli_Load(object sender, EventArgs e) { this.slideshow = Document.ActiveDocument.ExperimentSettings.SlideShow; // Populate the tree view with the current slideshow. this.PopulateTreeView(this.slideshow); // Set detail views initial formatting. this.InitializeDetailListView(); // Intialize slide preview picture this.slidePreviewPicture.OwningForm = this; this.slidePreviewPicture.PresentationSize = Document.ActiveDocument.PresentationSize; this.ResizeCanvas(); // Select root node this.trvSlideshow.SelectedNodes.Clear(); this.trvSlideshow.SelectedNodes.Add(this.trvSlideshow.Nodes[0]); }
/////////////////////////////////////////////////////////////////////////////// // Public methods // /////////////////////////////////////////////////////////////////////////////// #region PUBLICMETHODS #endregion //PUBLICMETHODS /////////////////////////////////////////////////////////////////////////////// // Inherited methods // /////////////////////////////////////////////////////////////////////////////// #region OVERRIDES /// <summary> /// Initialize custom elements /// </summary> protected override void InitializeCustomElements() { base.InitializeCustomElements(); this.slideshow = new Slideshow(); this.toolTip = new ToolTip(); this.toolTip.ShowAlways = true; if (SecondaryScreen.SystemHasSecondaryScreen()) { if (Settings.Default.PresentationScreenMonitor == "Primary") { this.btnPrimary.Checked = true; this.btnSecondary.Checked = false; } else { this.btnPrimary.Checked = false; this.btnSecondary.Checked = true; } } else { this.btnPrimary.Visible = false; this.btnSecondary.Visible = false; } // Hide PropertyGrid this.spcPropertiesPreview.Panel1Collapsed = true; this.btnHelp.Click += new EventHandler(this.btnHelp_Click); this.pnlCanvas.Resize += new EventHandler(this.pnlCanvas_Resize); }