public void Display()
        {
            OnBeforeDisplay();

            titleBlock.Display();
            horizontalLine.Display();
        }
Пример #2
0
        private static void DisplayApplicationHeader()
        {
            TextBlock title = new TextBlock
            {
                Text            = "ConsoleTools Demo - HorizontalLine",
                ForegroundColor = CustomConsole.EmphasizedColor
            };

            HorizontalLine horizontalLine = new HorizontalLine
            {
                Character       = '=',
                ForegroundColor = CustomConsole.EmphasizedColor,
                Margin          = 0
            };

            TextBlock description = new TextBlock
            {
                Text   = "This demo shows the usage of the HorizontalLine controls.",
                Margin = "0 1"
            };

            title.Display();
            horizontalLine.Display();
            description.Display();
        }
        private static void HandleJobStateChanged(object sender, EventArgs e)
        {
            DataProcessingJob job = sender as DataProcessingJob;

            if (job == null)
            {
                return;
            }

            switch (job.State)
            {
            case JobState.Running:
                TextBlock textBlockStart = new TextBlock
                {
                    Margin = "0 0 0 1",
                    Text   = "The job was started."
                };
                textBlockStart.Display();
                progressBar.Display();
                break;

            case JobState.Stopped:
                progressBar.Close();
                TextBlock textBlockFinish = new TextBlock
                {
                    Margin = "0 1 0 0",
                    Text   = "The job was finished."
                };
                textBlockFinish.Display();
                break;
            }
        }
        protected override void DoExecute()
        {
            TextBlock textBlock = new TextBlock
            {
                Text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam orci purus, luctus in est a, tempor luctus tortor. In tortor metus, lacinia vel sapien suscipit, commodo scelerisque metus."
            };

            textBlock.Display();
        }
Пример #5
0
        private static void DisplayGoodby()
        {
            TextBlock goodbyText = new TextBlock
            {
                Text            = "Bye!",
                ForegroundColor = CustomConsole.EmphasiesColor,
                Margin          = "0 1 0 0"
            };

            goodbyText.Display();
        }
Пример #6
0
        protected override void DoExecute()
        {
            TextBlock textBlock = new TextBlock
            {
                Text            = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam orci purus, luctus in est a, tempor luctus tortor. In tortor metus, lacinia vel sapien suscipit, commodo scelerisque metus.",
                Padding         = 3,
                BackgroundColor = ConsoleColor.DarkGray // Added to easyer see the paddings.
            };

            textBlock.Display();
        }
Пример #7
0
        protected override void DoExecute()
        {
            TextBlock textBlock = new TextBlock
            {
                Text            = "Lorem ipsum dolor sit amet",
                MinWidth        = 50,
                BackgroundColor = ConsoleColor.DarkGray
            };

            textBlock.Display();
        }
Пример #8
0
        protected override void DoExecute()
        {
            TextBlock textBlock = new TextBlock
            {
                Text  = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam orci purus, luctus in est a, tempor luctus tortor. In tortor metus, lacinia vel sapien suscipit, commodo scelerisque metus.",
                Width = 50,
                HorizontalAlignment = HorizontalAlignment.Right,
                BackgroundColor     = ConsoleColor.DarkGray
            };

            textBlock.Display();
        }
Пример #9
0
        public void Execute()
        {
            TextBlock textBlock = new TextBlock
            {
                Text            = $"- {Title}:",
                ForegroundColor = CustomConsole.EmphasiesColor,
                Margin          = "0 2 0 1"
            };

            textBlock.Display();

            DoExecute();
        }
        protected override void DoExecute()
        {
            TextBlock textBlock = new TextBlock
            {
                Text = new[]
                {
                    "Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
                    "Nam orci purus, luctus in est a, tempor luctus tortor.",
                    "In tortor metus, lacinia vel sapien suscipit, commodo scelerisque metus.",
                    "Vestibulum tristique sapien dui, et hendrerit justo iaculis non."
                },
            };

            textBlock.Display();
        }
        public void Show()
        {
            TextBlock textBlock = new TextBlock
            {
                Margin = "0 0 0 1",
                Text   = "We create a DataProcessingJob object that will simulate some data processing."
            };

            textBlock.Display();

            job = new DataProcessingJob();
            job.StateChanged    += HandleJobStateChanged;
            job.ProgressChanged += HandleJobProgressChanged;

            job.Run();
        }
Пример #12
0
        public void Test1()
        {
            using (ConsoleOutput consoleOutput = new ConsoleOutput())
            {
                TextBlock textBlock = new TextBlock
                {
                    Text = "alez"
                };

                textBlock.Display();

                string actual = consoleOutput.GetOuput();

                string expected = expectedOutput.GeExpectedtOut();
                Assert.AreEqual(expected, actual);
            }
        }
Пример #13
0
        protected override void DoExecute()
        {
            TextBlock textBlock = new TextBlock("Lorem ipsum dolor sit amet, consectetur adipiscing elit.");

            textBlock.Display();
        }
