Click here to Skip to main content
15,922,419 members
Home / Discussions / C#
   

C#

 
AnswerRe: Distinguish between Keyboard and basic Barcode Scanner Pin
Brad Wick16-Oct-08 6:21
Brad Wick16-Oct-08 6:21 
GeneralRe: Distinguish between Keyboard and basic Barcode Scanner Pin
J-Cod3r16-Oct-08 20:24
J-Cod3r16-Oct-08 20:24 
GeneralRe: Distinguish between Keyboard and basic Barcode Scanner Pin
Brad Wick17-Oct-08 4:12
Brad Wick17-Oct-08 4:12 
AnswerRe: Distinguish between Keyboard and basic Barcode Scanner Pin
Dirso16-Oct-08 6:58
Dirso16-Oct-08 6:58 
AnswerRe: Distinguish between Keyboard and basic Barcode Scanner Pin
Dave Kreskowiak16-Oct-08 7:09
mveDave Kreskowiak16-Oct-08 7:09 
GeneralRe: Distinguish between Keyboard and basic Barcode Scanner Pin
Brad Wick17-Oct-08 12:49
Brad Wick17-Oct-08 12:49 
GeneralRe: Distinguish between Keyboard and basic Barcode Scanner Pin
Dave Kreskowiak17-Oct-08 16:35
mveDave Kreskowiak17-Oct-08 16:35 
QuestionSpeed Up Try Catch Pin
fly90416-Oct-08 4:36
fly90416-Oct-08 4:36 
AnswerRe: Speed Up Try Catch Pin
SeMartens16-Oct-08 4:49
SeMartens16-Oct-08 4:49 
AnswerRe: Speed Up Try Catch Pin
Paul Conrad16-Oct-08 9:24
professionalPaul Conrad16-Oct-08 9:24 
QuestionMSI Setup - custom action rollback Pin
Mogyi16-Oct-08 3:24
Mogyi16-Oct-08 3:24 
AnswerRe: MSI Setup - custom action rollback Pin
HemJoshi16-Oct-08 3:47
HemJoshi16-Oct-08 3:47 
GeneralRe: MSI Setup - custom action rollback Pin
Mogyi16-Oct-08 4:10
Mogyi16-Oct-08 4:10 
QuestionWhat is best way? Pin
Majid_grok16-Oct-08 2:45
Majid_grok16-Oct-08 2:45 
RantRe: What is best way? Pin
Nagy Vilmos16-Oct-08 3:06
professionalNagy Vilmos16-Oct-08 3:06 
Questiongot problem with sequence of event execution Pin
Krazy Programmer16-Oct-08 2:37
Krazy Programmer16-Oct-08 2:37 
AnswerRe: got problem with sequence of event execution Pin
Guffa16-Oct-08 3:17
Guffa16-Oct-08 3:17 
GeneralRe: got problem with sequence of event execution Pin
Krazy Programmer16-Oct-08 19:44
Krazy Programmer16-Oct-08 19:44 
GeneralRe: got problem with sequence of event execution Pin
Guffa17-Oct-08 13:38
Guffa17-Oct-08 13:38 
GeneralRe: got problem with sequence of event execution Pin
nelsonpaixao16-Oct-08 12:36
nelsonpaixao16-Oct-08 12:36 
GeneralRe: got problem with sequence of event execution Pin
Krazy Programmer16-Oct-08 19:44
Krazy Programmer16-Oct-08 19:44 
QuestionThreads and WinForms Pin
Programm3r16-Oct-08 1:45
Programm3r16-Oct-08 1:45 
Hi all,

A while ago I posted a question on this topic, and received a great response. I made use of the article posted by Sacha Barber called Beginners Guide To Threading In .NET Part 5 of n. In this article he uses the SynchonizationContext to marshall the background work to the UI thread.

But the thing is that when I send response back to a listview on the GUI thread x amount of time in quick succession the whole application just freezes / hangs.

Is this a bad idea doing it like this or am I just doing something wrong (maybe a different approach)

private SynchronizationContext context;
.....
.....
//set up the SynchronizationContext
context = SynchronizationContext.Current;
if (context == null)
{
    context = new SynchronizationContext();
}
.....            
.....            
try
{
    for (int i = 0; i < (int)e.Argument; i++)
    {
        context.Send(new SendOrPostCallback(delegate(object state)
        {
            lViewTransactionHistory.Items.Add(lViewTransactionHistory.Items.Count.ToString(), DateTime.Now.ToLongTimeString(), 0);

        }), null);
    }
}
catch (InvalidOperationException oex)
{
    MessageBox.Show(oex.Message);
}



The only programmers that are better those C# programmers are those who code in 1's and 0's Green Alien | [Alien]



Smile | :) Programm3r

My Blog: ^_^

AnswerRe: Threads and WinForms Pin
Alan N16-Oct-08 1:59
Alan N16-Oct-08 1:59 
GeneralRe: Threads and WinForms Pin
Programm3r16-Oct-08 2:03
Programm3r16-Oct-08 2:03 
QuestionRe: Threads and WinForms Pin
Programm3r16-Oct-08 2:13
Programm3r16-Oct-08 2:13 

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.