// returns true if koan valid, false if koan invalid. NOTE: Takes care of toupper public static bool FillKoanDisplay(Context pContext, FlowLayout pFlow, string sKoan) { bool bValid = true; // reset layout pFlow.RemoveAllViews(); // get the image for each piece and add it List <string> lPieces = GetPieceParts(sKoan); foreach (string sPiece in lPieces) { int iRes = GetPieceImage(sPiece); if (iRes == 0) { bValid = false; continue; } ImageView pImageView = new ImageView(pContext); pImageView.SetImageResource(iRes); pFlow.AddView(pImageView); } // return whether koan was valid or naw return(bValid); }
private void FillGoodKoan() { // clear current koan m_pImageRowGood.RemoveAllViews(); m_pGoodKoan.SetBackgroundColor(Android.Graphics.Color.DarkGray); string sKoan = "T" + m_pGoodKoan.Text; // get the list of pieces and for each one insert the image into the layout List <string> lPieces = Master.GetPieceParts(sKoan); foreach (string sPiece in lPieces) { int iRes = Master.GetPieceImage(sPiece); if (iRes == 0) { m_pGoodKoan.SetBackgroundColor(Android.Graphics.Color.Red); continue; } ImageView pView = new ImageView(this); pView.SetImageResource(iRes); m_pImageRowGood.AddView(pView); } }
private void FillKoan() { m_pKoanDisplay.RemoveAllViews(); m_pKoanTextEditor.SetBackgroundColor(Android.Graphics.Color.DarkGray); string sKoan = m_pKoanTextEditor.Text; // get list of pieces and insert image into layout for each one List <string> lPieces = Master.GetPieceParts(sKoan); foreach (string sPiece in lPieces) { int iRes = Master.GetPieceImage(sPiece); if (iRes == 0) { m_pKoanTextEditor.SetBackgroundColor(Android.Graphics.Color.Red); continue; } ImageView pView = new ImageView(this); pView.SetImageResource(iRes); m_pKoanDisplay.AddView(pView); } }