コード例 #1
0
ファイル: MemoryConnector.cs プロジェクト: oneminot/everest
        /// <summary>
        /// Perform the work
        /// </summary>
        /// <param name="state">A user state. In our case, the thing
        /// to be sent</param>
        public void Work(object state)
        {
            try
            {
                MemoryStream ms = new MemoryStream();
                Result = new SendResult();

                // Format and set result details
                var result = Formatter.Graph(ms, (IGraphable)state);
                Result.Code = result.Code;
                Result.Details = result.Details;
            }
            catch (Exception e)
            {
                // Append the error
                Result.Code = ResultCode.Error;
                Result.Details = new IResultDetail[] { new ResultDetail(ResultDetailType.Error, e.Message, e) };
            }

            // Callback
            if (Completed != null) Completed(this);
        }