Exemplo n.º 1
0
        //
        // - Methods -
        //

        /// <summary>
        /// Set the instruction text for a specific Thread if the supplied text is non-empty.
        /// Remove the instruction text for a specific Thread if the supplied text is empty.
        /// </summary>
        /// <param name="thread">The Thread.</param>
        /// <param name="text">The text to display.</param>
        public void SetInstruction(Thread thread, String text)
        {
            lock (this.instructions)
            {
                Instruction existingInstruction = null;

                foreach (Instruction instruction in this.instructions)
                {
                    if (instruction.threadId == thread.Options.Identifier)
                    {
                        existingInstruction = instruction;
                        break;
                    }
                }

                if (existingInstruction != null)
                {
                    this.instructions.Remove(existingInstruction);
                }

                if (text.Length > 0)
                {
                    Instruction newInstruction = new Instruction(thread.Options.Identifier, text);
                    this.instructions.Add(newInstruction);
                }
            }

            UpdateUserControl();
        }
Exemplo n.º 2
0
        //
        // - Methods -
        //
        /// <summary>
        /// Set the instruction text for a specific Thread if the supplied text is non-empty.
        /// Remove the instruction text for a specific Thread if the supplied text is empty.
        /// </summary>
        /// <param name="thread">The Thread.</param>
        /// <param name="text">The text to display.</param>
        public void SetInstruction(Thread thread, String text)
        {
            lock(this.instructions)
            {
                Instruction existingInstruction = null;

                foreach(Instruction instruction in this.instructions)
                {
                    if (instruction.threadId == thread.Options.Identifier)
                    {
                        existingInstruction = instruction;
                        break;
                    }
                }

                if (existingInstruction != null)
                {
                    this.instructions.Remove(existingInstruction);
                }

                if (text.Length > 0)
                {
                    Instruction newInstruction = new Instruction(thread.Options.Identifier, text);
                    this.instructions.Add(newInstruction);
                }
            }

            UpdateUserControl();
        }