public static void DrawElementBlink(string slotName, double x, double y, double w, double h, double actualW = -1, double actualH = -1, bool downUp = false)
    {
        double     blinkValue = 0;
        MyKeyValue one        = null;

        foreach (MyKeyValue tmp in blinking)
        {
            if (slotName == tmp.Key)
            {
                one        = tmp;
                blinkValue = tmp.Value;
            }
        }

        if (blinkValue > 0)
        {
            DrawElement(slotName, x, y, w, h, actualW, actualH, downUp);
        }

        if (blinkValue > 0.25)
        {
            blinkValue = -0.25;
        }

        if (one == null)
        {
            one     = new MyKeyValue();
            one.Key = slotName;
            blinking.Add(one);
        }

        one.Value = blinkValue;
    }
Пример #2
0
            internal void OnSE(ushort reqId, string errMessage, string errWhere, int errCode)
            {
                MyKeyValue <ushort, CResultCb> p = GetAsyncResultHandler(reqId);

                OnExceptionFromServer(reqId, errMessage, errWhere, errCode);
                if (p != null)
                {
                    CResultCb rcb = p.Value;
                    if (rcb != null && rcb.ExceptionFromServer != null)
                    {
                        rcb.ExceptionFromServer.Invoke(this, reqId, errMessage, errWhere, errCode);
                    }
                }
                lock (m_cs)
                {
                    foreach (var el in m_lstEFS)
                    {
                        el.Invoke(this, reqId, errMessage, errWhere, errCode);
                    }
                }
            }
Пример #3
0
            internal void onRR(ushort reqId, CUQueue mc)
            {
                if (tagBaseRequestID.idInterrupt == (tagBaseRequestID)reqId)
                {
                    ulong options;
                    mc.Load(out options);
                    OnInterrupted(options);
                    return;
                }

                MyKeyValue <ushort, CResultCb> p = GetAsyncResultHandler(reqId);

                do
                {
                    if (p != null && p.Value != null && p.Value.AsyncResultHandler != null)
                    {
                        m_ar.Reset(reqId, mc, p.Value.AsyncResultHandler);
                        p.Value.AsyncResultHandler.Invoke(m_ar);
                        break;
                    }
                    bool processed = false;
                    lock (m_cs)
                    {
                        foreach (DOnResultReturned r in m_lstRR)
                        {
                            if (r.Invoke(this, reqId, mc))
                            {
                                processed = true;
                                break;
                            }
                        }
                    }
                    if (processed)
                    {
                        break;
                    }
                    OnResultReturned(reqId, mc);
                } while (false);
            }
Пример #4
0
            public virtual bool SendRequest(ushort reqId, byte[] data, uint len, DAsyncResultHandler ash, DDiscarded discarded, DOnExceptionFromServer exception)
            {
                bool sent;
                byte batching;
                MyKeyValue <ushort, CResultCb> kv;

                if (reqId <= (ushort)tagBaseRequestID.idReservedTwo)
                {
                    throw new ArgumentException("Request id must be larger than 0x2001");
                }
                if (null == m_ClientSocket)
                {
                    return(false);
                }
                IntPtr h = m_ClientSocket.Handle;

                if (data != null && len > (uint)data.Length)
                {
                    len = (uint)data.Length;
                }
                if (ash != null || discarded != null || exception != null)
                {
                    CResultCb rcb = new CResultCb(ash, discarded, exception);
                    kv       = new MyKeyValue <ushort, CResultCb>(reqId, rcb);
                    batching = ClientCoreLoader.IsBatching(h);
                    lock (m_csSend)
                    {
                        lock (m_cs)
                        {
                            if (batching != 0)
                            {
                                m_kvBatching.AddToBack(kv);
                            }
                            else
                            {
                                m_kvCallback.AddToBack(kv);
                            }
                        }
                        unsafe
                        {
                            fixed(byte *buffer = data)
                            {
                                sent = (ClientCoreLoader.SendRequest(h, reqId, buffer, len) != 0);
                            }
                        }
                    }
                }
                else
                {
                    kv       = null;
                    batching = 0;
                    unsafe
                    {
                        fixed(byte *buffer = data)
                        {
                            sent = (ClientCoreLoader.SendRequest(h, reqId, buffer, len) != 0);
                        }
                    }
                }
                if (sent)
                {
                    return(true);
                }
                if (kv != null)
                {
                    lock (m_cs)
                    {
                        if (batching > 0)
                        {
                            m_kvBatching.Clear();
                        }
                        else
                        {
                            m_kvCallback.Clear();
                        }
                    }
                }
                return(false);
            }