A bit complex question (C# related)

Discussion in 'OT Technology' started by D1G1T4L, Jul 12, 2005.

  1. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    so i have a function in UserControl class

    Code:
    		public UserControl(Toc.TocClient tc, string chatRoom)
    		{
    			// This call is required by the Windows.Forms Form Designer.
    			InitializeComponent();
    
    			this.tc2 = tc;
    			this.chatRoom = chatRoom;
    			tc2.MessageChat += new Toc.ChatMessageEventHandler(OnMessage);
    			JoinAChat(chatRoom);
                            this.chatID = tc2.ChatID;
    
    		}
    
    		private void JoinAChat(string chatRoom)
    		{
    			tc2.JoinChat(chatRoom);
    		}
    
    basically i join a chat on aim server using tc2 object
    this is the code for tc2 object function
    Code:
    		public void JoinChat(string chatRoom)
    		{
    			int exchange = 4;
    			chatRoom = chatRoom.Trim().ToLower();
    			SendFlap(FrameType.Data, "toc_chat_join " + exchange + " " + chatRoom);
    
    		}
    
    after the chat is joined, the server sends a packet with the chats id etc, i wont post the way the packet is received/listened to but here is the function in tc2 object that handles what happens when chatid is received
    Code:
    private void HandleChatJoin(String flap) 
    		{
    
    			
    				StringTokenizer stk = new StringTokenizer(flap,':');
    
    				chatRoomID = stk.ReadToken();
    				ChatID = chatRoomID;
    				string chatRoomName = stk.ReadToEnd();
    				SendFlap(FrameType.Data, "toc_chat_send " + chatRoomID + " " + "\"hello3" + "chatid" + ChatID + "\"");
    				
    		
    		
    		}
    
    My problem is that in UserControl class
    this.chatID = tc2.ChatID;
    is blank, probably because it gets assigned before the server sends me the chat id, so i get a blank, is there a way i can make the program wait tilll ChatID gets a value?
     
  2. Frequency

    Frequency New Member

    Joined:
    Dec 30, 2004
    Messages:
    7,504
    Likes Received:
    0
    Location:
    PA
  3. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    thanks for that insightful input
     
  4. Frequency

    Frequency New Member

    Joined:
    Dec 30, 2004
    Messages:
    7,504
    Likes Received:
    0
    Location:
    PA
    no prob next question?
     
  5. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area
    forget the question, just
    /endurself
     
  6. choler

    choler New Member

    Joined:
    May 21, 2002
    Messages:
    183
    Likes Received:
    0
    you can just make the thread sleep for a bit longer... i think its something like thread.sleep(<time here>)
     
  7. D1G1T4L

    D1G1T4L Active Member

    Joined:
    May 4, 2001
    Messages:
    16,489
    Likes Received:
    0
    Location:
    Bay Area

    yea i was thinking that too
     

Share This Page