Exemplo n.º 1
0
        private static IGetString GetInstanceNoAsync(IUseMethod method, IGenerateSerie reporter, IGetBase lastClass)
        {
            if (method == null)
            {
                return(null);
            }

            var processing = StrategyTodoFactory.GetInstance(method.TypeDoIndependentWork, reporter, method.NumSteps);

            IStrategyTodo todo = StrategyTodoFactory.GetInstance(method.TypeDoIndependentWork, reporter, method.NumSteps);

            MyWorkSync myW = new MyWorkSync(todo, reporter);

            if (method.Next == null)
            {
                return(new MethodSyncFinal(myW, reporter, processing, method));
            }
            else
            {
                IGetString result = null;
                if (lastClass is IGetString)
                {
                    result = new CallNextSyncIfNextMethodIsSync(myW, (IGetString)lastClass, reporter, method);
                }
                else if (lastClass is IGetStringAsync)
                {
                    switch (method.CallNext)
                    {
                    case ECallNext.WAIT_FIRST:
                        result = new CallNextSyncWaitFirstIfNextMethodIsAsync(myW, (IGetStringAsync)lastClass, reporter, method);
                        break;

                    case ECallNext.WAIT_AFTER:
                    case ECallNext.AWAITER_AFTER:
                    case ECallNext.NOT_WAIT:
                        result = new CallNextSyncWaitAfterIfNextMethodIsAsync(myW, (IGetStringAsync)lastClass, reporter, method);
                        break;
                    }
                }

                return(result);
            }
        }
Exemplo n.º 2
0
 public MethodSyncFinal(IMyWorkSync pMyWork, IGenerateSerie gen, IStrategyTodo pProcesamiento, IUseMethod pMethod)
     : base(pMyWork, gen, pMethod)
 {
 }
Exemplo n.º 3
0
 public MyWorkAsyncAwaiter(IStrategyTodo pProcesamiento, IGenerateSerie pgenerator)
     : base(pProcesamiento, pgenerator)
 {
 }
Exemplo n.º 4
0
 public MyWorkSync(IStrategyTodo pProcesamiento, IGenerateSerie pgenerator)
     : base(pProcesamiento, pgenerator)
 {
 }
Exemplo n.º 5
0
 public MyWork(IStrategyTodo pProcesamiento, IGenerateSerie pgenerator)
 {
     StrategyTodo = pProcesamiento;
     generator    = pgenerator;
 }
Exemplo n.º 6
0
        private static IGetStringAsync GetInstanceAsync(IUseMethod method, IGenerateSerie reporter, IGetBase lastClass)
        {
            if (method == null)
            {
                return(null);
            }

            var processing = StrategyTodoFactory.GetInstance(method.TypeDoIndependentWork, reporter, method.NumSteps);


            IStrategyTodo todo = StrategyTodoFactory.GetInstance(method.TypeDoIndependentWork, reporter, method.NumSteps);

            MyWorkAsync myW = null;

            switch (method.StrategyDoIndependentWork)
            {
            case EStrategyDoIndependentWork.WRAPPER_ASYNC:
                myW = new MyWorkAsyncWait(todo, reporter);
                break;

            case EStrategyDoIndependentWork.WRAPPER_ASYNC_AWAITER:
                myW = new MyWorkAsyncAwaiter(todo, reporter);
                break;

            case EStrategyDoIndependentWork.NORMAL:
                myW = new MyWorkAsyncNotWait(todo, reporter);
                break;
            }


            if (method.Next == null)
            {
                return(new MainAsyncFinal(myW, reporter, processing, method));
            }
            else
            {
                IGetStringAsync result = null;
                if (lastClass is IGetStringAsync)
                {
                    switch (method.CallNext)
                    {
                    case ECallNext.WAIT_FIRST:
                        result = new CallNextAsyncWaitFirst(myW, (IGetStringAsync)lastClass, reporter, method);
                        break;

                    case ECallNext.WAIT_AFTER:
                        result = new CallNextAsyncWaitAfter(myW, (IGetStringAsync)lastClass, reporter, method);
                        break;

                    case ECallNext.AWAITER_AFTER:
                        result = new CallNextAsyncAwaiter(myW, (IGetStringAsync)lastClass, reporter, method);
                        break;

                    case ECallNext.NOT_WAIT:
                        result = new CallNextAsyncNotWait(myW, (IGetStringAsync)lastClass, reporter, method);
                        break;
                    }
                }
                else
                {
                    result = new CallNextAsyncToSync(myW, (IGetString)lastClass, reporter, method);
                }
                return(result);
            }
        }