コード例 #1
0
    public void StartCalibrating()
    {
        if (!SystemInfo.supportsGyroscope)
        {
            state.SetState(State.ERROR);
            Debug.LogError("NO GYRO AVAILABLE");
            onError.Invoke("NO GYRO AVAILABLE");
            return;
        }

        Input.gyro.enabled = true;
        if (!Input.gyro.enabled)
        {
            state.SetState(State.ERROR);
            Debug.LogError("NO GYRO ENABLED");
            onError.Invoke("NO GYRO ENABLED");
            return;
        }

        startTime               = Time.time;
        startOrientation        = MathTools.GyroToUnity(Input.gyro.attitude);
        startOrientationInverse = Quaternion.Inverse(startOrientation);
        minRange = Vector3.zero;
        maxRange = Vector3.zero;
        progress = 0f;
        state.SetState(State.CALIBRATING);

        Debug.Log("Start Calibrating " + startOrientation.ToString("F4") + " " + startOrientationInverse.ToString("F4") + " " + Input.gyro.rotationRate.ToString("F4"));
    }
コード例 #2
0
        IEnumerator SendGetRequest()
        {
            var request         = new UnityWebRequest(m_apiGatewayInfo.url, UnityWebRequest.kHttpVerbGET);
            var downloadHandler = new FileDownloadHandler(m_buf, m_fProgressDispatcher);

            request.timeout         = m_apiGatewayClientTimeout;
            request.downloadHandler = downloadHandler;
            request.SetRequestHeader("x-api-key", m_apiGatewayInfo.accessKey);

            yield return(request.SendWebRequest());

            if (request.isNetworkError)
            {
                Debug.Log("Network Error: " + request.error);
                m_fErrorDispatcher.Invoke(0);
            }
            else if (request.isHttpError)
            {
                Debug.Log("Http Error: " + request.responseCode);
                m_fErrorDispatcher.Invoke((int)request.responseCode);
            }
            else
            {
                Debug.Log(downloadHandler.downloadData);
                m_fCompleteDispatcher.Invoke();
            }
        }
コード例 #3
0
        public static IEnumerator GetInventory(
            Client client,
            GameSession session,
            string inventoryNamespaceName,
            string inventoryName,
            GetInventoryEvent onGetInventory,
            ErrorEvent onError
            )
        {
            EzInventory inventory;
            {
                AsyncResult <EzGetInventoryResult> result = null;
                yield return(client.Inventory.GetInventory(
                                 r => { result = r; },
                                 session,
                                 inventoryNamespaceName,
                                 inventoryName
                                 ));

                if (result.Error != null)
                {
                    onError.Invoke(
                        result.Error
                        );
                    yield break;
                }

                inventory = result.Result.Item;
            }
            var    itemSets = new List <EzItemSet>();
            string nextPageToken;

            do
            {
                AsyncResult <EzListItemsResult> result = null;
                yield return(client.Inventory.ListItems(
                                 r => { result = r; },
                                 session,
                                 inventoryNamespaceName,
                                 inventoryName
                                 ));

                if (result.Error != null)
                {
                    onError.Invoke(
                        result.Error
                        );
                    yield break;
                }

                itemSets.AddRange(result.Result.Items);
                nextPageToken = result.Result.NextPageToken;
            } while (nextPageToken != null);

            onGetInventory.Invoke(inventory, itemSets);
        }
コード例 #4
0
        public static IEnumerator GetQuestModel(
            Client client,
            GameSession session,
            string questNamespaceName,
            string questGroupName,
            GetQuestModelEvent onGetQuestModel,
            ErrorEvent onError
            )
        {
            EzQuestGroupModel questGroupModel;
            {
                AsyncResult <EzGetQuestGroupResult> result = null;
                yield return(client.Quest.GetQuestGroup(
                                 r => { result = r; },
                                 questNamespaceName,
                                 questGroupName
                                 ));

                if (result.Error != null)
                {
                    onError.Invoke(
                        result.Error
                        );
                    yield break;
                }

                questGroupModel = result.Result.Item;
            }
            EzCompletedQuestList completedQuestList;

            {
                AsyncResult <EzGetCompletedQuestListResult> result = null;
                yield return(client.Quest.GetCompletedQuestList(
                                 r => { result = r; },
                                 session,
                                 questNamespaceName,
                                 questGroupName
                                 ));

                if (result.Error != null)
                {
                    onError.Invoke(
                        result.Error
                        );
                    yield break;
                }

                completedQuestList = result.Result.Item;
            }

            onGetQuestModel.Invoke(questGroupModel, completedQuestList);
        }
