public static void CreateProject( ProjectInfo projectInfo )
        {
            //--- Prompt for a test set name ---//
            //--- Check if the name exisists ---//
            //--- If name exists then notify the user, ask if they want to open that test set ---//
            //--- Otherwise create the test set and open it ---//
            if (projectInfo != null)
            {
                TestProgramSet currentTestProgramSet = TestProgramSet.CreateTestSet( projectInfo.ProjectName );
                if (currentTestProgramSet != null)
                {
                    SaveProjectInfo( projectInfo, currentTestProgramSet );
                    OpenProject( projectInfo.ProjectName );
                    Document uutDescriptionDocument = DocumentManager.GetDocument( projectInfo.UutId );
                    if (uutDescriptionDocument != null)
                    {
                        SaveATMLDocument( UutManager.BuildAtmlFileName( projectInfo.UutName ),
                                          AtmlFileType.AtmlTypeUut,
                                          uutDescriptionDocument.DocumentContent );
                    }

                    //--- Create a Test Description ---//
                    if (uutDescriptionDocument != null)
                    {
                        var uutDoc = new DocumentReference();
                        uutDoc.ID = "UUT1";
                        uutDoc.uuid = uutDescriptionDocument.uuid;
                        var uutRef = new ItemDescriptionReference();
                        uutRef.Item = uutDoc;
                        var testConfiguration = new TestConfiguration15();
                        testConfiguration.uuid = Guid.NewGuid().ToString();
                        testConfiguration.TestedUUTs.Add( uutRef );
                        SaveATMLDocument( projectInfo.ProjectName + ATMLContext.ATML_CONFIG_FILENAME_SUFFIX,
                                          AtmlFileType.AtmlTypeTestConfiguration,
                                          Encoding.UTF8.GetBytes( testConfiguration.Serialize() ) );
                    }
                }
            }
        }
 /**
  *
  */
 protected virtual void OnTranslatedInputDocument(TestConfiguration15 testConfiguration)
 {
     TranslatedInputDocumentDelegate handler = InputDocumentTranslated;
     if (handler != null) handler(testConfiguration);
 }
 private void LoadOutputText( TestConfiguration15 testConfiguration )
 {
     //No need to do this now that we have a file watcher
     //ATMLOutputText = testConfiguration.Serialize();
 }
 /// <summary>
 /// Deserializes workflow markup into an TestConfiguration15 object
 /// </summary>
 /// <param name="input">string workflow markup to deserialize</param>
 /// <param name="obj">Output TestConfiguration15 object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string input, out TestConfiguration15 obj, out System.Exception exception)
 {
     exception = null;
     obj = default(TestConfiguration15);
     try
     {
         obj = Deserialize(input);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
        /**
         *
         */
        public void TranslateInputDocument()
        {
            if (_content != null && IsParsible())
            {
                try
                {
                    //---------------------------------//
                    //--- Setup XML reader settings ---//
                    //---------------------------------//
                    ValidationEventHandler validationHandler = (s, ee) => LogManager.SourceError(SOURCE, ee.Exception);
                    var settings = new XmlReaderSettings();
                    settings.ValidationType = ValidationType.None;
                    settings.ValidationFlags = XmlSchemaValidationFlags.None;
                    settings.ValidationEventHandler += validationHandler;

                    string content = Encoding.UTF8.GetString(_content);
                    if (string.IsNullOrWhiteSpace(content))
                        return;
                    using (var sr = new StringReader(content))
                    {
                        using (XmlReader xrXml = new XmlTextReader(sr))
                        {

                            var doc = new XPathDocument(xrXml);

                            string xsdName = SchemaManager.GetSchemaName(Encoding.UTF8.GetString(_content));
                            string xslName = xsdName.Replace(".xsd", ".xsl");

                            StringReader xslReader = GetXSLReader(xslName);
                            var xr = new XmlTextReader(xslReader);
                            var xslt = new XslCompiledTransform();
                            xslt.Load(xr);

                            //--------------------------------------------------------------------------//
                            //--- Create an XsltArgumentList for custom transformation functionality ---//
                            //--------------------------------------------------------------------------//
                            var xslArg = new XsltArgumentList();
                            var fileName = ProjectManager.ProjectName + ATMLContext.ATML_CONFIG_FILENAME_SUFFIX;
                            xslArg.AddParam("documentName", "", fileName );

                            // Add an object to calculate the new book price.
                            var obj = new ReaderTools();
                            //TODO: Figure out all the functionality required for translation
                            xslArg.AddExtensionObject("urn:utrs.atml-reader-tools", obj);

                            //---------------------------//
                            //--- Transform the file. ---//
                            //---------------------------//
                            using (var w = new StringWriter())
                            {
                                var stringBuilder = new StringBuilder();
                                var xws = new XmlWriterSettings();
                                xws.OmitXmlDeclaration = true;
                                xws.Indent = true;
                                xws.NewLineOnAttributes = false;
                                xws.NamespaceHandling = NamespaceHandling.OmitDuplicates;
                                using (XmlWriter xmlWriter = XmlWriter.Create(stringBuilder, xws))
                                {
                                    xslt.Transform(doc, xslArg, xmlWriter);
                                    LogManager.SourceTrace(SOURCE, "ATML translation Completed");
                                    try
                                    {
                                        Console.Write(stringBuilder.ToString());
                                        _testConfiguration = TestConfiguration15.Deserialize(stringBuilder.ToString());
                                    }
                                    catch (Exception e)
                                    {
                                        LogManager.SourceError(SOURCE,
                                            "An error has occurred attempting to marshall the translated document into an ATML Test Configuration object.",
                                            e);
                                    }
                                    OnTranslatedInputDocument(_testConfiguration);
                                }
                            }
                        }
                    }
                }
                catch (Exception ee)
                {
                    LogManager.SourceError(SOURCE, ee, "An error has occurred attempting to process the input document.");
                }
            }
        }
 /// <summary>
 /// Deserializes xml markup from file into an TestConfiguration15 object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output TestConfiguration15 object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out TestConfiguration15 obj, out System.Exception exception)
 {
     exception = null;
     obj = default(TestConfiguration15);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 public static bool LoadFromFile(string fileName, out TestConfiguration15 obj)
 {
     System.Exception exception;
     return LoadFromFile(fileName, out obj, out exception);
 }
 private void _configurationForm_TestConfigurationSaved( TestConfiguration15 testConfiguration )
 {
     OnTestConfigurationSaved( testConfiguration );
 }
 public static bool Deserialize(string input, out TestConfiguration15 obj)
 {
     System.Exception exception;
     return Deserialize(input, out obj, out exception);
 }
 public void LoadTestConfiguration(TestConfiguration15 testConfiguration)
 {
     testConfigurationControl1.TestConfiguration = testConfiguration;
 }
 protected virtual void OnTestConfigurationSaved( TestConfiguration15 testconfiguration )
 {
     TestConfigurationSaveHandler handler = TestConfigurationSaved;
     if (handler != null) handler( testconfiguration );
 }
 private void testConfigurationControl1_TestConfigurationSaved(TestConfiguration15 testConfiguration)
 {
     OnAtmlObjectAction(testConfiguration, AtmlActionType.Edit, EventArgs.Empty);
     OnTestConfigurationSaved(testConfiguration);
 }
 private void ReaderInputDocumentTranslated(TestConfiguration15 testConfiguration)
 {
 }
        private void ControlsToData()
        {
            if (_testConfiguration == null)
                _testConfiguration = new TestConfiguration15();
            if (_testConfiguration.ConfigurationManager == null)
                _testConfiguration.ConfigurationManager = new ManufacturerData();
            _testConfiguration.uuid = edtUUID.GetValue<string>();
            _testConfiguration.ConfigurationManager = manufacturerControl1.ManufacturerData;
            _testConfiguration.classified = securityClassificationControl.Classified;
            _testConfiguration.securityClassification = securityClassificationControl.SecurityClassification;
            _testConfiguration.TestProgramElements = new List<object>();
            //TPS Tab

                //-------------------------------//
                //--- Add Resource References ---//
                //-------------------------------//
                if (tpsResourceReferenceListControl.ConfigurationResourceReferences != null)
                    _testConfiguration.TestProgramElements.AddRange(tpsResourceReferenceListControl.ConfigurationResourceReferences);

                //-------------------------------//
                //--- Add Software References ---//
                //-------------------------------//
                if (tpsSoftwareReferenceListControl.ConfigurationSoftwareReferences != null)
                    _testConfiguration.TestProgramElements.AddRange(tpsSoftwareReferenceListControl.ConfigurationSoftwareReferences);

                //-------------------------------//
                //--- Add Document References ---//
                //-------------------------------//
                if (testProgramDocumentationListControl.TestConfigurationDocumentation != null)
                    _testConfiguration.TestProgramElements.AddRange(testProgramDocumentationListControl.TestConfigurationDocumentation);

            //--------------------------------//
            //--- Add Additional Resources ---//
            //--------------------------------//
            _testConfiguration.AdditionalResources =
                tpsAdditionalResourceReferenceListControl.ConfigurationResourceReferences;
            //------------------------------//
            //--- Add Addtional Software ---//
            //------------------------------//
            _testConfiguration.AdditionalSoftware =
                tpsAdditionalSoftwareReferenceListControl.ConfigurationSoftwareReferences;

            //--------------------------//
            //--- Add UUT References ---//
            //--------------------------//
            _testConfiguration.TestedUUTs.Clear();
            foreach (ListViewItem lvi in uutListControl.Items)
                _testConfiguration.TestedUUTs.Add(lvi.Tag as ItemDescriptionReference );

            //-----------------------------------//
            //--- Add Test Station References ---//
            //-----------------------------------//
            _testConfiguration.TestEquipment.Clear();
            _testConfiguration.TestEquipment = testStationReferenceControl.TestEquipment;
            _testConfiguration.AtmlName = ProjectManager.ProjectName;
            UndoBuffer = _testConfiguration.Serialize();
        }
 private void ClearControls()
 {
     Clear();
     _testConfiguration = null;
     //if (_refeshTimer != null)
     //    _refeshTimer.Stop();
 }
 private void btnUndo_Click(object sender, EventArgs e)
 {
     if (DialogResult.Yes ==
         MessageBox.Show( @"Undo your changes?",
                          @"V E R I F I C A T I O N",
                          MessageBoxButtons.YesNo,
                          MessageBoxIcon.Question ))
     {
         if (!string.IsNullOrEmpty( UndoBuffer ))
         {
             _testConfiguration = TestConfiguration15.Deserialize( UndoBuffer );
             DataToControls();
             SetControlStates();
         }
     }
 }