void LoadProperty() { cGUI_ListWellProperty GUI_ListWellProperty = new cGUI_ListWellProperty(); GUI_ListWellProperty.IsCheckBoxes = false; if (GUI_ListWellProperty.Run().IsSucceed == false) return; List<cPropertyType> ListSelectedProp = GUI_ListWellProperty.GetOutPut(); cCSVToTable CSVT = new cCSVToTable(); CSVT.IsDisplayUIForFilePath = true; CSVT.IsContainRowNames = true; CSVT.IsContainColumnHeaders = true; CSVT.AddAsObject = true; CSVT.Run(); cExtendedTable PlateDesign = CSVT.GetOutPut(); if (PlateDesign == null) return; cListPlates LP = new cListPlates(); if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) { LP.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate()); } else if (ProcessModeEntireScreeningToolStripMenuItem.Checked) { LP = cGlobalInfo.CurrentScreening.ListPlatesActive; } else { cGUI_ListPlates GUIListPlate = new cGUI_ListPlates(); if (GUIListPlate.Run().IsSucceed == false) return; LP = GUIListPlate.GetOutPut(); } for (int Col = 0; Col < cGlobalInfo.CurrentScreening.Columns; Col++) for (int Row = 0; Row < cGlobalInfo.CurrentScreening.Rows; Row++) { if ((Col < PlateDesign.Count) && (Row < PlateDesign[Col].ListTags.Count)) { object TmpObj = PlateDesign[Col].ListTags[Row]; //string TmpVal = ""; //if (TmpObj != null) // TmpVal = (string)TmpObj; foreach (cPlate CurrentPlate in LP) { cWell TmpWell = CurrentPlate.GetWell(Col, Row, false); if ((TmpWell != null)) { if (TmpObj == null) { TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, null); } else { if (/*(TmpObj.GetType() == typeof(string)) &&*/ (ListSelectedProp[0].Type == eDataType.STRING)) TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, (string)TmpObj); else if (/*(TmpObj.GetType() == typeof(double)) &&*/ (ListSelectedProp[0].Type == eDataType.DOUBLE)) { double Res; if (double.TryParse((string)TmpObj, out Res)) TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, Res); else TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, null); } else if (/*(TmpObj.GetType() == typeof(int)) &&*/ (ListSelectedProp[0].Type == eDataType.INTEGER)) { int IntRes; if (int.TryParse((string)TmpObj, out IntRes)) TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, IntRes); else TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, null); } } // TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, (int)Convert.ToDouble(TmpObj.ToString())); //else if (TmpObj.GetType() == typeof(int) && (ListSelectedProp[0].Type == eDataType.INTEGER)) // TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, (int)TmpObj); } } } } richTextBoxConsole.AppendText(LP.Count + " plates updated !\n"); cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().DisplayDistribution(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor(), false); }
void SaveProperty() { cGUI_ListWellProperty GUI_ListWellProperty = new cGUI_ListWellProperty(); GUI_ListWellProperty.IsCheckBoxes = false; if (GUI_ListWellProperty.Run().IsSucceed == false) return; List<cPropertyType> ListSelectedProp = GUI_ListWellProperty.GetOutPut(); cExtendedTable ToBeSaved = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().GetPropertyAsTable(ListSelectedProp[0]); cTableToFile CTF = new cTableToFile(); CTF.IsDisplayUIForFilePath = true; CTF.IsTagToBeSaved = true; CTF.SetInputData(ToBeSaved); CTF.IsRunEXCEL = true; CTF.Run(); }
private void copyPropertyToolStripMenuItem_Click(object sender, EventArgs e) { if (cGlobalInfo.CurrentScreening == null) return; cGUI_ListWellProperty GUI_ListWellProperty = new cGUI_ListWellProperty(); GUI_ListWellProperty.IsCheckBoxes = false; if (GUI_ListWellProperty.Run().IsSucceed == false) return; List<cPropertyType> ListSelectedProp = GUI_ListWellProperty.GetOutPut(); cListPlates LP = new cListPlates(); if (ProcessModeplateByPlateToolStripMenuItem.Checked) { cGUI_ListPlates GUI_ListPlates = new cGUI_ListPlates(); GUI_ListPlates.IsCheckBoxes = true; cFeedBackMessage FBM = GUI_ListPlates.Run(); cGlobalInfo.WindowHCSAnalyzer.richTextBoxConsole.AppendText(FBM.Message); if (!FBM.IsSucceed) return; LP = GUI_ListPlates.GetOutPut(); } else if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) { LP.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate()); } else { LP = cGlobalInfo.CurrentScreening.ListPlatesActive; } cGlobalInfo.CurrentScreening.CopyPropertyToClipBoard(ListSelectedProp, LP); }
public cFeedBackMessage Run() { if (this.Input == null) { FeedBackMessage.IsSucceed = false; FeedBackMessage.Message = "No input data defined."; return FeedBackMessage; } if (this.IsGUI) { cGUI_ListWellProperty GUI_ListWellProperty = new cGUI_ListWellProperty(); if (GUI_ListWellProperty.Run().IsSucceed == false) { FeedBackMessage.IsSucceed = false; FeedBackMessage.Message = "No propoerties selected"; return FeedBackMessage; } ListSelectedProp = GUI_ListWellProperty.GetOutPut(); } this.OutPut = new cListListWells(); foreach(cWell TmpWell in this.Input) { bool IsSimilar = false; for (int i = 0; i < this.OutPut.Count; i++) { cWell WellToCompareTo = this.OutPut[i][0]; bool TmpSimilarity = true; foreach (cPropertyType Prop in ListSelectedProp) { object Val = WellToCompareTo.ListProperties.FindValueByName(Prop.Name); object Val2 = TmpWell.ListProperties.FindValueByName(Prop.Name); if ((Val == null) && (Val2 == null)) { TmpSimilarity = false; break; } if ((Val == null) || (Val2 == null)) { TmpSimilarity = false; break; } if (!Val.Equals(Val2)) { TmpSimilarity = false; break; } } if (TmpSimilarity == true) { this.OutPut[i].Add(TmpWell); IsSimilar = true; break; } } if (IsSimilar == false) { cListWells LW = new cListWells(); LW.Name = ""; foreach (var item in TmpWell.ListProperties) { foreach (var P in ListSelectedProp) { if (P.Name == item.PropertyType.Name) { if (item.GetValue() != null) { if (P.Name == "Well Class") { int Value = (int)item.GetValue(); LW.Name += "[" + item.PropertyType.Name + "] = " + cGlobalInfo.ListWellClasses[Value].Name + "\n"; } else { LW.Name += "[" + item.PropertyType.Name + "] = " + item.GetValue().ToString() + "\n"; } } else goto NEXTLOOP; } } } LW.Add(TmpWell); this.OutPut.Add(LW); NEXTLOOP: ; } } return FeedBackMessage; }
public void CopyPropertyToClipboard() { cGUI_ListWellProperty GUI_ListWellProperty = new cGUI_ListWellProperty(); GUI_ListWellProperty.IsCheckBoxes = false; if (GUI_ListWellProperty.Run().IsSucceed == false) return; List<cPropertyType> ListSelectedProp = GUI_ListWellProperty.GetOutPut(); StringBuilder sb = new StringBuilder(); sb.Append(String.Format(ListSelectedProp[0].Name + "\n")); sb.Append(String.Format(this.Name + "\t")); for (int i = 0; i < ParentScreening.Columns - 1; i++) { int IdxCol = i + 1; sb.Append(String.Format("{0}\t", IdxCol)); } sb.Append(String.Format("{0}", ParentScreening.Columns)); sb.AppendLine(); for (int j = 0; j < ParentScreening.Rows; j++) { byte[] strArray = new byte[1]; strArray[0] = (byte)(j + 65); string Chara = Encoding.UTF7.GetString(strArray); sb.Append(String.Format("{0}\t", Chara)); for (int i = 0; i < ParentScreening.Columns - 1; i++) { cWell CurrentWell = ParentScreening.GetCurrentDisplayPlate().GetWell(i, j, false); if (CurrentWell == null) sb.Append("\t"); else { object TmpOBj = CurrentWell.ListProperties.FindValueByName(ListSelectedProp[0].Name); if (TmpOBj == null) sb.Append("n.a.\t"); else sb.Append(TmpOBj.ToString() + "\t"); } } cWell CurrentWellFinal = ParentScreening.GetCurrentDisplayPlate().GetWell(ParentScreening.Columns - 1, j, false); if (CurrentWellFinal == null) sb.Append("\t"); else { object TmpOBj = CurrentWellFinal.ListProperties.FindValueByName(ListSelectedProp[0].Name); if (TmpOBj == null) sb.Append("n.a.\t"); else sb.Append(TmpOBj.ToString() + "\t"); } sb.AppendLine(); } Clipboard.SetText(sb.ToString()); }