コード例 #5
0
        public static IEnumerator GetInventoryModel(
            Client client,
            string inventoryNamespaceName,
            string inventoryModelName,
            GetInventoryModelEvent onGetInventoryModel,
            ErrorEvent onError
            )
        {
            EzInventoryModel inventoryModel;
            {
                AsyncResult <EzGetInventoryModelResult> result = null;
                yield return(client.Inventory.GetInventoryModel(
                                 r => { result = r; },
                                 inventoryNamespaceName,
                                 inventoryModelName
                                 ));

                if (result.Error != null)
                {
                    onError.Invoke(
                        result.Error
                        );
                    yield break;
                }

                inventoryModel = result.Result.Item;
            }
            List <EzItemModel> itemModels;

            {
                AsyncResult <EzListItemModelsResult> result = null;
                yield return(client.Inventory.ListItemModels(
                                 r => { result = r; },
                                 inventoryNamespaceName,
                                 inventoryModelName
                                 ));

                if (result.Error != null)
                {
                    onError.Invoke(
                        result.Error
                        );
                    yield break;
                }

                itemModels = result.Result.Items;
            }

            onGetInventoryModel.Invoke(inventoryModelName, inventoryModel, itemModels);
        }
コード例 #6
0
        public static IEnumerator GetWallet(
            Client client,
            GameSession session,
            string moneyNamespaceName,
            int slot,
            GetWalletEvent onGetWallet,
            ErrorEvent onError
            )
        {
            AsyncResult <EzGetResult> result = null;

            yield return(client.Money.Get(
                             r =>
            {
                result = r;
            },
                             session,
                             moneyNamespaceName,
                             slot
                             ));

            if (result.Error != null)
            {
                onError.Invoke(
                    result.Error
                    );
                yield break;
            }

            var wallet = result.Result.Item;

            onGetWallet.Invoke(wallet);
        }
コード例 #7
0
        public static IEnumerator GetExchangeRate(
            Client client,
            string exchangeNamespaceName,
            GetExchangeRateEvent onGetExchangeRate,
            ErrorEvent onError
            )
        {
            AsyncResult <EzListRateModelsResult> result = null;

            yield return(client.Exchange.ListRateModels(
                             r => { result = r; },
                             exchangeNamespaceName
                             ));

            if (result.Error != null)
            {
                onError.Invoke(
                    result.Error
                    );
                yield break;
            }

            var rateModels = result.Result.Items;

            onGetExchangeRate.Invoke(exchangeNamespaceName, rateModels);
        }
コード例 #8
0
        private void ParserGeneration_ErrorDataReceived(object sender, DataReceivedEventArgs e)
        {
            if (!string.IsNullOrEmpty(e.Data) && !e.IsIgnoreJavaError())
            {
                var strs = e.Data.Split(':');
                int line = 1, column = 1;

                int locationIndex = strs.Length > 2 && strs[2].Length > 0 && strs[2][0] == '\\' ? 3 : 2;
                if (strs.Length > locationIndex)
                {
                    if (!int.TryParse(strs[locationIndex], out line))
                    {
                        line = 1;
                    }
                    if (strs.Length > locationIndex + 1)
                    {
                        if (!int.TryParse(strs[locationIndex + 1], out column))
                        {
                            column = 1;
                        }
                    }
                }
                ParsingError error = new ParsingError(line, column, e.Data, _currentGrammarSource, WorkflowStage.ParserGenerated);
                if (strs.Length > 0 && strs[0].StartsWith("warning"))
                {
                    error.IsWarning = true;
                }
                ErrorEvent?.Invoke(this, error);
                _result.Errors.Add(error);
            }
        }
コード例 #9
0
        // 检测到上下料错误抛出异常
        // TODO 外部函数无法接到异常
        public virtual void StartMonitor()
        {
            _cts = new CancellationTokenSource();
            //
            Task.Run(() =>
            {
                while (true)
                {
                    if (_cts.IsCancellationRequested)
                    {
                        break;
                    }

                    try
                    {
                        OnError();
                    }
                    catch (Exception)
                    {
                        //throw;
                        ClientLogs.Inst.AddLog(new ClientLog(this.GetType().FullName + "OnError"));
                        PLCAccessor.Instance.Connected = false;
                        ErrorEvent?.Invoke(this, null);
                    }

                    Task.Delay(1000).Wait();
                }
            }, _cts.Token);
        }
