• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 242
  • Last Modified:

Interface For Network Chat And New Delivery System

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
clintons
Asked:
clintons
  • 7
  • 5
1 Solution
 
existenz2Commented:
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
 
clintonsAuthor Commented:
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
 
clintonsAuthor Commented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
existenz2Commented:
You indeed should do that with a marker which is contained both in the list as in the ChatBox form.
0
 
clintonsAuthor Commented:
how can i do that?

how do i make a referance to a form? that i can create when its opened?
0
 
clintonsAuthor Commented:
*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
 
existenz2Commented:
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
 
clintonsAuthor Commented:
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
 
existenz2Commented:
Just keep an array with all instances from the active chatboxes? That's all.
0
 
clintonsAuthor Commented:
2 words

CODE EXAMPLE

0
 
existenz2Commented:
ChatBox[] chatBoxes = new ChatBox[1];

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


That's all...
0
 
clintonsAuthor Commented:
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now