public void LoadSettings(ref PipettingSettings pipettingSettings, ref LabwareSettings labwareSettings) { XmlSerializer xs = new XmlSerializer(typeof(PipettingSettings)); string sFile = GetExeFolder() + "\\" + stringRes.pipettingSettingFileName; if (!File.Exists(sFile)) { SaveSettings(pipettingSettings); return; } Stream stream = new FileStream(sFile, FileMode.Open, FileAccess.Read, FileShare.Read); pipettingSettings = xs.Deserialize(stream) as PipettingSettings; stream.Close(); xs = new XmlSerializer(typeof(LabwareSettings)); sFile = GetExeFolder() + "\\" + stringRes.labwareSettingFileName; if (!File.Exists(sFile)) { SaveSettings(labwareSettings); return; } stream = new FileStream(sFile, FileMode.Open, FileAccess.Read, FileShare.Read); labwareSettings = xs.Deserialize(stream) as LabwareSettings; stream.Close(); }
public static int GetSamplesPerRow4Buffy(LabwareSettings labwareSettings, PipettingSettings pipettingSettings) { int buffySlice = pipettingSettings.dstbuffySlice; if (labwareSettings.dstLabwareColumns == 1) { return(1); } return(labwareSettings.dstLabwareColumns / buffySlice); }
public static int GetSamplesPerRow4Plasma(LabwareSettings labwareSettings, PipettingSettings pipettingSettings, bool buffyStandalone) { int buffySlice = buffyStandalone ? 0 : pipettingSettings.dstbuffySlice; int totalSlicePerSample = buffySlice + pipettingSettings.dstPlasmaSlice; if (labwareSettings.dstLabwareColumns == 1) { return(1); } return(labwareSettings.dstLabwareColumns / totalSlicePerSample); }
public bool IsValidSetting(LabwareSettings labwareSettings, PipettingSettings pipettingSettings, ref string errMsg) { if (labwareSettings.sourceLabwareGrids > labwareSettings.dstLabwareStartGrid) { errMsg = "plasma start grid must > source sample start grid"; return(false); } //if (labwareSettings.dstBuffyStartGrid < labwareSettings.dstLabwareStartGrid) //{ // errMsg = "buffy start grid must > plasma start grid"; // return false; //} //if (labwareSettings.dstRedCellStartGrid < labwareSettings.dstBuffyStartGrid) //{ // errMsg = "red cell start grid must > buffy start grid"; // return false; //} //if (pipettingSettings.dstPlasmaSlice == 0) //{ // errMsg = "destination plasma slice must > 0"; // return false; //} int possibleGrids = labwareSettings.dstLabwareStartGrid - labwareSettings.sourceLabwareStartGrid; if (labwareSettings.dstLabwareStartGrid < labwareSettings.sourceLabwareStartGrid + labwareSettings.sourceLabwareGrids) { errMsg = string.Format("there is only {0} grids between source sample start grid & plasma start grid, but there is {1} racks of source racks!", possibleGrids, labwareSettings.sourceLabwareGrids); return(false); } //如果冻存管载架只有一列位置,那么Region的列数plasma+ buffy数量决定, //如果冻存管载架有多列位置N,那么Region的列数由N决定 int columnsPerRegion = labwareSettings.dstLabwareColumns; int totalSlice = pipettingSettings.dstbuffySlice + pipettingSettings.dstPlasmaSlice; if (columnsPerRegion == 1) { columnsPerRegion = totalSlice; } if (totalSlice > columnsPerRegion) { errMsg = string.Format("there is only {0} columns in the region, but there is {1} slice of plasma,buffy & red cell to dispense!", columnsPerRegion, totalSlice); return(false); } return(true); }
public void SaveSettings(PipettingSettings settings) { XmlSerializer xs = new XmlSerializer(typeof(PipettingSettings)); string sFile = GetExeFolder() + "\\" + stringRes.pipettingSettingFileName; if (File.Exists(sFile)) { File.Delete(sFile); } Stream stream = new FileStream(sFile, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite); xs.Serialize(stream, settings); stream.Close(); }
public Dictionary<string, string> Load(bool isConfigSettings, bool isLabwareSettings, bool isPipettingSettings) { if (isConfigSettings) { return LoadConfigSettings(); } string s = File.ReadAllText(sPipettingFileName); pipettingSettings = Utility.Deserialize<PipettingSettings>(s); s = File.ReadAllText(sLabwareSettingFileName); labwareSettings = Utility.Deserialize<LabwareSettings>(s); if (isLabwareSettings) { return GetSetting(labwareSettings); } if(isPipettingSettings) { return GetSetting(pipettingSettings); } throw new Exception("不支持的设置!"); }
public void SaveSettings(PipettingSettings settings) { XmlSerializer xs = new XmlSerializer(typeof(PipettingSettings)); string sFile = GetExeFolder() + "\\" + stringRes.pipettingSettingFileName; if (File.Exists(sFile)) File.Delete(sFile); Stream stream = new FileStream(sFile, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.ReadWrite); xs.Serialize(stream, settings); stream.Close(); }
public bool IsValidSetting(LabwareSettings labwareSettings, PipettingSettings pipettingSettings, ref string errMsg) { if (labwareSettings.sourceLabwareGrids > labwareSettings.dstLabwareStartGrid) { errMsg = "plasma start grid must > source sample start grid"; return false; } //if (labwareSettings.dstBuffyStartGrid < labwareSettings.dstLabwareStartGrid) //{ // errMsg = "buffy start grid must > plasma start grid"; // return false; //} //if (labwareSettings.dstRedCellStartGrid < labwareSettings.dstBuffyStartGrid) //{ // errMsg = "red cell start grid must > buffy start grid"; // return false; //} //if (pipettingSettings.dstPlasmaSlice == 0) //{ // errMsg = "destination plasma slice must > 0"; // return false; //} int possibleGrids = labwareSettings.dstLabwareStartGrid - labwareSettings.sourceLabwareStartGrid; if (labwareSettings.dstLabwareStartGrid < labwareSettings.sourceLabwareStartGrid + labwareSettings.sourceLabwareGrids) { errMsg = string.Format("there is only {0} grids between source sample start grid & plasma start grid, but there is {1} racks of source racks!", possibleGrids, labwareSettings.sourceLabwareGrids); return false; } //如果冻存管载架只有一列位置,那么Region的列数plasma+ buffy数量决定, //如果冻存管载架有多列位置N,那么Region的列数由N决定 int columnsPerRegion = labwareSettings.dstLabwareColumns; int totalSlice = pipettingSettings.dstbuffySlice + pipettingSettings.dstPlasmaSlice; if (columnsPerRegion == 1) columnsPerRegion = totalSlice; if (totalSlice > columnsPerRegion) { errMsg = string.Format("there is only {0} columns in the region, but there is {1} slice of plasma,buffy & red cell to dispense!", columnsPerRegion, totalSlice); return false; } return true; }
public static int CalculateDestLabwareNeededCnt(int totalSampleCnt, LabwareSettings labwareSettings, PipettingSettings pipettingSettings, bool buffyStandalone) { int samplesPerRow = Utility.GetSamplesPerRow4Plasma(labwareSettings, pipettingSettings, buffyStandalone); if (labwareSettings.gridsPerCarrier == 1) { samplesPerRow = 1; } int maxSampleCntPerLabware = samplesPerRow * labwareSettings.dstLabwareRows; //int buffyNeedPlate = buffyStandalone ? 1 : 0; return((totalSampleCnt + maxSampleCntPerLabware - 1) / maxSampleCntPerLabware); }