Managing data within events A and B, when event C fires
- From: kirk <kirksl@xxxxxxxxx>
- Date: Tue, 8 Jul 2008 21:00:01 -0700 (PDT)
I have three events, using event handler methods as depicted below.
Two of those event handler methods need to reset specific data
whenever the other event left fires. I wasn't sure how to properly
implement that, is there a better way than using state management
variables for each timer as i'm doing in the outline below?
private string szProperty1 = null;
// updated by class consumer
public string Property1
{
get { return this.szProperty1; }
set { this.szProperty1 = value; }
}
// state management
private string szProperty1Last1 = null;
private string szProperty1Last2 = null;
private string szProperty1Last3 = null;
private string szProperty2 = null;
private string szProperty3 = null;
[interval: 100ms]
private void EventHandlerMethod1
{
// exit if szProperty1 == null or no event subscriptions
// if szPropertyLast1 != szProperty1, set szPropertyLast1 =
szProperty1, fire event
}
[interval: 100ms]
private void EventHandlerMethod2
{
// exit if szProperty1 == null or no event subscriptions
// if szPropertyLast2 != szProperty1, set szPropertyLast2 =
szProperty1, reset szProperty2, fire event
}
[interval: 500ms]
private void EventHandlerMethod3
{
// exit if szProperty1 == null or no event subscriptions
// if szPropertyLast3 != szProperty1, set szPropertyLast3 =
szProperty1, reset szProperty3, fire event
}
.
- Follow-Ups:
- Re: Managing data within events A and B, when event C fires
- From: Pavel Minaev
- Re: Managing data within events A and B, when event C fires
- From: Peter Duniho
- Re: Managing data within events A and B, when event C fires
- Prev by Date: Re: WPF: List of fonts in combo
- Next by Date: Write > or < in method summary
- Previous by thread: WCF and Errors
- Next by thread: Re: Managing data within events A and B, when event C fires
- Index(es):