Exemplo n.º 1
0
Arquivo: Form1.cs Projeto: zilo312/aa
        private void button1_Click(object sender, EventArgs e)
        {
            this.textBox3.Text = Thread.CurrentThread.ManagedThreadId.ToString();
            AsyncComponent c1 = new AsyncComponent();

            c1.LongTaskCompleted += new LongTaskCompletedEventHandler(c1_LongTaskCompleted);
            c1.LongTaskAsync(this.textBox1.Text, 33);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            component = new DecoratorComponent(new ConcreteComponent());
            component.Something();


            var composite = new CompositeComponent();

            composite.AddComponent(new Leaf());
            composite.AddComponent(new SecondTypeOfLeaf());
            composite.AddComponent(new AThirdLeafType());
            composite.AddComponent(new Leaf());

            component = composite;
            component.Something();

            var calculator = new LoggingCalculator(new ConcreteCalculator());

            calculator.Add(129, 234);

            //var profilingComponent = new ProfilingComponent(new SlowComponent(), new LoggingStopwatch(new StopwatchAdapter()));
            //profilingComponent.Something();

            var asyncComponent = new AsyncComponent(new ProfilingComponent(new SlowComponent(), new LoggingStopwatch(new StopwatchAdapter())));

            asyncComponent.Something();

            Console.ReadLine();
            Console.WriteLine("five");

            Console.ReadLine();
            Console.WriteLine("four");

            Console.ReadLine();
            Console.WriteLine("three");

            Console.ReadLine();
            Console.WriteLine("two");

            Console.ReadLine();
            Console.WriteLine("one");

            Console.ReadLine();
            Console.WriteLine("zero -- program exited.");
        }
Exemplo n.º 3
0
 public void AsyncComponentTest() =>
 Assert.IsTrue(AsyncComponent.Assert(ITERATION_CNT));