Exemplo n.º 1
0
 public override void Dispose()
 {
     if (mPost != null)
     {
         mPost.Dispose();
     }
     if (mGet != null)
     {
         mGet.Dispose();
     }
     mPost = null;
     mGet  = null;
 }
Exemplo n.º 2
0
        public override eJobState GetState()
        {
            if (mWeb != null)
            {
                var state = mWeb.GetState();
                switch (state)
                {
                case eJobState.Running: return(eJobState.Running);

                case eJobState.Succeeded:
                {
                    mJobState = eJobState.Succeeded;
                    break;
                }

                case eJobState.Failed:
                {
                    mWeb.Dispose();
                    mWeb  = null;
                    mPost = new TranslationJob_POST(_requests, _OnTranslationReady);
                    break;
                }
                }
            }
            if (mPost != null)
            {
                var state = mPost.GetState();
                switch (state)
                {
                case eJobState.Running: return(eJobState.Running);

                case eJobState.Succeeded:
                {
                    mJobState = eJobState.Succeeded;
                    break;
                }

                case eJobState.Failed:
                {
                    mPost.Dispose();
                    mPost = null;
                    mGet  = new TranslationJob_GET(_requests, _OnTranslationReady);
                    break;
                }
                }
            }
            if (mGet != null)
            {
                var state = mGet.GetState();
                switch (state)
                {
                case eJobState.Running: return(eJobState.Running);

                case eJobState.Succeeded:
                {
                    mJobState = eJobState.Succeeded;
                    break;
                }

                case eJobState.Failed:
                {
                    mErrorMessage = mGet.mErrorMessage;
                    if (_OnTranslationReady != null)
                    {
                        _OnTranslationReady(_requests, mErrorMessage);
                    }
                    mGet.Dispose();
                    mGet = null;
                    break;
                }
                }
            }

            return(mJobState);
        }