Beispiel #1
0
        private bool sync; // Private variable for knowing if we should run syncronised or not

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="buffer">Shared buffer</param>
        /// <param name="random">Random number generator</param>
        /// <param name="stringToWrite">Which string to write</param>
        /// <param name="displayResult">Label which text to change when finished</param>
        public Writer(CharacterBuffer buffer, Random random, string stringToWrite, Label displayResult)
        {
            this.buffer = buffer;
            this.random = random;
            this.stringToWrite = stringToWrite;
            this.displayResult = displayResult;

            sync = true;
        }
Beispiel #2
0
        private bool sync; // Private variable for knowing if we should run syncronised or not

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="buffer">Shared buffer</param>
        /// <param name="random">Random number generator</param>
        /// <param name="count">Length of string to read</param>
        /// <param name="displayResult">Label which text to change when finished</param>
        public Reader(CharacterBuffer buffer, Random random, int count, Label displayResult)
        {
            this.buffer = buffer;
            this.random = random;
            this.count = count;
            this.displayResult = displayResult;

            sync = true;
        }
 /// <summary>
 /// Creates our writer and reader objects, as well as the buffer
 /// </summary>
 private void CreateWriterAndReaderObjects()
 {
     buffer = new CharacterBuffer(WriterListBox, ReaderListBox);
     writer = new Writer(buffer, rnd, textData, TransmittedResultLabel);
     reader = new Reader(buffer, rnd, textData.Length, ReceivedResultLabel);
 }