/// <summary>
 /// Deserializes workflow markup into an TestStationDescription11 object
 /// </summary>
 /// <param name="input">string workflow markup to deserialize</param>
 /// <param name="obj">Output TestStationDescription11 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 TestStationDescription11 obj, out Exception exception)
 {
     exception = null;
     obj       = default(TestStationDescription11);
     try
     {
         obj = Deserialize(input);
         return(true);
     }
     catch (Exception ex)
     {
         exception = ex;
         return(false);
     }
 }
 /// <summary>
 /// Deserializes xml markup from file into an TestStationDescription11 object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output TestStationDescription11 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 TestStationDescription11 obj, out Exception exception)
 {
     exception = null;
     obj       = default(TestStationDescription11);
     try
     {
         obj = LoadFromFile(fileName);
         return(true);
     }
     catch (Exception ex)
     {
         exception = ex;
         return(false);
     }
 }
Пример #3
0
        /**
         *
         */
        public string InitializeTestStaion(string stationType,
            string station,
            string changeNo,
            string dateEntry,
            string fst)
        {
            string refNo = "";
            bool usesRF = false;
            bool usesCNI = false;
            bool usesEO = false;
            bool usesHPDTS = false;
            bool usesSGMA = false;
            bool isHybrid = false;
            bool isRTCass = false;
            bool isECass = false;

            stationType = stationType.ToUpper();
            station = station.ToUpper();

            if (string.IsNullOrWhiteSpace(station))
                station = CASS;

            if (string.IsNullOrWhiteSpace(stationType))
                stationType = station;

            usesRF = stationType.Contains(RF);
            usesCNI = stationType.Contains(CNI);
            usesEO = stationType.Contains(EO);
            usesHPDTS = stationType.Contains(HPDTS);
            usesSGMA = stationType.Contains(SGMA);
            isHybrid = stationType.Contains(HYBRID);
            isRTCass = stationType.Contains(RTCASS);
            isECass = stationType.Contains(ECASS);

            if (!isRTCass && stationType.Contains(CASS))
                station = CASS;
            else if (isRTCass)
                station = RTCASS;
            else if (isECass)
                station = ECASS;
            else if (isHybrid)
                station = HYBRID;

            if (usesRF)
                station = station + "_" + RF;
            if (usesCNI)
                station = station + "_" + CNI;
            if (usesEO)
                station = station + "_" + EO;
            if (usesHPDTS)
                station = station + "_" + HPDTS;
            if (usesSGMA)
                station = station + "_" + SGMA;

            const string assetType = "Model";
            const string contentType = "text/xml";
            string documentType = Enum.GetName(typeof (dbDocument.DocumentType),
                                               dbDocument.DocumentType.TEST_STATION_DESCRIPTION);

            AssetIdentificationBean asset = DocumentManager.FindAsset(assetType, station);
            if (asset != null)
            {
                refNo = asset.uuid.ToString();
            }
            else
            {
                refNo = DocumentManager.CreateDocumentPlaceHolder
                    (
                        station, //Part Number
                        assetType, //Asset Type
                        contentType, //Content Type
                        documentType, //Document Type
                        station + " 1671.6 Test Station Description" //Description
                    );
                var ts = new TestStationDescription11();
                ts.Identification = new ItemDescriptionIdentification();
                ts.name = station;
                ts.uuid = refNo;
                ts.Identification.ModelName = station;
                Document document = DocumentManager.GetDocument(refNo);
                document.DocumentContent = Encoding.UTF8.GetBytes(ts.Serialize());
                DocumentManager.SaveDocument(document);
            }

            return refNo;
        }
        public static bool LoadFromFile(string fileName, out TestStationDescription11 obj)
        {
            Exception exception;

            return(LoadFromFile(fileName, out obj, out exception));
        }
        private object GetDataObject()
        {
            var eventArgs = new DataObjectRequestEventArgs();
            OnDataObjectRequested( eventArgs );
            object data = null;
            if (_instrumentDescription != null)
                data = _instrumentDescription;
            else if (_testStationDescription != null)
                data = _testStationDescription;
            else if (_testAdapterDescription != null)
                data = _testAdapterDescription;

            if (data == null)
            {
                if (eventArgs.ObjectItemDescription is InstrumentDescription)
                    data = _instrumentDescription = eventArgs.ObjectItemDescription as InstrumentDescription;
                else if (eventArgs.ObjectItemDescription is TestAdapterDescription1 )
                    data = _testAdapterDescription = eventArgs.ObjectItemDescription as TestAdapterDescription1;
                else if (eventArgs.ObjectItemDescription is TestStationDescription11 )
                    data = _testStationDescription = eventArgs.ObjectItemDescription as TestStationDescription11;
            }

            return data;
        }
        public static bool Deserialize(string input, out TestStationDescription11 obj)
        {
            Exception exception;

            return(Deserialize(input, out obj, out exception));
        }
 public static bool LoadFromFile(string fileName, out TestStationDescription11 obj)
 {
     Exception exception;
     return LoadFromFile(fileName, out obj, out exception);
 }
