public static SeparatorDataStore GetInstance()
 {
     if (theDataStore == null)
     {
         try
         {
             theDataStore = new SeparatorDataStore();
         }
         catch
         {
             theDataStore = null;
         }
     }
     return(theDataStore);
 }
        public void RetrieveMRU_Statistics()
        {
            // To do this, retrieve persisted data (if any) and update the MRU field
            // of any protocol for which we have a matching protocol ID.
            using (SeparatorDataStore persistedDataStore = new SeparatorDataStore())
            {
                try
                {
                    string protocolsPath        = GetProtocolsPath();
                    string protocolsXmlFileName = protocolsPath + @"\" + theProtocolsInfoBaseFilename + theProtocolsInfoFilenameExtenstion;
                    if (File.Exists(protocolsXmlFileName))
                    {
                        persistedDataStore.EnforceConstraints = false;
                        persistedDataStore.ReadXml(protocolsXmlFileName);
                        foreach (ProtocolRow persistRow in persistedDataStore.Protocol)
                        {
                            //  03/14/06 MRU fix
                            // Create a filter string to lookup protocols based on the Protocol Instrument
                            // Control ID (a unique hash code based on the protocol name).
                            string filter = string.Format("ProtocolInstrumentControlId={0}",
                                                          persistRow.ProtocolInstrumentControlId);

                            // Search for a match between the persisted list of protocols and the
                            // current list of protocols returned from the instrument control layer.
                            // We need to do this lookup in case someone has added or deleted protocol
                            // files from the protocol directory since last running the application.
                            ProtocolRow[] pRows = (ProtocolRow[])theDataStore.Protocol.Select(filter);
                            if (pRows.GetLength(0) == 1)
                            {
                                ProtocolRow pRow = pRows[0];
                                if (pRow != null)
                                {
                                    pRow.ProtocolUsageCount = persistRow.ProtocolUsageCount;
                                    pRow.ProtocolUsageTime  = persistRow.ProtocolUsageTime;
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
            }
        }