コード例 #10
0
ファイル: Softphone.cs プロジェクト: sdwflmw/lindotnet
        private void LinphoneWrapper_RegistrationStateChangedEvent(LinphoneRegistrationState state)
        {
            switch (state)
            {
            case LinphoneRegistrationState.LinphoneRegistrationProgress:
                ConnectState = ConnectState.Progress;
                break;

            case LinphoneRegistrationState.LinphoneRegistrationOk:
                ConnectState = ConnectState.Connected;
                PhoneConnectedEvent?.Invoke();
                break;

            case LinphoneRegistrationState.LinphoneRegistrationCleared:
                ConnectState = ConnectState.Disconnected;
                PhoneDisconnectedEvent?.Invoke();
                break;

            case LinphoneRegistrationState.LinphoneRegistrationFailed:
                LinphoneWrapper.DestroyPhone();
                ErrorEvent?.Invoke(null, Error.RegisterFailed);
                break;

            case LinphoneRegistrationState.LinphoneRegistrationNone:
            default:
                break;
            }
        }
コード例 #11
0
ファイル: YoutubeProcessor.cs プロジェクト: AxelFriman/Qbey
        //Gets "/videos" page with webclient and parses response. Returns last video ID.
        public async Task <string> getLastVideoFromWeb(string linkToChannelVideosTab) //TODO убрать статику, а то потоки
        {
            string htmlCode    = "";
            string startString = "var ytInitialData = ";
            string endString   = ";</script>";

            using (WebClient client = new WebClient())
            {
                client.Encoding = Encoding.UTF8;
                htmlCode        = await client.DownloadStringTaskAsync(new Uri(linkToChannelVideosTab));
            }
            int          startIndex = htmlCode.IndexOf(startString) + startString.Length;
            int          endIndex   = htmlCode.IndexOf(endString, startIndex);
            string       jsonTxt    = htmlCode.Substring(startIndex, endIndex - startIndex);
            videosPage   root       = Newtonsoft.Json.JsonConvert.DeserializeObject <videosPage>(jsonTxt);
            GridRenderer videos     = null;

            try
            {
                videos = root.contents.twoColumnBrowseResultsRenderer.Tabs[1].tabRenderer
                         .content.sectionListRenderer.contents[0].itemSectionRenderer.contents[0]
                         .gridRenderer;
            }
            catch (NullReferenceException)
            {
                ErrorEvent?.Invoke(new LogMessage(LogSeverity.Error, "YoutubeProcessor.getLastVideoFromWeb", $"Unable to serialize a videos page.\nChannel: {linkToChannelVideosTab}\nResponsed json:{jsonTxt}"));
            }
            return(videos?.items[0].gridVideoRenderer.videoId);
        }
コード例 #12
0
        public static IEnumerator GetCounter(
            Client client,
            GameSession session,
            string limitNamespaceName,
            EzLimitModel limitModel,
            string counterName,
            GetCounterEvent onGetCounter,
            ErrorEvent onError
            )
        {
            AsyncResult <EzGetCounterResult> result = null;

            yield return(client.Limit.GetCounter(
                             r =>
            {
                result = r;
            },
                             session,
                             limitNamespaceName,
                             limitModel.Name,
                             counterName
                             ));

            if (result.Error != null)
            {
                onError.Invoke(
                    result.Error
                    );
                yield break;
            }

            var counter = result.Result.Item;

            onGetCounter.Invoke(limitModel, counter);
        }
コード例 #13
0
        public GrammarCheckedState Check(InputState inputState, CancellationToken cancellationToken = default)
        {
            var grammar = inputState.Grammar;

            _result = new GrammarCheckedState(inputState);
            try
            {
                var antlrErrorListener = new AntlrErrorListener();
                antlrErrorListener.ErrorEvent += ErrorEvent;
                antlrErrorListener.ErrorEvent += (sender, error) =>
                {
                    lock (_result.Errors)
                    {
                        _result.Errors.Add(error);
                    }
                };

                foreach (string grammarFileName in grammar.Files)
                {
                    ProcessGrammarFile(grammar, grammarFileName, antlrErrorListener, cancellationToken);
                }
            }
            catch (Exception ex)
            {
                _result.Exception = ex;
                if (!(ex is OperationCanceledException))
                {
                    ErrorEvent?.Invoke(this, new ParsingError(ex, WorkflowStage.GrammarChecked));
                }
            }

            return(_result);
        }