Пример #8
0
 private static void OnEditTestStation( IDocumentEditor source, Document document, TestStationDescription11 obj,
     bool saveDocumentOnCompletion)
 {
     EditDocumentDelegate handler = EditTestStation;
     if (handler != null) handler( source, document, obj, saveDocumentOnCompletion );
 }
 public static bool Deserialize(string input, out TestStationDescription11 obj)
 {
     Exception exception;
     return Deserialize(input, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an TestStationDescription11 object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output TestStationDescription11 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 TestStationDescription11 obj, out Exception exception)
 {
     exception = null;
     obj = default(TestStationDescription11);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 private void AddListItem( TestStationDescription11 testStation, Color bgColor )
 {
     var lv1 = new ListViewItem( testStation.name );
     lv1.Checked = true;
     lv1.SubItems.Add( testStation.uuid );
     lv1.BackColor = bgColor;
     lv1.Tag = testStation;
     lvTestStations.Items.Add( lv1 );
 }
 private void SaveTestStation( TestStationDescription11 testStation )
 {
     if (testStation != null)
     {
         string content = testStation.Serialize();
         Document document = DocumentManager.GetDocument( testStation.uuid );
         if (document != null)
         {
             document.DocumentContent = Encoding.UTF8.GetBytes( content );
             PersistanceController.Save( document );
         }
     }
 }
 protected override void ControlsToData()
 {
     if( _hardwareItemDescription == null )
         _hardwareItemDescription = new TestStationDescription11();
     base.ControlsToData();
     var testStation = _hardwareItemDescription as TestStationDescription11;
     if (testStation != null)
     {
         testStation.Instruments = testStationDescriptionInstrumentListControl1.TestStationDescriptionInstruments;
         testStation.uuid = edtUUID.GetValue<string>();
     }
 }
Пример #14
0
 public void AddSelectedTestStation( TestStationDescription11 testStation )
 {
     if (!SelectedTestStations.Contains( testStation ))
     {
         SelectedTestStations.Add( testStation );
         List<TestStationDescriptionInstrument> instruments = testStation.Instruments;
         if (instruments != null)
         {
             foreach (TestStationDescriptionInstrument testStationDescriptionInstrument in instruments)
             {
                 AddAvailableInstrument( new TestStationInstrumentData(testStation, testStationDescriptionInstrument) );
             }
         }
     }
 }
 /// <summary>
 /// Deserializes workflow markup into an TestStationDescription11 object
 /// </summary>
 /// <param name="input">string workflow markup to deserialize</param>
 /// <param name="obj">Output TestStationDescription11 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 TestStationDescription11 obj, out Exception exception)
 {
     exception = null;
     obj = default(TestStationDescription11);
     try
     {
         obj = Deserialize(input);
         return true;
     }
     catch (Exception ex)
     {
         exception = ex;
         return false;
     }
 }
Пример #16
0
 public TestStationInstrumentData( TestStationDescription11 testStation,
     TestStationDescriptionInstrument testStationInstrument)
 {
     _testStation = testStation;
     _testStationInstrument = testStationInstrument;
     _instrumentDescription = GetInstrumentDescription( testStationInstrument );
     _itemDescription = GetItemDescription( testStationInstrument );
 }
 /**
  * Called when the Hardware Description is a Test Station.
  */
 private void ProcessTestStationPath( TestStationDescription11 testStationDescription )
 {
     Capabilities capabilities = testStationDescription.Capabilities;
     ProcessCapabilitites( capabilities );
     if (!CapabilitiesOnly)
         ProcessHardwareItemSwitching(testStationDescription.Switching);
 }