Click here to Skip to main content
15,899,679 members
Home / Discussions / C#
   

C#

 
GeneralRe: Documentation description about the method and its parameters. Pin
Blubbo12-Feb-10 3:46
Blubbo12-Feb-10 3:46 
QuestionMultiPage-Application - Navigation Pin
PingOfDeath198312-Feb-10 3:09
PingOfDeath198312-Feb-10 3:09 
AnswerRe: MultiPage-Application - Navigation Pin
dan!sh 12-Feb-10 3:11
professional dan!sh 12-Feb-10 3:11 
QuestionAT command problem Pin
saeidfarahi12-Feb-10 2:44
saeidfarahi12-Feb-10 2:44 
AnswerRe: AT command problem Pin
Richard MacCutchan12-Feb-10 3:24
mveRichard MacCutchan12-Feb-10 3:24 
GeneralRe: AT command problem Pin
saeidfarahi12-Feb-10 3:28
saeidfarahi12-Feb-10 3:28 
GeneralRe: AT command problem Pin
Richard MacCutchan12-Feb-10 3:49
mveRichard MacCutchan12-Feb-10 3:49 
QuestionThread sychronization Pin
koleraba12-Feb-10 2:35
koleraba12-Feb-10 2:35 
I created a custom timer class (MyTimer). The class is basicaly just a wrapper that internaly uses System.Threading.Timer. Class MyTimer will be used in a windows service app. Since the Timer class signals it events on the background thread, I am using Dispatcher.Invoke to marshal the requests to the current thread. Below is the event handler for the internaly used System.Threading.Timer.


private void timer_Elapsed(object state)
{
    if (Dispatcher.CurrentDispatcher != _dispatcher) 
// _dispatcher is a reference to the Dispatcher under wich the Timer was instantated
    {
        _dispatcher.Invoke(
        new System.Threading.ThreadStart(delegate
        {
            onTick();
        }), DispatcherPriority.Send); 
    }
    else
    {
        onTick();
    }
}

private void onTick()
{
    if (Tick != null)
    {
        Tick(this, new EventArgs());
    }
}


The problem is that in some casses the _dispatcher.Thread is in stopped or WaitSleepJoin state, and the onTick() method doesn't execute. Does anybody has a solution to this problem? Any ideas will be appreciated.

Uroš
modified on Friday, February 12, 2010 11:29 AM

AnswerRe: Hi Pin
Not Active12-Feb-10 4:07
mentorNot Active12-Feb-10 4:07 
GeneralRe: Hi Pin
koleraba12-Feb-10 5:31
koleraba12-Feb-10 5:31 
QuestionAppDomain Pin
Le centriste12-Feb-10 2:10
Le centriste12-Feb-10 2:10 
AnswerRe: AppDomain Pin
dan!sh 12-Feb-10 3:25
professional dan!sh 12-Feb-10 3:25 
GeneralRe: AppDomain Pin
Le centriste12-Feb-10 3:32
Le centriste12-Feb-10 3:32 
AnswerRe: AppDomain Pin
kevinnicol12-Feb-10 5:26
kevinnicol12-Feb-10 5:26 
QuestionTree view drawing problem Pin
gwithey11-Feb-10 23:32
gwithey11-Feb-10 23:32 
QuestionText Files Pin
muka6611-Feb-10 23:30
muka6611-Feb-10 23:30 
JokeRe: Text Files Pin
Richard MacCutchan11-Feb-10 23:31
mveRichard MacCutchan11-Feb-10 23:31 
GeneralRe: Text Files Pin
muka6611-Feb-10 23:33
muka6611-Feb-10 23:33 
GeneralRe: Text Files Pin
Richard MacCutchan12-Feb-10 0:11
mveRichard MacCutchan12-Feb-10 0:11 
AnswerRe: Text Files Pin
Anurag Gandhi11-Feb-10 23:49
professionalAnurag Gandhi11-Feb-10 23:49 
AnswerRe: Text Files Pin
OriginalGriff11-Feb-10 23:50
mveOriginalGriff11-Feb-10 23:50 
GeneralRe: Text Files Pin
muka6612-Feb-10 1:56
muka6612-Feb-10 1:56 
GeneralRe: Text Files Pin
ddecoy12-Feb-10 2:05
ddecoy12-Feb-10 2:05 
GeneralRe: Text Files Pin
muka6612-Feb-10 2:44
muka6612-Feb-10 2:44 
GeneralRe: Text Files Pin
harold aptroot12-Feb-10 2:07
harold aptroot12-Feb-10 2:07 

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.