Solved

Interface For Network Chat And New Delivery System

Posted on 2006-06-13
12
235 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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
 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to read json value 2 48
C# Single Form 8 42
How to catch the result of a javascript confirm dialog box, for a C# onclick event 4 59
InputLanguage 1 25
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

813 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

10 Experts available now in Live!

Get 1:1 Help Now