Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            /*
             * LCDNumber lcdNumber = LCDNumberFactory.Create("0123456789");
             * LCDNumberPrinter printer = new LCDNumberPrinter(lcdNumber);
             * printer.Print();
             *
             * Console.WriteLine();
             * Console.WriteLine();
             *
             * LCDNumberPrinter specialPrinter = new LCDNumberPrinter(lcdNumber,
             *  new Dictionary<DigitRepresentation, ConsoleColor> {
             *      { DigitRepresentation.Eight, ConsoleColor.Yellow },
             *      { DigitRepresentation.Three, ConsoleColor.Red },
             *      { DigitRepresentation.Seven, ConsoleColor.Cyan }
             *  });
             * specialPrinter.Print();*/

            LCDDigit        lcdDigit     = LCDDigitFactory.Create(8);
            LCDDigitPrinter digitPrinter = new LCDDigitPrinter(lcdDigit);

            digitPrinter.Print();

            LCDNumber        lcdNumber     = LCDNumberFactory.Create("0123456789");
            LCDNumberPrinter numberPrinter = new LCDNumberPrinter(lcdNumber, 4, 3);

            numberPrinter.Print();

            Console.WriteLine(LCDTextFactory.Create(lcdDigit, 3, 2));
            Console.WriteLine(LCDTextFactory.Create(lcdNumber, 3, 2));
        }
        protected override string CreateFragment(LCDDigit lcdDigit, int width)
        {
            char a = (lcdDigit.LeftTop) ? '|' : ' ';
            char b = (lcdDigit.CenterMiddle) ? '_' : ' ';
            char c = (lcdDigit.RightTop) ? '|' : ' ';

            return(this.FormatLine(a, b, c, width));
        }
Пример #3
0
        protected override string CreateFragment(LCDDigit lcdDigit, int width)
        {
            char a = (lcdDigit.LeftBottom) ? '|' : ' ';
            char b = ' ';
            char c = (lcdDigit.RightBottom) ? '|' : ' ';

            return(this.FormatLine(a, b, c, width));
        }
Пример #4
0
        public LCDDigitPrinter(LCDDigit lcdDigit) : base()
        {
            List <string> lines = LCDTextListFactory.Create(lcdDigit, 1, 1);

            foreach (string line in lines)
            {
                this.IncludeLine(line);
            }
        }
Пример #5
0
        public LCDDigit Create()
        {
            LCDDigit digit = new LCDDigit(DigitRepresentation.One);

            digit.RightBottom = true;
            digit.RightTop    = true;

            return(digit);
        }
        public LCDDigitTextCreator(LCDDigit lcdDigit, int width, int height)
        {
            this.textList = new List <string>();
            this.lcdDigit = lcdDigit;
            this.width    = width;
            this.height   = height;

            this.CreateUpperText();
            this.CreateMiddleText();
            this.CreateLowerText();
        }
        public LCDDigit Create()
        {
            LCDDigit digit = new LCDDigit(DigitRepresentation.Four);

            digit.LeftTop = true;

            digit.CenterMiddle = true;

            digit.RightTop    = true;
            digit.RightBottom = true;

            return(digit);
        }
Пример #8
0
        public LCDDigit Create()
        {
            LCDDigit digit = new LCDDigit(DigitRepresentation.Zero);

            digit.LeftTop    = true;
            digit.LeftBottom = true;

            digit.CenterTop    = true;
            digit.CenterBottom = true;

            digit.RightTop    = true;
            digit.RightBottom = true;

            return(digit);
        }
        public void ThenIShouldGetTheFollowingCustomRepresentation(string multilineText)
        {
            Console.WriteLine("Testing {0}", this.number);

            string expected;

            if (this.number >= 0 && this.number <= 9)
            {
                LCDDigit lcdDigit = LCDDigitFactory.Create(this.number);

                expected = LCDTextFactory.Create(lcdDigit, 3, 2);
            }
            else
            {
                LCDNumber lcdNumber = LCDNumberFactory.Create(this.number);

                expected = LCDTextFactory.Create(lcdNumber, 3, 2);
            }


            Assert.AreEqual(expected, multilineText);
        }
 public LCDDigitMiddleCenterText(LCDDigit lcdDigit, int width) : base(lcdDigit, width)
 {
 }
 public LCDDigitLowerText(LCDDigit lcdDigit, int width) : base(lcdDigit, width)
 {
 }
Пример #12
0
 public LCDDigitMiddleBottomText(LCDDigit lcdDigit, int width) : base(lcdDigit, width)
 {
 }
Пример #13
0
 public static string Create(LCDDigit lcdDigit, int width, int height)
 {
     return(Create(LCDTextListFactory.Create(lcdDigit, width, height)));
 }
 public LCDDigitMiddleTopText(LCDDigit lcdDigit, int width) : base(lcdDigit, width)
 {
 }
        public static List <string> Create(LCDDigit lcdDigit, int width, int height)
        {
            LCDDigitTextCreator creator = new LCDDigitTextCreator(lcdDigit, width, height);

            return(creator.Create());
        }
 protected abstract string CreateFragment(LCDDigit lcdDigit, int width);
 public AbstractLCDDigitTextFragment(LCDDigit lcdDigit, int width)
 {
     this.lcdDigit = lcdDigit;
     this.width    = width;
 }
Пример #18
0
        protected override string CreateFragment(LCDDigit lcdDigit, int width)
        {
            char topChar = (lcdDigit.CenterTop) ? '_' : ' ';

            return(FormatLine(' ', topChar, ' ', width));
        }