public ExtWebValueCallbackListener GetCallbackListener(int requestObjectId)
        {
            ExtWebValueCallbackListener listener = new ExtWebValueCallbackListener(requestObjectId);

            GetValueCallbackById(this.CallbackId, this);
            return(listener);
        }
 public static ExtWebValueCallbackListener GetValueCallbackById(int id = -1, ExtWebValueCallbackListener valueCb = null)
 {
     if (id == -1 && valueCb == null)
     {
         if (_extValueCallbackDictionary.Count > 0)
         {
             _extValueCallbackDictionary.First();
         }
     }
     if (!_extValueCallbackDictionary.ContainsKey(id) && valueCb != null)
     {
         _extValueCallbackDictionary.Add(id, valueCb);
         return(_extValueCallbackDictionary[id]);
     }
     else if (_extValueCallbackDictionary.ContainsKey(id) && valueCb == null)
     {
         return(_extValueCallbackDictionary[id]);
     }
     else
     {
         _extValueCallbackDictionary.Remove(id);
         _extValueCallbackDictionary.Add(id, valueCb);
         return(_extValueCallbackDictionary[id]);
     }
 }
        public async void StartAwaitCallbackValueLoop(ExtWebValueCallbackListener listener)
        {
            bool loopStarted = false;

            while (((listener.ResultObject?.ToString() == "null" || listener.ResultObject?.ToString() == "true" ||
                     listener.ResultObject?.ToString() == "false") || listener.ResultObject == null) || loopStarted == false)
            {
                loopStarted = true;
                await Task.Delay(100);

                if (listener.ResultObject != null && ((ObjectType)listener.ResultObject) != ObjectType.None)
                {
                    listener.ResultObjectJava = (Java.Lang.Object)listener.ResultObject;
                    var cast = listener.ResultObject.ToString();
                    if (cast == "true")
                    {
                        _serviceWebViewPlayingList.Add(PlaystateManagement.GetWebViewPlayerById(listener.RequestObjectId, -1));
                        return;
                    }
                }

                if (listener.ResultObject != null)
                {
                    if ((ObjectType)listener.ResultObject == ObjectType.None)
                    {
                        _nullObjectCount++;
                        return;
                    }
                }
            }
        }