Solved

Interface For Network Chat And New Delivery System

Posted on 2006-06-13
12
233 Views
Last Modified: 2011-09-20
Hello Perts,

Im developing a network Chat and new delivery system for our company network.

I have made all the back end of the chat protocol and was just after a point in the right direction for the client interface design

basicaly the clients listner is running in a thread started buy the main form with hass the list of contacts in a tree view.

when a user clicks a contact from the tree view it open a form ChatBox

this form sets its self up to point at the contact and send as the signed in user.

so far so good

this is the part that i need some guidance as best way of implemeting

when a message is recived (currently not what i want)

the Main form Listner thread of the recipient pulls in the message and opens a ChatBox form sets the details for sender and reciver so that the reciver can reply correctly.

ok still good

the problem is that if you already have a window open to the user you get a fresh one rather than an update to yours.

how can i detect if the ChatBox form is already open and if it has its recipeant set to that of the sender of the incoming message?

ok so at the main form listner thread when the message comes in i know in code the sender, the reciver, the message.

also onse i detect that the form ChatBox is already open and pointing at the sender of this new message. how do i update its message textbox from the main form? ie cross form update (deligate?...)

Any advice would be gratly appreciated.

Kind Regards, Clinton Storer.
0
Comment
Question by:clintons
  • 7
  • 5
12 Comments
 
LVL 14

Expert Comment

by:existenz2
ID: 16900876
You can keep up a list of all already opened chat windows to track down if somebody is already in a chat with you. This is very easy to implement: When a new ChatBox is opened save the username of the recieving end in the list and when the ChatBox is closed, remove it from the list.

I indeed think that a delegate is a tidy way to ensure that all ChatBoxes know there is a new message available. In the ChatBox recieving routine you'll need then to figure out if the message is meant for itself.
0
 

Author Comment

by:clintons
ID: 16907925
Ok so if i create a list system to keep track in the Main Form of the opened ChatForms eather from the user directly or reciving an incomming chat that should work. but when i recive a message for a chatBox that is already open how do i update the correct ChatBox? can i embed some marker when its created a pointer in the list or somthing?

Regards Clinton Storer.
0
 

Author Comment

by:clintons
ID: 16908941
The list system is now implemented and working for all desisions as to wether to open a new window or that a chat windows with that user should already be open

so the only problem now is updating the correct ChatBox form when its already open!

any help would be greatly apreciated.

Regards Clinton Storer.
0
 
LVL 14

Expert Comment

by:existenz2
ID: 16909240
You indeed should do that with a marker which is contained both in the list as in the ChatBox form.
0
 

Author Comment

by:clintons
ID: 16931230
how can i do that?

how do i make a referance to a form? that i can create when its opened?
0
 

Author Comment

by:clintons
ID: 16932179
*In the ChatBox recieving routine you'll need then to figure out if the message is meant for itself.*

sorry i was a bit vuage the ChatBox Recieving routine is in the MainForm. MainForm recives all messages for all chat contacts. i need a way to post the message from MainForm to the correct ChatBox

Its done this way because the i push lots of other data to the mainform other than Chat Sessions (ie remote managment, invoke tuition remotly, map network drives, Deploy news and events, etc)

Regards Clinton Storer.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 14

Expert Comment

by:existenz2
ID: 16932594
In the ChatBox form create a property which identifies the specific ChatBox, this can be a string, an integer, whatever as long as it is unique. Since you know which windows are open. you can iterate through all instances to check which chatbox window you need to post the message too from the main recieving routine.
0
 

Author Comment

by:clintons
ID: 16938795
I understand this concept but i dont now how to iterate through form instances? please give me some example code.

each ChatBox Has a string sContact which holds the contact that the active chat is open with.

MainForm recivecs a message for "bill" say i have 3 instances of ChatBox open, the first with its sContact = "tim", the second with its sContact = "bill", and the third with its sContact = "gary".

please provide the code to look through the running ChatBoxs checking sContact to test wether to deliver the Message to the Forms rtbMessage (rich text box) .

kind Regards,
Clinton Storer.
0
 
LVL 14

Expert Comment

by:existenz2
ID: 16942495
Just keep an array with all instances from the active chatboxes? That's all.
0
 

Author Comment

by:clintons
ID: 16947160
2 words

CODE EXAMPLE

0
 
LVL 14

Accepted Solution

by:
existenz2 earned 250 total points
ID: 16952757
ChatBox[] chatBoxes = new ChatBox[1];

foreach(Chatbox chatbox in chatBoxes) {
 if( chatBox.Reciever == recievedMessage.From) { // do something }
}


That's all...
0
 

Author Comment

by:clintons
ID: 16957045
Thank you, i used this method and changed it to suit. I was enough of a head start in the write direction.


Regards Clinton Storer.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now