public FusionBridge(string debugMzML, string logDir, bool showConsoleLogs) { Logs = new List <string>(); LogDir = logDir; ShowConsoleLogs = showConsoleLogs; IFusionInstrumentAccessContainer fusionContainer = null; if (!String.IsNullOrEmpty(debugMzML)) // create fake Fusion container that reads from mzML file { WriteLog("FusionBridge constructor called in debug mode"); WriteLog(string.Format("Reading scans from {0}", debugMzML)); fusionContainer = new MzMLFusionContainer(debugMzML); } else // needs license to connect to the real instrument { //// Use the Factory creation method to create a Fusion Access Container WriteLog("FusionBridge constructor called"); fusionContainer = getIFusionInstrumentAccessContainer(); } // Connect to the service by going 'online' fusionContainer.StartOnlineAccess(); // Wait until the service is connected // (better through the event, but this is nice and simple) while (!fusionContainer.ServiceConnected) { ; } // From the instrument container, get access to a particular instrument InstrumentAccess = fusionContainer.Get(1); ScanContainer = InstrumentAccess.GetMsScanContainer(0); WriteLog("Detector class: " + ScanContainer.DetectorClass); // Dump key-value pairs in cs.Values WriteLog("Custom scan parameters: "); InstrumentControl = InstrumentAccess.Control; ScanControl = InstrumentControl.GetScans(false); ICustomScan cs = ScanControl.CreateCustomScan(); foreach (KeyValuePair <string, string> kvp in cs.Values) { string kvpString = string.Format("- cs.Values\tKey = {0}, Value = {1}", kvp.Key, kvp.Value); WriteLog(kvpString); } // Print instrument state WriteLog("FusionBridge constructor initialised"); IState state = InstrumentControl.Acquisition.State; string msg = string.Format("System mode = {0}, system state = {1}", state.SystemMode, state.SystemState); WriteLog(msg); }
protected override bool Validate() { bool results = base.Validate(); InstrumentControl instrumentControl = _controlToValidate as InstrumentControl; if (instrumentControl != null) { } return(results); }
public void OpenInstrument(IInstrument instrument) { if (instrument != null) { var c = new InstrumentControl() { DataContext = new InstrumentViewModel() { TargetObject = instrument.Clone() as IInstrument, GetCurrentDataSource = () => { return(CurrentDataSource); } } }; if (OpenView != null) { OpenView(instrument.Name, c, false); } } }