Exit Application Project form lunched with another project form

  • Thread starter Thread starter CoolerHigh
  • Start date Start date
C

CoolerHigh

Guest
1393518.jpg

Project Musique activate prokect explore form

if (speech.Contains("explore"))
{
recognizer.SpeechRecognized -= Default_SpeechRecognized;
grpblistSelect.Visible = true;
speech = "";
explorer.explore wExplore = new explorer.explore();
wExplore.ShowDialog();

axWinMediaPlayer.Ctlcontrols.stop();

this.Cursor = Cursors.WaitCursor;

while (String.IsNullOrEmpty(ClassLib.share.semaphore))
{
}
this.Cursor = Cursors.Arrow;
string filepath = ClassLib.share.semaphore;
//log(rTxtBmusic, "tmpFile: " + filepath, ClassLib.share.infosColor);
readArray = File.ReadAllLines(filepath);
for(int i=0; i < readArray.Length -1; i++)
{
//log(rTxtBmusic, readArray, ClassLib.share.infosColor);
string item = readArray.Substring(readArray.LastIndexOf("\\")+1);
lstFilesSelected.Items.Add(item);
ClassLib.share.FilesSelected.Add(readArray);
}
if (lstFilesSelected.Items.Count > 0)
{
lstFilesSelected.SelectedIndex = 0;
}
else
{
sylvie.Speak("Le fichier transferé est vide");
log(rTxtBmusic, "Le fichier "+ filepath + " est vide", ClassLib.share.errorColor);
}
if (File.Exists(filepath))
{
File.Delete(filepath);
}
ClassLib.share.semaphore = null;
this.WindowState = FormWindowState.Maximized;
recognizer.SetInputToDefaultAudioDevice();
recognizer.RecognizeAsync(RecognizeMode.Multiple);
}

Project explore sending informtaion and exit this application:

if (speech.Contains("Fin transfert"))
{
recognizer.RecognizeAsyncCancel();
recognizer.RecognizeAsyncStop();
recognizer.SpeechRecognized -= recognizer_SpeechRecognized;
sylvie.Speak("Vous avez transferer " + lstFilesSelected.Items.Count.ToString() + " Fichiers");
log(rTxtBFiles, "Vous avez transferer " + lstFilesSelected.Items.Count.ToString() + " Fichiers", ClassLib.share.infosColor);
String tmpFileName = Path.GetTempFileName();
pipeList = "";
foreach (string item in lstFilesSelected.Items)
{
string ext = Path.GetExtension(item);
ext = "*" + ext;
foreach(string ex in ClassLib.share.lstExtMusics)
{
if (ext.ToLower() == ex.ToLower())
{
pipeList += item + "\n";
}
}
foreach (string ex in ClassLib.share.lstExtMovies)
{
if (ext.ToLower() == ex.ToLower())
{
pipeList += item + "\n";
}
}
}
try
{
using (StreamWriter sw = new StreamWriter(tmpFileName))
{
sw.WriteLine(pipeList);
}
ClassLib.share.semaphore = tmpFileName;
}
catch (Exception ex)
{
MessageBox.Show("Explore Transfert: " + "\n" + ex.Message);
}
Application.DoEvents();
bool B = Application.AllowQuit;
if (B)
{
this.Dispose();
Application.Exit();
}
//this.Close();
}


I tought that a thread is independent when its loading.

I Worked about one month on this problem (serching web, reading information about thread ..)

Some help will be very kind.


Vb deloppers

Continue reading...
 
Back
Top