public Settings() { list = new TextImagePair[1]; list[0] = new TextImagePair(); TextFile = ""; ImageFile = ""; }
/// <summary> /// Starts a corruption session /// </summary> private void Go() { if (!Running) { Trace.WriteLine("Go()"); // First time through, setup the Queue. Note that there should ALWAYS be // at least one element in _settings.list. if (_queue == null || _queue.Count == 0) { Trace.WriteLine("Creating _queue"); _queue = new Queue <TextImagePair>(); foreach (TextImagePair p in _settings.list) { Trace.WriteLine(String.Format(" Enqueue {0}, {1}", p.ImageFile, p.TextFile)); _queue.Enqueue(p); } } TextImagePair pair = _queue.Dequeue(); Trace.WriteLine(String.Format("Dequeued pair: {0}, {1}", pair.ImageFile, pair.TextFile)); try { Running = true; // Read the files CurrentTextFile = pair.TextFile; CurrentImageFile = pair.ImageFile; FileCorruptBackgroundWorker.RunWorkerAsync(); } catch (FileNotFoundException ex) { Trace.WriteLine(ex.ToString()); MessageBox.Show(ex.Message); } } else { Trace.WriteLine("Go called while already running. Doing nothing."); } }