R
raghudr
Hi all,
I am implemeting a splash screen in C#
I got a useful link from here :-
http://www.codersource.net/csharp_splash_screen.aspx
//Logic when to display a splash screen is:-
Splash screen should start
//Long process which may take 1-2 min depending on size of XML file
which i am parsing
Splash screen should end
//end of logic
So to start the splash screen:-
i coded :-
Thread th
Startsplash()
{
th = new Thread(new ThreadStart(DoSplash));
th.Priority = ThreadPriority.Lowest;
th.Start();
}
private void DoSplash()
{
sp = new Splash();
sp.ShowDialog();
}
//splash screen starts displaying
//To end the splash screen i have coded:-
public void StopSplash()
{
try
{
if (true == th.IsAlive)
{
if (sp != null)
sp.Close();
th.Abort();
th.Join();
}
}
catch (ThreadAbortException abortException)
{
Thread.ResetAbort();
//
Console.WriteLine((string)abortException.ExceptionState);
}
Thread.Sleep(1000);
}
Problem is when i restart the windows .net Compact framework shows a
message telling "thread is being aborted".Since my application is
started by a service.
Please can anyone tell me where i am going wrong.How to terminate a
thread properly in the above case without calling thread.abort.
In lot of discussions they were discussions thread.abort is evil.Can
anyone please explain how to terminate a thread without using
thread.abort()
please help me out in this
Thanks in advance,
RAGHU
I am implemeting a splash screen in C#
I got a useful link from here :-
http://www.codersource.net/csharp_splash_screen.aspx
//Logic when to display a splash screen is:-
Splash screen should start
//Long process which may take 1-2 min depending on size of XML file
which i am parsing
Splash screen should end
//end of logic
So to start the splash screen:-
i coded :-
Thread th
Startsplash()
{
th = new Thread(new ThreadStart(DoSplash));
th.Priority = ThreadPriority.Lowest;
th.Start();
}
private void DoSplash()
{
sp = new Splash();
sp.ShowDialog();
}
//splash screen starts displaying
//To end the splash screen i have coded:-
public void StopSplash()
{
try
{
if (true == th.IsAlive)
{
if (sp != null)
sp.Close();
th.Abort();
th.Join();
}
}
catch (ThreadAbortException abortException)
{
Thread.ResetAbort();
//
Console.WriteLine((string)abortException.ExceptionState);
}
Thread.Sleep(1000);
}
Problem is when i restart the windows .net Compact framework shows a
message telling "thread is being aborted".Since my application is
started by a service.
Please can anyone tell me where i am going wrong.How to terminate a
thread properly in the above case without calling thread.abort.
In lot of discussions they were discussions thread.abort is evil.Can
anyone please explain how to terminate a thread without using
thread.abort()
please help me out in this
Thanks in advance,
RAGHU