コード例 #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();
        }
コード例 #2
0
 /// <summary>
 /// Deserializes xml markup from file into an UUTDescription object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output UUTDescription 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 UUTDescription obj, out System.Exception exception)
 {
     exception = null;
     obj       = default(UUTDescription);
     try
     {
         obj = LoadFromFile(fileName);
         return(true);
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return(false);
     }
 }
コード例 #3
0
 /// <summary>
 /// Deserializes workflow markup into an UUTDescription object
 /// </summary>
 /// <param name="input">string workflow markup to deserialize</param>
 /// <param name="obj">Output UUTDescription 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 UUTDescription obj, out System.Exception exception)
 {
     exception = null;
     obj       = default(UUTDescription);
     try
     {
         obj = Deserialize(input);
         return(true);
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return(false);
     }
 }
コード例 #4
0
 public static void ProcessUutChanges( UUTDescription uut )
 {
     TestProgramSet currentTestProgramSet = Instance.CurrentTestProgramSet;
     if (currentTestProgramSet != null)
     {
         ProjectInfo pi = currentTestProgramSet.ProjectInfo;
         if (pi != null)
         {
             pi.UutId = uut.uuid;
             pi.UutName = uut.Item.Identification.ModelName;
             SaveProjectInfo( pi, currentTestProgramSet );
         }
     }
 }
コード例 #5
0
 public void dataToControls(UUTDescription uutDescription)
 {
     ItemDescription itemDesc = uutDescription.Item;
 }
コード例 #6
0
        private void ControlsToData()
        {
            if (_uut == null)
                _uut = new UUTDescription();

            _uut.name = edtName.Text;
            _uut.version = edtVersion.GetValue<string>();
            _uut.uuid = edtUUID.GetValue<string>();
            _uut.Classified = securityClassificationControl.Classified;
            _uut.SecurityClassification = securityClassificationControl.SecurityClassification;

            if (rbHardware.Checked)
                _uut.Item = hardwareUUTControl.HardwareUUT;
            else if (rbSoftware.Checked)
                _uut.Item = softwareUUTControl.SoftwareUUT;
        }
コード例 #7
0
 /**
  * To create a new project we need to have a UUT selected - this should be the same UUT identifier located
  * in the TPSI file. TODO: Should we create a project from the TPSI file - open the TPSI here?
  */
 private void btnSelectUUT_Click(object sender, EventArgs e)
 {
     var form = new ATMLLibraryForm(typeof (UUTDescriptionListControl));
     if (DialogResult.OK == form.ShowDialog())
     {
         errorProvider1.SetError(edtProjectName, "");
         errorProvider1.SetError(edtUUT, "");
         _uutDescription = form.SelectedObject as UUTDescription;
         if (_uutDescription != null)
         {
             edtUUT.Value = _uutDescription.ToString();
             if (!edtProjectName.HasValue())
                 edtProjectName.Value = _uutDescription.Item.Identification.ModelName;
         }
     }
 }
コード例 #8
0
 public static bool LoadFromFile(string fileName, out UUTDescription obj)
 {
     System.Exception exception;
     return LoadFromFile(fileName, out obj, out exception);
 }
コード例 #9
0
 /// <summary>
 /// Deserializes xml markup from file into an UUTDescription object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output UUTDescription 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 UUTDescription obj, out System.Exception exception)
 {
     exception = null;
     obj = default(UUTDescription);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
コード例 #10
0
 public static bool Deserialize(string input, out UUTDescription obj)
 {
     System.Exception exception;
     return Deserialize(input, out obj, out exception);
 }
コード例 #11
0
 /// <summary>
 /// Deserializes workflow markup into an UUTDescription object
 /// </summary>
 /// <param name="input">string workflow markup to deserialize</param>
 /// <param name="obj">Output UUTDescription 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 UUTDescription obj, out System.Exception exception)
 {
     exception = null;
     obj = default(UUTDescription);
     try
     {
         obj = Deserialize(input);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
コード例 #12
0
 public static void Save(UUTDescription uut)
 {
     string uuid;
     if (uut != null)
     {
         string model = uut.Item.Identification.ModelName;
         string documentName = BuildAtmlFileName(model);
         uuid = uut.uuid;
         Document document = DocumentManager.GetDocument(uuid);
         if (document != null)
         {
             document.DocumentContent = Encoding.UTF8.GetBytes(uut.Serialize());
             document.DataState = BASEBean.eDataState.DS_EDIT;
             document.name = documentName;
             DocumentManager.SaveDocument(document);
         }
         else
         {
             AssetIdentificationBean bean = new AssetIdentificationBean();
             document = new Document();
             document.name = documentName;
             document.DocumentContent = Encoding.UTF8.GetBytes(uut.Serialize());
             document.DocumentType = dbDocument.DocumentType.UUT_DESCRIPTION;
             document.ContentType = "text/xml";
             DocumentManager.SaveDocument(document);
             bean.assetNumber = model;
             bean.assetType = "Part";
             bean.uuid = Guid.Parse(uuid);
             bean.DataState = BASEBean.eDataState.DS_ADD;
             bean.save();
         }
     }
 }
コード例 #13
0
 public static bool LoadFromFile(string fileName, out UUTDescription obj)
 {
     System.Exception exception;
     return(LoadFromFile(fileName, out obj, out exception));
 }
コード例 #14
0
 public static bool Deserialize(string input, out UUTDescription obj)
 {
     System.Exception exception;
     return(Deserialize(input, out obj, out exception));
 }
コード例 #15
0
 private static void OnEditUut( IDocumentEditor source, Document document, UUTDescription obj,
     bool saveDocumentOnCompletion)
 {
     bool ret = false;
     EditDocumentDelegate handler = EditUUT;
     if (handler != null) handler( source, document, obj, saveDocumentOnCompletion );
 }
コード例 #16
0
 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 );
 }