コード例 #1
0
 private void AddClient(Manager mgr)
 {
     lock(m_clients)
     {
         if(FindClient( mgr ) == null)
         {
             m_clients.Add( new Client(mgr) );
         }
     }
 }
コード例 #2
0
        private void RemoveClient(Manager mgr)
        {
            lock(m_clients)
            {
                int iClient;
                Client client = FindClient( mgr, out iClient );

                if (client != null)
                {                    
                    m_clients.RemoveAt(iClient);
                }
            }
        }
コード例 #3
0
        private Client FindClient(Manager mgr, out int iClient)
        {
            lock (m_clients)
            {
                for (iClient = 0; iClient < m_clients.Count; iClient++)
                {
                    Client client = m_clients[iClient];

                    if ((object)client.m_manager == (object)mgr) return client;
                }
            }

            return null;
        }
コード例 #4
0
        private Client FindClient( Manager mgr )
        {
            int iClient;

            return FindClient( mgr, out iClient );
        }
コード例 #5
0
        public void UnregisterForEvents( Manager mgr )
        {
            Client client = FindClient(mgr);

            if (client != null && client.m_fNotify == true)
            {
                client.m_fNotify = false;

                if (--m_clientsInterestedInEvents == 0)
                {
                    StopEvents();
                }                
            }
        }
コード例 #6
0
        public void RegisterForEvents( Manager mgr )
        {
            Client client = FindClient( mgr );

            if (client != null && client.m_fNotify == false)
            {
                client.m_fNotify = true;

                if (m_clientsInterestedInEvents++ == 0)
                {
                    StartEvents();
                    RefreshDeviceList();
                }
            }
        }
コード例 #7
0
 public void Unregister( Manager mgr )
 {
     UnregisterForEvents( mgr );
     RemoveClient       ( mgr );
 }
コード例 #8
0
 public void Register( Manager mgr )
 {            
     AddClient( mgr );         
 }
コード例 #9
0
 public Client(Manager mgr)
 {
     m_manager = mgr;
 }