コード例 #14
0
ファイル: Program.cs プロジェクト: AxelFriman/Qbey
        private void LoadSettigs(DiscordSocketClient client, MainConfig config)
        {
            foreach (var guild in client.Guilds)
            {
                try
                {
                    var newConfig = new GuildConfigSettings(guild.Id + "/config.json");
                    config.GuildsSettings.Add(guild.Id, newConfig);
                }
                catch (NullReferenceException)
                {
                    ErrorEvent?.Invoke(new LogMessage(LogSeverity.Error, "LoadSettings", $"Unable to load server settings for {guild.Name} ({guild.Id})"));
                };
                try
                {
                    var newFollows = new FollowsSettings(guild.Id + "/follows.json");
                    config.GuildsFollows.Add(guild.Id, newFollows);
                }
                catch (NullReferenceException)
                {
                    ErrorEvent?.Invoke(new LogMessage(LogSeverity.Error, "LoadSettings", $"Unable to load follows for {guild.Name} ({guild.Id})"));
                }
            }

            //TODO move this away from here
            Dictionary <ulong, Timer> timers = new Dictionary <ulong, Timer>();

            foreach (var setts in MainConfig.Instance.GuildsSettings)
            {
                timers.Add(setts.Key, YoutubeCheckTimer.Create(setts.Key));
            }
        }
コード例 #15
0
 public void SaveBinaryFormatter(object obj)
 {
     if (obj == null)
     {
         ErrorEvent?.Invoke(this, "Передаваемый объект является NULL");
         return;
     }
     try
     {
         // создаем объект BinaryFormatter
         var formatter = new BinaryFormatter();
         using (FileStream fs = new FileStream(FullName, FileMode.OpenOrCreate))
         {
             formatter.Serialize(fs, obj);
         }
     }
     catch (SerializationException)
     {
         throw;
     }
     catch (Exception ex)
     {
         ErrorEvent?.Invoke(this, ex.Message);
     }
 }
コード例 #16
0
        public static IEnumerator GetMoldModel(
            Client client,
            string formationNamespaceName,
            string moldModelName,
            GetMoldModelEvent onGetMoldModel,
            ErrorEvent onError
            )
        {
            AsyncResult <EzGetMoldModelResult> result = null;

            yield return(client.Formation.GetMoldModel(
                             r =>
            {
                result = r;
            },
                             formationNamespaceName,
                             moldModelName
                             ));

            if (result.Error != null)
            {
                onError.Invoke(
                    result.Error
                    );
                yield break;
            }

            var moldModel = result.Result.Item;

            onGetMoldModel.Invoke(moldModelName, moldModel);
        }
コード例 #17
0
ファイル: Softphone.cs プロジェクト: sdwflmw/lindotnet
        private void LinphoneWrapper_CallStateChangedEvent(Call call)
        {
            var callState = call.State;

            switch (callState)
            {
            case CallState.Active:
                LineState = LineState.Busy;
                CallActiveEvent?.Invoke(call);
                break;

            case CallState.Hold:
                break;

            case CallState.Error:
                LineState = LineState.Free;
                ErrorEvent?.Invoke(null, Error.CallError);
                break;

            case CallState.Loading:
                LineState = LineState.Busy;
                if (call.Type == CallType.Incoming)
                {
                    IncomingCallEvent?.Invoke(call);
                }
                break;

            case CallState.Completed:
            default:
                LineState = LineState.Free;
                CallCompletedEvent?.Invoke(call);
                break;
            }
        }
コード例 #18
0
        public static IEnumerator GetStaminaModel(
            Client client,
            string staminaNamespaceName,
            string staminaModelName,
            GetStaminaModelEvent onGetStaminaModel,
            ErrorEvent onError
            )
        {
            AsyncResult <EzGetStaminaModelResult> result = null;

            yield return(client.Stamina.GetStaminaModel(
                             r =>
            {
                result = r;
            },
                             staminaNamespaceName,
                             staminaModelName
                             ));

            if (result.Error != null)
            {
                onError.Invoke(
                    result.Error
                    );
                yield break;
            }

            var staminaModel = result.Result.Item;

            onGetStaminaModel.Invoke(staminaModelName, staminaModel);
        }
