Ejemplo n.º 1
0
        private void SetReturnValue(ReturnResult result)
        {
            long idx = result.Id;

            if (CallBackDiy.ContainsKey(idx))
            {
                AsyncCalls call;

                if (CallBackDiy.TryRemove(result.Id, out call))
                {
                    try
                    {
                        call.SetRet(result);
                    }
                    catch (Exception er)
                    {
                        LogAction.Log(LogType.Err, "CMD:" + call.Cmd + " ERROR:\r\n" + er.Message);
                    }
                }
            }
            else if (AsyncRunDiy.ContainsKey(idx))
            {
                AsyncRun call;

                if (AsyncRunDiy.TryRemove(result.Id, out call))
                {
                    try
                    {
                        call.SetRet(result);
                    }
                    catch (Exception er)
                    {
                        LogAction.Log(LogType.Err, "AsynRun ID:" + result.Id + " ERROR:\r\n" + er.Message);
                    }
                }
            }
            else if (SyncWaitDic.ContainsKey(idx))
            {
                ReturnEventWaitHandle wait;

                if (SyncWaitDic.TryRemove(result.Id, out wait))
                {
                    wait.Set(result);
                }
            }
            else
            {
                throw new InvalidOperationException("not call the Id");
            }
        }
Ejemplo n.º 2
0
        private void SetReturnValue(Result result)
        {
            long idx = result.Id;

            if (CallBackDiy.ContainsKey(idx))
            {
                if (CallBackDiy.TryRemove(result.Id, out AsyncCalls call))
                {
                    try
                    {
                        call.SetRes(result);
                    }
                    catch (Exception er)
                    {
                        if (PushException(new SetResultException(er.Message, (int)ErrorTag.SetErr, er)))
                        {
                            Log.Error($"CMD:{call.Cmd} ERROR:\r\n{er.Message}");
                        }
                    }
                }
            }
            else if (AsyncRunDiy.ContainsKey(idx))
            {
                if (AsyncRunDiy.TryRemove(result.Id, out AsyncRun call))
                {
                    try
                    {
                        call.SetRet(result);
                    }
                    catch (Exception er)
                    {
                        if (PushException(new SetResultException(er.Message, (int)ErrorTag.SetErr, er)))
                        {
                            Log.Error($"AsynRun ID:{result.Id} ERROR:\r\n{er.Message}");
                        }
                    }
                }
            }
            else if (SyncWaitDic.ContainsKey(idx))
            {
                if (SyncWaitDic.TryRemove(result.Id, out ReturnEventWaitHandle wait))
                {
                    wait.Set(result);
                }
            }
        }