Click here to Skip to main content
15,894,343 members
Home / Discussions / C#
   

C#

 
GeneralRedirected StandardOutput and StandardError hanging Pin
Anonymous9-Feb-04 10:18
Anonymous9-Feb-04 10:18 
GeneralStarting a process on a remote machine with WMI Pin
Paul L C9-Feb-04 9:48
Paul L C9-Feb-04 9:48 
GeneralRe: Starting a process on a remote machine with WMI Pin
scadaguy9-Feb-04 10:49
scadaguy9-Feb-04 10:49 
GeneralLinklabel Pin
c5328699-Feb-04 7:47
c5328699-Feb-04 7:47 
GeneralRe: Linklabel Pin
Mike Ellison9-Feb-04 8:19
Mike Ellison9-Feb-04 8:19 
GeneralRe: Linklabel Pin
Charlie Williams9-Feb-04 9:08
Charlie Williams9-Feb-04 9:08 
GeneralRe: Linklabel Pin
Charlie Williams9-Feb-04 9:03
Charlie Williams9-Feb-04 9:03 
GeneralRe: Linklabel Pin
Anonymous9-Feb-04 14:41
Anonymous9-Feb-04 14:41 
QuestionHow can I detect when a client disconnects from a well known service? Pin
Marc Clifton9-Feb-04 6:13
mvaMarc Clifton9-Feb-04 6:13 
AnswerRe: How can I detect when a client disconnects from a well known service? Pin
LongRange.Shooter9-Feb-04 8:17
LongRange.Shooter9-Feb-04 8:17 
GeneralRe: How can I detect when a client disconnects from a well known service? Pin
Marc Clifton9-Feb-04 8:21
mvaMarc Clifton9-Feb-04 8:21 
GeneralRe: How can I detect when a client disconnects from a well known service? Pin
LongRange.Shooter9-Feb-04 8:26
LongRange.Shooter9-Feb-04 8:26 
AnswerRe: How can I detect when a client disconnects from a well known service? Pin
Tom Larsen9-Feb-04 10:30
Tom Larsen9-Feb-04 10:30 
GeneralRe: How can I detect when a client disconnects from a well known service? Pin
Marc Clifton9-Feb-04 10:58
mvaMarc Clifton9-Feb-04 10:58 
GeneralRe: How can I detect when a client disconnects from a well known service? Pin
Tom Larsen9-Feb-04 11:37
Tom Larsen9-Feb-04 11:37 
GeneralRe: How can I detect when a client disconnects from a well known service? Pin
Marc Clifton9-Feb-04 13:30
mvaMarc Clifton9-Feb-04 13:30 
GeneralRe: How can I detect when a client disconnects from a well known service? Pin
Tom Larsen10-Feb-04 7:04
Tom Larsen10-Feb-04 7:04 
GeneralRe: How can I detect when a client disconnects from a well known service? Pin
LongRange.Shooter10-Feb-04 9:08
LongRange.Shooter10-Feb-04 9:08 
GeneralRe: How can I detect when a client disconnects from a well known service? Pin
Tom Larsen11-Feb-04 3:53
Tom Larsen11-Feb-04 3:53 
GeneralRe: How can I detect when a client disconnects from a well known service? Pin
HAHAHA_NEXT9-Feb-04 11:01
HAHAHA_NEXT9-Feb-04 11:01 
QuestionHow to get/set printer paper media type Pin
trythat9-Feb-04 5:55
trythat9-Feb-04 5:55 
QuestionDynamic attributes for propertyGrid??? Pin
LongRange.Shooter9-Feb-04 3:11
LongRange.Shooter9-Feb-04 3:11 
AnswerRe: Dynamic attributes for propertyGrid??? Pin
Heath Stewart9-Feb-04 4:17
protectorHeath Stewart9-Feb-04 4:17 
GeneralRe: Dynamic attributes for propertyGrid??? Pin
LongRange.Shooter9-Feb-04 8:09
LongRange.Shooter9-Feb-04 8:09 
GeneralRe: Dynamic attributes for propertyGrid??? Pin
Heath Stewart9-Feb-04 9:33
protectorHeath Stewart9-Feb-04 9:33 
You don't define the attribute, you extend the PropertyDescriptor class and override the ReadOnly property. What this property does to determine if true or false should be returned is up to your implementation. If you're setting the Thread.CurrentPrincipal to the current Windows principal (rather, the current WindowsIdentity with a WindowsPrincipal), you can use <code>IPrincipal.IsInRole (actually, you could do this without setting Thread.CurrentPrincipal, but this opens you up for role-based code access security as well). You could also attribute your properties subject to this condition with an attribute that dictates which roles are required.

The point is, in your ICustomTypeDescriptor.GetProperties implementation, you return a collection of your derived PropertyDescriptos that override the ReadOnly property.

For more information about ICustomTypeDescriptor, merely type it in your help index in VS.NET (if you installed the documentation, which is installed by default).

As far as all the methods, as I mentioned earlier you can provide the default implementation by using the appropriate TypeDescriptor method. I put that in my previous post. Each method declared by ICustomTypeDescriptor has a corresponding method defined by TypeDescriptor that takes a bool as (typically) the last parameter. Set this to true so that the implementation does NOT query your Type for the ICustomTypeDescriptor implementation (which would cause an infinite loop).

 

Microsoft MVP, Visual C#
My Articles

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.