here is the missing part

22/12/2004 - 11:16 por CK | Informe spam
Hi Poblacion,

Yes thats exactly what I want to do . I want the 3) process to run after 1)
and 2) complete. but I dont want to restart the service again (the whole
process works fine if i restart the service). Is there a way to put a timer
for process 3) or any other thoughts?

Thanks
here is the code for process 1) . process 2) is the same ;

private void Process1()

{

//Instantiate the Converter class

Newclass objP= new NewClass();

//Process the Files one by one

while(Directory.GetFiles(IncomingXMLPathPLength>0)

{

if(Directory.Exists(IncomingXMLPathP) && Directory.Exists(PathIntermediate))

{

//Get the File in the directory

DirectoryInfo dir = new DirectoryInfo(IncomingXMLPathP);

FileInfo[] xmlfiles = dir.GetFiles("*.xml");

Thread.Sleep(1000);

foreach( FileInfo file in xmlfiles)

{


string strH="";

string InternalTransactionID="";

//Opens an existing UTF-8 encoded text file for reading.

StreamReader sr = File.OpenText(file.FullName);

string data= sr.ReadToEnd();


strH= objP.ConvertNewCt(data,out InternalTransactionID);

FileInfo outputFile = new
FileInfo(PathIntermediate+InternalTransactionID+".clm");

StreamWriter strWriter =new StreamWriter(File.Open(PathIntermediate+
InternalTransactionID +".clm",FileMode.Create, FileAccess.Write ));

strWriter.Flush();

strWriter.Write(strHMI.ToString());


strWriter.Close();

sr.Close();

file.Delete();

}

}

}

}

Preguntas similare

Leer las respuestas

#1 A.Poblacion
22/12/2004 - 09:36 | Informe spam
"CK" wrote in message
news:eN0WM6$
[...]
here is the code for process 1) . process 2) is the same ;
[...]




(Replied in the original thread "Re: threading question")
Respuesta Responder a este mensaje
#2 CK
22/12/2004 - 11:52 | Informe spam
Thank you so much.

m_thread.join() was what I was looking for.



"A.Poblacion" wrote in
message news:%
"CK" wrote in message
news:eN0WM6$
[...]
here is the code for process 1) . process 2) is the same ;
[...]




(Replied in the original thread "Re: threading question")



Respuesta Responder a este mensaje
#3 CK
22/12/2004 - 13:07 | Informe spam
What other stuff can you do with a thread? as you can see I am new with
programming with threads.


Thanks


"CK" wrote in message
news:eN0WM6$
Hi Poblacion,

Yes thats exactly what I want to do . I want the 3) process to run after
1) and 2) complete. but I dont want to restart the service again (the
whole process works fine if i restart the service). Is there a way to put
a timer for process 3) or any other thoughts?

Thanks
here is the code for process 1) . process 2) is the same ;

private void Process1()

{

//Instantiate the Converter class

Newclass objP= new NewClass();

//Process the Files one by one

while(Directory.GetFiles(IncomingXMLPathPLength>0)

{

if(Directory.Exists(IncomingXMLPathP) &&
Directory.Exists(PathIntermediate))

{

//Get the File in the directory

DirectoryInfo dir = new DirectoryInfo(IncomingXMLPathP);

FileInfo[] xmlfiles = dir.GetFiles("*.xml");

Thread.Sleep(1000);

foreach( FileInfo file in xmlfiles)

{


string strH="";

string InternalTransactionID="";

//Opens an existing UTF-8 encoded text file for reading.

StreamReader sr = File.OpenText(file.FullName);

string data= sr.ReadToEnd();


strH= objP.ConvertNewCt(data,out InternalTransactionID);

FileInfo outputFile = new
FileInfo(PathIntermediate+InternalTransactionID+".clm");

StreamWriter strWriter =new StreamWriter(File.Open(PathIntermediate+
InternalTransactionID +".clm",FileMode.Create, FileAccess.Write ));

strWriter.Flush();

strWriter.Write(strHMI.ToString());


strWriter.Close();

sr.Close();

file.Delete();

}

}

}

}


Respuesta Responder a este mensaje
#4 A.Poblacion
22/12/2004 - 20:07 | Informe spam
"CK" wrote in message
news:
What other stuff can you do with a thread? as you can see I am new with
programming with threads.



Out of my mind, I can remember thread.Interrupt and thread.Abort, to stop a
thread that is already running. There are also several interesting
properties of your thread object such as Priority or IsBackground, that you
may want to adjust. And you may also want to take a look at the attribute
[ThreadStatic] that lets you assign separate copies of a variable to each
thread that uses the variable. And if you are accessing the same variables
from several threads, you should apply one of several locking techniques to
prevent corruption, the simplest of them being the lock{} statement. Then
there's also the thread Pools, but they are usually overkill unless you are
using lots of threads.
Enter "System.Threading namespace" in the index of your MSDN Library, and
you'll find a lot about threading.
email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida