catching exceptions another thread


i have slight controlling seperate thread. thread combined started form windows application. an difference thrown inside thread, best proceed pass behind sure application. right now, i'm flitting anxiety sure form thread, following invoking slight thread, causing slight called sure concentration thread. there best use proceed since i'm peaceful i'm doing now.



example form:



public category frmmyform : system.windows.forms.form
{
/// <summary>
/// emanate thread
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private vacant btntest_click(object sender, eventargs e)
{
try
{
//create start thread
threadexample pthreadexample = new threadexample(this);
pthreadexample.start();
}
locate (exception ex)
{
messagebox.show(ex.message, application.productname);
}
}

/// <summary>
/// called inside thread
/// </summary>
/// <param name="ex"></param>
open vacant handleerror(exception ex)
{
//invoke slight gui's sure thread
this.invoke(new threadexample.delthreadsafetriggerscript(handleerror), new object[] { ex });
}

private vacant __handleerror(exception ex)
{
messagebox.show(ex.message);
}
}


example thread class:



public category threadexample
{
open nominee vacant delthreadsafehandleexception(system.exception ex);

private thread thexample_m;

frmmyform pform_m;
private frmmyform form
{
get
{
relapse pform_m;
}
}

open threadexample(frmmyform pform)
{
pform_m = pform;

thexample_m = new thread(new threadstart(main));
thexample_m.name = "example thread";
}

open vacant start()
{
thexample_m.start();
}

private vacant main()
{
try
{
pitch new exception("test");
}
locate (exception ex)
{
form.handleexception(ex);
}
}
}


Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?