[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.0

switch -  when inside switch..

Asked by lblinc in C# Programming Language

Tags: another, class, passed

When inside the switch statement below, both messages are triggered successfully, but the dispatch function only sends (passes on) the first case which is triggered, and the message is sent this one time, but when the next case is triggered...   nothing.       When the second case MSG_PART_INITIALIZE is triggered shortly after the first message,  the dispatch function doesn't do anything...  iow ~  the dispatch only works the first time out when case MSG_PART_UPDATE is triggered.

Using the below code sample, let's say you have an event handler that sends object messages to the function PartUpdate as shown below.   The message is then type-cast to a Message class object to then set some variables from there.

QUESTION:    when the switch receives the partSig variable, both  case MSG_PART_UPDATE  as well as MSG_PART_INITIALIZE  should fall thru and either case should call otherClass.dispatch(partSig).   Again, when the first case MSG_PART_UPDATE is triggered, dispatch is called successfully, but then when another message is sent which triggers shortly thereafter which triggers MSG_PART_INITIALIZE...   dispatch does not send the messsage on to otherClass.dispatch(partSig);

Can anyone help me resolve this?    Why does the dispatch only pass the message on to otherClass only once?  but not for the next message that is triggered?  

- - - - - - - - - - - - - - - - -

public OtherClass otherClass
// upon logon to the app a new OtherClass object is instantiated elsewhere...
otherClass = new OtherClass();

// const int types declared in another class..
public const int MSG_PART_UPDATE = 4001;
public const int MSG_PART_INITIALIZE= 4002;

public void PartUpdate(object theMsg)
{
        Message msg = (Message) theMsg;
        string part= msg.Part;
        int partSig = msg.MsgId;

        switch (partSig)
        {
                 case MSG_PART_UPDATE:
                 case MSG_PART_INITIALIZE:
                 {
                         OtherClass otherClass = AnotherClass.Instance.otherClass;
                         if (otherClass != null)
                                     otherClass.dispatch(theMsg);
                         break;
                 }
                 default:
                       Console.Out.WriteLine("got msg, signature = " + partSig);
           }

}
 
Related Solutions
Keywords: switch - when inside switch..
 
Loading Advertisement...
 
[+][-]03/16/06 04:17 AM, ID: 16204061Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: C# Programming Language
Tags: another, class, passed
Sign Up Now!
Solution Provided By: yasser_helmy
Participating Experts: 2
Solution Grade: A
 
[+][-]03/15/06 04:06 PM, ID: 16200463Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/15/06 09:56 PM, ID: 16202435Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/16/06 06:32 AM, ID: 16205211Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/16/06 06:51 AM, ID: 16205436Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/16/06 07:45 AM, ID: 16206078Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03/18/06 08:11 AM, ID: 16224975Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03/18/06 10:15 AM, ID: 16225649Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091118-EE-VQP-93