コード例 #19
0
 /// <summary>
 /// Called when navigation to a new URL is completed. Here we have to check the code parameter in the URL. It contains the first access token. If an error parameter is passed in the URL, we know that retrieving tokens failed.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnNavigation(object sender, NavigationEventArgs e)
 {
     if (!e.Uri.ToString().Equals(Settings.REGISTRATION_URL))
     {
         if (e.Uri.ToString().Contains("?code"))
         {
             var    queryDict  = HttpUtility.ParseQueryString(e.Uri.Query);
             string accessCode = queryDict.Get("code");
             accessCode = accessCode.Replace("#_=_", "");
             if (!_embedded)
             {
                 ShowThanksScreen();
             }
             RegistrationTokenEvent?.Invoke(accessCode);
         }
         else if (e.Uri.ToString().Contains("?error"))
         {
             if (!_embedded)
             {
                 ShowErrorScreen();
             }
             ErrorEvent?.Invoke();
         }
     }
 }
コード例 #20
0
        public static IEnumerator GetStamina(
            Client client,
            GameSession session,
            string staminaNamespaceName,
            EzStaminaModel staminaModel,
            GetStaminaEvent onGetStamina,
            ErrorEvent onError
            )
        {
            AsyncResult <EzGetStaminaResult> result = null;

            yield return(client.Stamina.GetStamina(
                             r =>
            {
                result = r;
            },
                             session,
                             staminaNamespaceName,
                             staminaModel.Name
                             ));

            if (result.Error != null)
            {
                onError.Invoke(
                    result.Error
                    );
                yield break;
            }

            var stamina = result.Result.Item;

            onGetStamina.Invoke(staminaModel, stamina);
        }
コード例 #21
0
        public async void StartListening()
        {
            tcpListener = new TcpListener(localEndPoint);
            tcpListener.Start();
            isListening = true;

            try
            {
                while (isListening)
                {
                    var client = await tcpListener.AcceptTcpClientAsync();

                    if (ConnectedClient == null)
                    {
                        ConnectedClient = client;
                    }
                    var t = Task.Run(() => HandleConnection(client));
                }
            }
            catch (Exception e)
            {
                if (tcpListener != null)
                {
                    tcpListener.Stop();
                }

                ConnectedClient = null;
                isBusy          = false;
                isListening     = false;

                ErrorEvent.Invoke(e.Message);
            }
        }
コード例 #22
0
        public void MakeCallAndRecord(string uri, string filename, bool startRecordInstantly)
        {
            if (LinphoneCore.IsNonZero())
            {
                var callParams = CreateCallParameters();

                if (!string.IsNullOrWhiteSpace(filename))
                {
                    CallModule.linphone_call_params_set_record_file(callParams, filename);
                }

                IntPtr call = CallModule.linphone_core_invite_with_params(LinphoneCore, uri, callParams);

                if (call.IsZero())
                {
#if (DEBUG)
                    ErrorEvent?.Invoke(null, "Can't call!");
#endif
                    return;
                }

                CallModule.linphone_call_ref(call);
                if (startRecordInstantly)
                {
                    GenericModules.linphone_call_start_recording(call);
                }
            }
        }
コード例 #23
0
ファイル: AntlrErrorListener.cs プロジェクト: ag-csharp/DAGE
        public void SyntaxError(IRecognizer recognizer, int offendingSymbol, int line, int charPositionInLine, string msg, RecognitionException e)
        {
            var message     = FormatErrorMessage(line, charPositionInLine, msg);
            var parserError = new ParsingError(line, charPositionInLine, message, CodeSource, WorkflowStage.GrammarChecked);

            ErrorEvent?.Invoke(this, parserError);
        }
コード例 #24
0
    public void FileAddWrite(string text, string url, TaskEvent finished = null, ErrorEvent error = null)
    {
        try
        {
            FtpWebRequest request = (FtpWebRequest)WebRequest.Create(new Uri(accessUrlBase + url));
            request.Method = WebRequestMethods.Ftp.AppendFile;

            byte[] fileContents = Encoding.UTF8.GetBytes(text);

            request.ContentLength = fileContents.Length;
            request.Credentials   = icr;

            Stream requestStream = request.GetRequestStream();
            requestStream.Write(fileContents, 0, fileContents.Length);
            requestStream.Close();
            FtpWebResponse response = (FtpWebResponse)request.GetResponse();
            response.Close();
            requestStream.Dispose();
            response.Dispose();
            finished?.Invoke();
        }
        catch (WebException e)
        {
            error?.Invoke(((FtpWebResponse)e.Response).StatusDescription);
        }
    }
