Exemplo n.º 1
0
        private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            GeneratorEventArgs generatorEventArgs = e.Argument as GeneratorEventArgs;

            if (null == generatorEventArgs)
            {
                throw new ArgumentException();
            }

            EnableControls(false);

            while (!backgroundWorker.CancellationPending)
            {
                generator.Generate(generatorEventArgs.Text);

                if (!generatorEventArgs.Forever)
                {
                    break;
                }

                for (int i = 0; i < 30; i++)
                {
                    Thread.Sleep(100);

                    if (backgroundWorker.CancellationPending)
                    {
                        break;
                    }
                }
            }

            ResetAvailability();
        }
Exemplo n.º 2
0
        private void Generate(bool forever)
        {
            if (!CheckText())
            {
                return;
            }

            generator.UnitDuration = configurationFile.GetSetting("unitDuration", 250);

            generator.DotDuration  = configurationFile.GetSetting("dotDuration", 1);
            generator.DashDuration = configurationFile.GetSetting("dashDuration", 3);
            generator.GapDuration  = configurationFile.GetSetting("gapDuration", 1);

            generator.LetterSpacing = configurationFile.GetSetting("letterSpacing", 3);
            generator.WordSpacing   = configurationFile.GetSetting("wordSpacing", 7);


            GeneratorEventArgs generatorEventArgs = new GeneratorEventArgs(this.textBoxText.Text, forever);

            backgroundWorker.RunWorkerAsync(generatorEventArgs);
        }
Exemplo n.º 3
0
        private void Generate(bool forever)
        {
            if (!CheckText())
            {
                return;
            }

            generator.UnitDuration = configurationFile.GetSetting("unitDuration", 250);

            generator.DotDuration = configurationFile.GetSetting("dotDuration", 1);
            generator.DashDuration = configurationFile.GetSetting("dashDuration", 3);
            generator.GapDuration = configurationFile.GetSetting("gapDuration", 1);

            generator.LetterSpacing = configurationFile.GetSetting("letterSpacing", 3);
            generator.WordSpacing = configurationFile.GetSetting("wordSpacing", 7);

            GeneratorEventArgs generatorEventArgs = new GeneratorEventArgs(this.textBoxText.Text, forever);
            backgroundWorker.RunWorkerAsync(generatorEventArgs);
        }