MCAEmotiv.Interop.EmotivHeadset.TryGetData C# (CSharp) Method

TryGetData() public method

Returns true upon successfully retrieving data from the headset, and false otherwise
public TryGetData ( double[]>.Dictionary &data ) : bool
data double[]>.Dictionary
return bool
        public bool TryGetData(out Dictionary<EdkDll.EE_DataChannel_t, double[]> data)
        {
            data = null;
            lock (this.Lock)
            {
                // if no user, we can't succeed
                if (this.userID == NO_USER)
                    this.engine.ProcessEvents();

                try
                {
                    data = this.engine.GetData((uint)this.userID);
                    if (data == null)
                    {
                        Thread.Sleep(10);
                        data = this.engine.GetData((uint)this.userID);
                    }
                }
                catch (Exception) { }

                // error case
                if (data == null)
                {
                    //this.userID = NO_USER;
                    return false;
                }

                return true;
            }
        }