The name 'srvr' does not exist in the current context

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Sep 2007
Posts: 56
Reputation: curt22 is an unknown quantity at this point 
Solved Threads: 0
curt22 curt22 is offline Offline
Junior Poster in Training

Re: The name 'srvr' does not exist in the current context

 
0
  #11
Aug 27th, 2008
Thanks I think I'm going to try using nested classes see if i can get that working. (Oh and its only 8pm here).
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,162
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 138
dickersonka dickersonka is offline Offline
Veteran Poster

Re: The name 'srvr' does not exist in the current context

 
0
  #12
Aug 27th, 2008
If you're not into the singleton thing, you need to think of the separation between the display and server.

Look at using events,
example when server is started, you catch the event in the notify icon and update the display properly, without having the server ever know about what is displaying in the ui portion.
Custom Application & Software Development
www.houseshark.net
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 56
Reputation: curt22 is an unknown quantity at this point 
Solved Threads: 0
curt22 curt22 is offline Offline
Junior Poster in Training

Re: The name 'srvr' does not exist in the current context

 
0
  #13
Aug 27th, 2008
  1. If you're not into the singleton thing, you need to think of the separation between the display and server.
  2.  
I dont' mind using a singleton. It just didn't work.
And I'm not sure how to do it using events.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 56
Reputation: curt22 is an unknown quantity at this point 
Solved Threads: 0
curt22 curt22 is offline Offline
Junior Poster in Training

Re: The name 'srvr' does not exist in the current context

 
0
  #14
Aug 27th, 2008
Look at using events,
example when server is started, you catch the event in the notify icon and update the display properly, without having the server ever know about what is displaying in the ui portion.
Could you give me an example of how to do that I think it sounds like the best solution.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,162
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 138
dickersonka dickersonka is offline Offline
Veteran Poster

Re: The name 'srvr' does not exist in the current context

 
0
  #15
Aug 27th, 2008
Here is one on Microsoft, a little technicalhttp://msdn.microsoft.com/en-us/library/aa645739(VS.71).aspx


Here is a little less technical and probably easier to follow
http://www.csharphelp.com/archives/archive253.html

Once you read them,
create the event in the server class, such OnServerStarted

in the notify class, create a server private variable and subscribe to each event

then on each event that is received, you can update your text as the event is received
Custom Application & Software Development
www.houseshark.net
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 33
Reputation: miculnegru is an unknown quantity at this point 
Solved Threads: 5
miculnegru miculnegru is offline Offline
Light Poster

Re: The name 'srvr' does not exist in the current context

 
0
  #16
Aug 28th, 2008
Originally Posted by dickersonka View Post
If you pass server to it, any other class that uses this notify icon will require to instantiate it with server, when possibly they might not have anything to do with server.
Ok, so why not create overload methods, one for srvr.Start() and one for srvr.Stop() ?


I'm sorry but i still can't see , looking at the code so far, why it will not work . so let's say you have this in main()

Server srvr= new Server();
Notify_Icon ico=new Notify_Icon();
srvr.Start(ico);
// do something..
srvr.Stop(ico);

and in other functions you will have :

srvr.Start();
// do something..
srvr.Stop();

now... if this will not work .... then i'm missing the whole point so sorry .
Last edited by miculnegru; Aug 28th, 2008 at 3:07 am.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 56
Reputation: curt22 is an unknown quantity at this point 
Solved Threads: 0
curt22 curt22 is offline Offline
Junior Poster in Training

Re: The name 'srvr' does not exist in the current context

 
0
  #17
Aug 28th, 2008
Originally Posted by miculnegru View Post
Ok, so why not create overload methods, one for srvr.Start() and one for srvr.Stop() ?


I'm sorry but i still can't see , looking at the code so far, why it will not work . so let's say you have this in main()

Server srvr= new Server();
Notify_Icon ico=new Notify_Icon();
srvr.Start(ico);
// do something..
srvr.Stop(ico);

and in other functions you will have :

srvr.Start();
// do something..
srvr.Stop();

now... if this will not work .... then i'm missing the whole point so sorry .
The problem was that I couldn't get the server and icon to both be able to access each others methods, but now that you show me what you ment I think it probably would have worked that way. But I've already rewritten it oh well at least it works . Thanks anyway.
Reply With Quote Quick reply to this message  
Join Date: Nov 2005
Posts: 33
Reputation: miculnegru is an unknown quantity at this point 
Solved Threads: 5
miculnegru miculnegru is offline Offline
Light Poster

Re: The name 'srvr' does not exist in the current context

 
0
  #18
Aug 29th, 2008
uh.. a sorry then for the late post.. work keeped me busy.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the C# Forum
Thread Tools Search this Thread



Tag cloud for C#
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC