private void AddTestAdapter( DocumentReference documentReference )
 {
     var itm = new ListViewItem( documentReference.ID );
     itm.SubItems.Add( documentReference.uuid );
     itm.SubItems.Add( documentReference.DocumentType.ToString() );
     lvAdapters.Items.Add( itm );
 }
 private void AddInstrument(DocumentReference documentReference)
 {
     var itm = new ListViewItem(documentReference.ID);
     itm.SubItems.Add(documentReference.uuid);
     itm.SubItems.Add(documentReference.DocumentType.ToString());
     lvInstruments.Items.Add(itm);
 }
        public static String toATML(CASS_MTPSI tpsi)
        {
            StringWriter tw = new StringWriter();
            TestConfiguration testConfig = new TestConfiguration();

            ManufacturerData configManager = testConfig.ConfigurationManager;
            List<CASS_MTPSICASS_MTPSI_page> pages = tpsi.CASS_MTPSI_page;
            foreach( CASS_MTPSICASS_MTPSI_page page in pages )
            {
                CASS_MTPSICASS_MTPSI_pageUUT uut = page.UUT;
                String partNo = uut.UUT_ID.Part_Number;
                //UUTInstance instance = new UUTInstance();
                UUTDescription item = new UUTDescription();
                //item.Item.name = uut.UUT_ID.Part_Number;

                //Lookup UUT Information
                ItemDescriptionReference reference = new ItemDescriptionReference();
                DocumentReference docRef = new DocumentReference();
                //docRef.ID = uut.UUT_ID.Part_Number;
                docRef.uuid = "{SOMEUUIDHERE}";

                reference.Item = docRef;// item.Item;
                //testConfig.TestedUUTs.Add(reference);

                TestConfigurationTestEquipmentItem testEquipment = new TestConfigurationTestEquipmentItem();

                foreach( CASS_MTPSICASS_MTPSI_pageATE_assets asset in page.ATE_assets )
                {
                    ItemDescriptionReference refEquip = new ItemDescriptionReference();
                    ItemDescription instrument = new ItemDescription();
                    instrument.name = asset.Asset_Identifier;
                    refEquip.Item = instrument;
                    //testEquipment.Instrumentation.Add(refEquip);
                }

               // testConfig.TestEquipment.Add(testEquipment);

                try
                {
                    XmlSerializer serializerObj = new XmlSerializer(typeof(TestConfiguration));
                    serializerObj.Serialize(tw, testConfig);
                }
                catch( Exception e )
                {
                    Exception ie = e.InnerException;
                    while( ie != null )
                    {
                        Trace.WriteLine(ie.Message);
                        ie = ie.InnerException;
                    }
                }
                break;
            }
            return tw.ToString();
        }
예제 #4
0
        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() ) );
                    }
                }
            }
        }
 private void btnReferenceLookup_Click(object sender, EventArgs e)
 {
     //TODO: Lookup Document
     DocumentLibrarySelectionForm form =
         new DocumentLibrarySelectionForm(_allReadySelectedDocument, DocumentType );
     if (DialogResult.OK == form.ShowDialog())
     {
         Document document = form.SelectedDocument;
         if (document != null)
         {
             atmlPreviewPanel.Open(document);
             _documentReference = new DocumentReference();
             _documentReference.uuid = document.uuid;
             _documentReference.ID = document.name;
             DataToControls();
         }
     }
 }
 protected virtual void ControlsToData()
 {
     if (_documentReference == null)
         _documentReference = new DocumentReference();
     _documentReference.ID = edtDocumentID.Text;
     _documentReference.uuid = edtUUID.Text;
 }
 private void testStationListControl_OnFind()
 {
     var form = new ATMLLibraryForm(typeof(TestStationListControl));
     if (DialogResult.OK == form.ShowDialog())
     {
         var testStation = form.SelectedObject as TestStationDescription11;
         Document document = DocumentManager.GetDocument( testStation.uuid );
         if (document != null)
         {
             var reference = new TestConfigurationTestEquipmentItem();
             var documentReference = new DocumentReference();
             documentReference.ContentType = ATMLContext.CONTEXT_TYPE_XML;
             documentReference.DocumentContent = Encoding.UTF8.GetBytes( testStation.Serialize() );
             documentReference.DocumentName = document.name;
             documentReference.DocumentType = document.DocumentType;
             documentReference.ID = testStation.Identification.ModelName;
             documentReference.uuid = testStation.uuid;
             reference.Item = documentReference;
             testEquipmentListControl.AddListViewObject( reference );
         }
     }
 }
 private void itemDescriptionReferenceControl1_DocumentReferenceSelection(DocumentReference documentReference)
 {
     btnEditDocumentObject.Visible = true;
 }
예제 #9
0
 /// <summary>
 /// Deserializes xml markup from file into an DocumentReference object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output DocumentReference 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 DocumentReference obj, out System.Exception exception)
 {
     exception = null;
     obj = default(DocumentReference);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
예제 #10
0
 public static bool LoadFromFile(string fileName, out DocumentReference obj)
 {
     System.Exception exception;
     return LoadFromFile(fileName, out obj, out exception);
 }
예제 #11
0
 public static bool Deserialize(string input, out DocumentReference obj)
 {
     System.Exception exception;
     return Deserialize(input, out obj, out exception);
 }
예제 #12
0
 /// <summary>
 /// Deserializes workflow markup into an DocumentReference object
 /// </summary>
 /// <param name="input">string workflow markup to deserialize</param>
 /// <param name="obj">Output DocumentReference 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 DocumentReference obj, out System.Exception exception)
 {
     exception = null;
     obj = default(DocumentReference);
     try
     {
         obj = Deserialize(input);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
예제 #13
0
        public static void SaveDocument( DocumentReference docRef )
        {
            bool newDocument = false;
            if (String.IsNullOrEmpty( docRef.uuid ))
                docRef.uuid = Guid.NewGuid().ToString();

            //-------------------------------------------------//
            //--- We will save to the database at this time ---//
            //-------------------------------------------------//
            DocumentDAO documentDAO = DataManager.getDocumentDAO();
            var document = new dbDocument();
            if (documentDAO.hasDocument( docRef.uuid ))
            {
                document = documentDAO.openDatabaseDocument( docRef.uuid );
                document.DataState = BASEBean.eDataState.DS_EDIT;
                document.dateUpdated = DateTime.UtcNow;
            }
            else
            {
                document.DataState = BASEBean.eDataState.DS_ADD;
                document.dateAdded = DateTime.UtcNow;
                newDocument = true;
            }

            document.documentContent = docRef.DocumentContent;
            document.documentName = docRef.DocumentName;
            document.documentSize = docRef.DocumentContent.Length;
            document.contentType = docRef.ContentType;
            document.save();
            LogManager.Trace( "Referenced Document {0} has been {1}", document.documentName,
                              newDocument ? "Added" : "Saved" );
        }
 private static void ProcessDocumentReference(string uuid, DocumentReference capability)
 {
 }
 private void AddUutDocumentReference(UUTDescription uut)
 {
     var docRef = new DocumentReference();
     var document = DocumentManager.GetDocument(uut.uuid);
     docRef.ID = "UUT" + uutListControl.Items.Count+1;
     docRef.uuid = uut.uuid;
     docRef.DocumentType = document.DocumentType;
     docRef.DocumentContent = document.DocumentContent;
     docRef.ContentType = document.ContentType;
     docRef.DocumentName = document.name;
     var idr = new ItemDescriptionReference {Item = docRef};
     uutListControl.AddListViewObject( idr );
 }