Пример #14
0
        void SetTaskText(int i, bool displaySlow = true)
        {
            stringBuilder.Length = 0;

            switch (possibleTasks[activeTasks[i]])
            {
            case TaskType.DEFEAT_ENEMIES_WITH_GUN: {
                stringBuilder.AppendFormat(GText.Objectives.defeat_enemies_with_gun,
                                           currentAmountDefeated, amountToDefeat,
                                           GText.Objectives.weapon_names[(int)defeatWithGun]);
            } break;

            case TaskType.UPGRADE_GUN_TO_LEVEL: {
                stringBuilder.AppendFormat(GText.Objectives.upgrade_gun_to_level,
                                           GText.Objectives.weapon_names[(int)ammoToUpgrade], leveToUpgrade);
            } break;

            case TaskType.UPGRADE_HEALING_TO_LEVEL: {
                stringBuilder.AppendFormat(GText.Objectives.upgrade_healing_to_level, levelToHealing);
            } break;

            case TaskType.UPGRADE_ARMOR_TO_LEVEL: {
                if (isLevelingHeart)
                {
                    stringBuilder.AppendFormat(GText.Objectives.upgrade_hearts_to_level, levelToHeart);
                }
                else
                {
                    stringBuilder.AppendFormat(GText.Objectives.upgrade_armor_to_level, levelToArmor);
                }
            } break;

            case TaskType.MAKE_X_NUMBER_SIZED_BLOCKS: {
                stringBuilder.AppendFormat(GText.Objectives.make_x_number_sized_blocks,
                                           currentAmountOfBlocksMade, amountofBlocksToMake, makeXSize, makeYSize);
            } break;

            case TaskType.LOAD_GUN_WITH_X_SIZED_BLOCKS: {
                stringBuilder.AppendFormat(GText.Objectives.load_gun_with_x_sized_blocks,
                                           currentBlocksLoadedToGun, amountOfSizedBlocksToLoadToGun,
                                           loadGunXSize, loadGunYSize);
            } break;

            case TaskType.LOAD_SPECIAL_WITH_X_SIZED_BLOCK: {
                stringBuilder.AppendFormat(GText.Objectives.load_special_with_x_sized_blocks,
                                           currentBlocksLoadedToSpecial, amountOfSizedBlocksToLoadToSpecial,
                                           loadSpecialXSize, loadSpecialYSize);
            } break;

            case TaskType.HAVE_X_AMOUNT_IN_THE_BANK: {
                stringBuilder.AppendFormat(GText.Objectives.have_x_amount_in_the_bank, amountToHaveInBank);
            } break;

            case TaskType.SEND_OUT_THREE_GUNS: {
                stringBuilder.AppendFormat(GText.Objectives.send_out_three_guns,
                                           GText.Objectives.weapon_names[(int)ammoGunToSend], amountOfGunsToSend);
            } break;

            case TaskType.SEND_OUT_THREE_SPECIALS: {
                stringBuilder.AppendFormat(GText.Objectives.send_out_three_specials,
                                           GText.Objectives.weapon_names[(int)ammoSpecialToSend], amountOfSpecialsToSend);
            } break;

            case TaskType.MATCH_BONUS_ELEMENT_X_TIMES_IN_A_ROW: {
                stringBuilder.AppendFormat(GText.Objectives.match_bonus_element,
                                           currentElementsMatched, amountOfElementsMatching);
            } break;

            case TaskType.DEFEAT_X_NUMBER_OF_BOSSES: {
                stringBuilder.AppendFormat(GText.Objectives.defeat_x_number_of_bosses,
                                           amountOfBossesToDefeat, currentBossesDefeated);
            } break;

            case TaskType.REACH_X_DAY: {
                stringBuilder.AppendFormat(GText.Objectives.reach_x_day, daysToReach);
            } break;

            case TaskType.BEAT_A_STAGE_USING_XYZ_WEAPONS: {
                stringBuilder.AppendFormat(GText.Objectives.beat_a_stage_using,
                                           GText.Objectives.weapon_names[weaponsToBeat[0]],
                                           GText.Objectives.weapon_names[weaponsToBeat[1]],
                                           GText.Objectives.weapon_names[weaponsToBeat[2]]);
            } break;

            case TaskType.SEE_THE_ENDING: {
                if ((DataStorage.StartOnWave / 3 + 1) < 10)
                {
                    stringBuilder.AppendFormat(GText.Objectives.see_the_ending);
                }
                else
                {
                    RequestTask(i);
                }
            } break;

            case TaskType.FREE: {
                stringBuilder.AppendFormat(currentFreeTask);
            } break;
            }

            if (displaySlow && tasks[i].gameObject.activeInHierarchy)
            {
                TextBlock.Display(tasks[i], stringBuilder.ToString());
            }
            else
            {
                tasks[i].text = stringBuilder.ToString();
            }
        }