//Insert wav/sound //This is called by a background worker. private void insert() { try { if (Path.GetExtension(textBoxInputFile.Text).CompareTo(".sawnd") == 0) { Console.WriteLine("Inserting Sawnd " + Path.GetFileName(textBoxInputFile.Text)); Sawndz.insertSawnd(textBoxInputFile.Text); } else if (Path.GetExtension(textBoxInputFile.Text).CompareTo(".wav") == 0) { int gid, cid, wid; if (int.TryParse(textBoxGroupID.Text, out gid)) { if (int.TryParse(textBoxCollectionID.Text, out cid)) { if (int.TryParse(textBoxWavID.Text, out wid)) { if (gid > -1 && cid > -1 && wid > -1) { Console.WriteLine("Inserting wav " + Path.GetFileName(textBoxInputFile.Text)); Sawndz.insertWav(textBoxInputFile.Text, gid, cid, wid); } } } } } } catch (Exception e) { Console.WriteLine(e.ToString()); } }
private void backgroundWorkerCreateSawnd_DoWork(object sender, DoWorkEventArgs e) { Sawndz.createSawnd(int.Parse(textBoxGroupID.Text), e.Argument as string); }