Exemplo n.º 1
0
 public override void DisplayAnswers()
 {
     drawWords.Clear();
     foreach (string w in ExpectedTags())
     {
         SMTextContainerWord item = new SMTextContainerWord(this, w);
         drawWords.Add(item);
     }
     base.DisplayAnswers();
 }
Exemplo n.º 2
0
        public override bool OnDropFinished(PVDragContext dc)
        {
            bool needUpdateDrawWords = false;

            if (HasImmediateEvaluation)
            {
                List <string> et = ExpectedTags();
                if (et.Count > 0 && et.IndexOf(dc.draggedItem.Tag.ToLower()) < 0)
                {
                    return(false);
                }

                foreach (SMTextContainerWord tcw in drawWords)
                {
                    if (tcw.text.Equals(dc.draggedItem.Text, StringComparison.CurrentCultureIgnoreCase))
                    {
                        return(false);
                    }
                }
            }

            if (this.Cardinality == SMConnectionCardinality.One && dc.draggedItem != null)
            {
                drawWords.Clear();
                drawWordsModified   = true;
                needUpdateDrawWords = true;
            }
            else if (this.Cardinality == SMConnectionCardinality.Many)
            {
                needUpdateDrawWords = true;
            }

            if (base.OnDropFinished(dc) && needUpdateDrawWords)
            {
                SMTextContainerWord wr = null;
                if (dc.draggedItem.Text != null && dc.draggedItem.Text.Length > 0)
                {
                    wr = new SMTextContainerWord(this, dc.draggedItem.Text);
                }
                drawWords.Add(wr);
                drawWordsModified = true;
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        public override void LoadStatus(RSFileReader br)
        {
            base.LoadStatusCore(br);

            drawWords.Clear();
            drawWordsModified = true;
            byte b = 0;

            while ((b = br.ReadByte()) != 0)
            {
                switch (b)
                {
                case 20:
                    string word             = br.ReadString();
                    SMTextContainerWord tcw = new SMTextContainerWord(this, word);
                    drawWords.Add(tcw);
                    break;

                default:
                    break;
                }
            }
        }