コード例 #25
0
        public static IEnumerator Exchange(
            Client client,
            GameSession session,
            string exchangeNamespaceName,
            string rateName,
            int count,
            IssueExchangeStampSheetEvent onIssueBuyStampSheet,
            ErrorEvent onError,
            List <EzConfig> configs = null
            )
        {
            AsyncResult <EzExchangeResult> result = null;

            yield return(client.Exchange.Exchange(
                             r => { result = r; },
                             session,
                             exchangeNamespaceName,
                             rateName,
                             count,
                             configs
                             ));

            if (result.Error != null)
            {
                onError.Invoke(
                    result.Error
                    );
                yield break;
            }

            var stampSheet = result.Result.StampSheet;

            onIssueBuyStampSheet.Invoke(stampSheet);
        }
コード例 #26
0
        public static IEnumerator Run(
            Client client,
            GameSession gameSession,
            string jobQueueNamespaceName,
            RunJobEvent onRunJob,
            ErrorEvent onError
            )
        {
            AsyncResult <EzRunResult> result = null;

            yield return(client.JobQueue.Run(
                             r => { result = r; },
                             gameSession,
                             jobQueueNamespaceName
                             ));

            if (result.Error != null)
            {
                Debug.LogError(result.Error);
                onError.Invoke(
                    result.Error
                    );
                yield break;
            }

            var job       = result.Result.Item;
            var jobResult = result.Result.Result;
            var isLastJob = result.Result.IsLastJob;

            Debug.Log(isLastJob);
            onRunJob.Invoke(job, jobResult, isLastJob);

            yield return(new WaitForSeconds(1));
        }
コード例 #27
0
ファイル: DBOperator.cs プロジェクト: yuezhuosuigu-cs/SuperDB
 /// <summary>
 /// 执行数据库命令,含事务
 /// 要么全部成功,要么全部失败
 /// </summary>
 /// <param name="factory">数据库工厂</param>
 /// <param name="commands">数据库操作命令</param>
 /// <returns>全部执行成功返回true,否则返回false</returns>
 public static bool TryExecute(this DBFactory factory, IEnumerable<DBCommand> commands)
 {
     try
     {
         if (commands == null)
         {
             return false;
         }
         if (commands.Count() == 0)
         {
             return false;
         }
         using (factory)
         {
             var flag = true;
             foreach (var command in commands)
             {
                 flag &= factory.Connection.Execute(command.CommandText, command.CommandParameter, factory.Transaction) > 0;
             }
             return flag ? factory.Commit() : factory.Rollback();
         }
     }
     catch (Exception ex)
     {
         ErrorEvent?.Invoke(ex);
         return false;
     }
 }
コード例 #28
0
 protected virtual async Task OnErrorEvent(object sender, WSErrorClientEventArgs args)
 {
     if (ErrorEvent != null)
     {
         await ErrorEvent?.Invoke(sender, args);
     }
 }
コード例 #29
0
 protected virtual async Task FireErrorEventAsync(object sender, ErrorEventArgs args)
 {
     if (ErrorEvent != null)
     {
         await ErrorEvent?.Invoke(sender, args);
     }
 }
コード例 #30
0
        public IEnumerator Exec(Profile profile, GameSession session)
        {
            var gs2Client = Gs2Util.LoadGlobalGameObject <Gs2Client>("Gs2Settings");

            profile.Gs2Session.OnNotificationMessage += msg => _notificationMessages.Enqueue(msg);

            while (!kill)
            {
                AsyncResult <EzRunResult> result = null;
                yield return(gs2Client.client.JobQueue.Run(
                                 r => result = r,
                                 session,
                                 jobQueueNamespaceName
                                 ));

                if (result.Error != null)
                {
                    onError.Invoke(result.Error);
                    yield break;
                }
                else if (result.Result != null && result.Result.Item != null)
                {
                    onResult.Invoke(
                        result.Result.Item,
                        result.Result.Result.StatusCode,
                        result.Result.Result.Result
                        );
                }

                if (result.Result != null && result.Result.IsLastJob)
                {
                    yield return(Wait());
                }
            }
        }