Esempio n. 1
0
        /// <summary>
        /// Shows all the information for a session-level node highlighted in the treeview.
        /// </summary>
        /// <param name="node">The highlighted node in the left treeview, assumed to represent a single session.</param>
        private void ShowSessionInfo(TreeNode node)
        {
            //
            // Get the session data. Note that sdata should be the same instance as _sdata.
            // For consistency, we pull it from the node's tag.
            //
            SessionData sdata = (SessionData)node.Tag;

            //
            // Set up a reusable XML writer.
            //
            XmlTextWriter writer = null;
            string        tmpXml = String.Format("{0}{1}.xml", Path.GetTempPath(), Path.GetRandomFileName());

            try
            {
                writer            = new XmlTextWriter(tmpXml, Encoding.UTF8);
                writer.Formatting = Formatting.Indented;
                sdata.WriteXmlHeader(writer);

                //
                // Iterate through the conditions within the session.
                //
                foreach (TreeNode bnode in node.Nodes)
                {
                    foreach (TreeNode cnode in bnode.Nodes)
                    {
                        ConditionData cd = (ConditionData)cnode.Tag;
                        cd.WriteXmlHeader(writer); // writes out trials as well
                    }
                }
                sdata.WriteXmlFooter(writer);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                tmpXml = String.Empty;
            }
            finally
            {
                if (writer != null)
                {
                    writer.Close();
                }
                if (tmpXml != String.Empty)
                {
                    webXml.Navigate(tmpXml);
                    rtxXml.LoadFile(tmpXml, RichTextBoxStreamType.PlainText);
                    _tmpXml.Add(tmpXml);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Shows all the information for a block-level node highlighted in the treeview.
        /// </summary>
        /// <param name="node">The highlighted node in the left treeview, assumed to represent a single block.</param>
        private void ShowBlockInfo(TreeNode node)
        {
            //
            // Set up a reusable XML writer.
            //
            XmlTextWriter writer = null;
            string        tmpXml = String.Format("{0}{1}.xml", Path.GetTempPath(), Path.GetRandomFileName());

            try
            {
                writer            = new XmlTextWriter(tmpXml, Encoding.UTF8);
                writer.Formatting = Formatting.Indented;
                writer.WriteStartElement("Block");
                writer.WriteAttributeString("index", XmlConvert.ToString(((ConditionData)node.Nodes[0].Tag).Block));

                //
                // Blocks themselves are not data objects, they're just identifiers on conditions.
                // So iterate through the block's children nodes and write them out, to be later merged.
                //
                foreach (TreeNode cnode in node.Nodes)
                {
                    ConditionData cd = (ConditionData)cnode.Tag;
                    cd.WriteXmlHeader(writer);
                }

                writer.WriteEndElement(); // </Block>
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                tmpXml = String.Empty;
            }
            finally
            {
                if (writer != null)
                {
                    writer.Close();
                }
                if (tmpXml != String.Empty)
                {
                    webXml.Navigate(tmpXml);
                    rtxXml.LoadFile(tmpXml, RichTextBoxStreamType.PlainText);
                    _tmpXml.Add(tmpXml);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Shows all the information for a condition-level node highlighted in the treeview.
        /// </summary>
        /// <param name="node">The highlighted node in the left treeview, assumed to represent a single condition.</param>
        private void ShowConditionInfo(TreeNode node)
        {
            //
            // Get the condition from the 'Tag' field from the selected node. We don't
            // set the member variable because we're leaving the most recent trial depicted
            // on the graphs, etc., and just loading the XML for the condition.
            //
            ConditionData cd = (ConditionData)node.Tag;

            //
            // Set up a reusable XML writer.
            //
            XmlTextWriter writer = null;
            string        tmpXml = String.Format("{0}{1}.xml", Path.GetTempPath(), Path.GetRandomFileName());

            try
            {
                writer            = new XmlTextWriter(tmpXml, Encoding.UTF8);
                writer.Formatting = Formatting.Indented;
                cd.WriteXmlHeader(writer);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                tmpXml = String.Empty;
            }
            finally
            {
                if (writer != null)
                {
                    writer.Close();
                }
                if (tmpXml != String.Empty)
                {
                    webXml.Navigate(tmpXml);
                    rtxXml.LoadFile(tmpXml, RichTextBoxStreamType.PlainText);
                    _tmpXml.Add(tmpXml);
                }
            }
        }