Ejemplo n.º 1
0
        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();
        }
 public static bool LoadFromFile(string fileName, out TestConfigurationTestEquipmentItem obj)
 {
     System.Exception exception;
     return LoadFromFile(fileName, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an TestConfigurationTestEquipmentItem object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output TestConfigurationTestEquipmentItem 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 TestConfigurationTestEquipmentItem obj, out System.Exception exception)
 {
     exception = null;
     obj = default(TestConfigurationTestEquipmentItem);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 public static bool Deserialize(string input, out TestConfigurationTestEquipmentItem obj)
 {
     System.Exception exception;
     return Deserialize(input, out obj, out exception);
 }
 /// <summary>
 /// Deserializes workflow markup into an TestConfigurationTestEquipmentItem object
 /// </summary>
 /// <param name="input">string workflow markup to deserialize</param>
 /// <param name="obj">Output TestConfigurationTestEquipmentItem 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 TestConfigurationTestEquipmentItem obj, out System.Exception exception)
 {
     exception = null;
     obj = default(TestConfigurationTestEquipmentItem);
     try
     {
         obj = Deserialize(input);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 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 );
         }
     }
 }