Пример #1
0
        private static void ThreadMain(object obj)
        {
            OutputGeneric <T, U, W> state = (OutputGeneric <T, U, W>)obj;

            try
            {
                using (state.destinationHandler = state.createDestinationHandler(
                           state.destination,
                           state.channels,
                           state.bits,
                           state.samplingRate,
                           state.destinationHandlerParams))
                {
                    state.generatorMainLoop(
                        state.generatorParams,
                        DataCallback,
                        state,
                        state.stopper);

                    state.destinationHandler.Finish(state.stopper.Stopped);
                }
            }
            catch (Exception exception)
            {
                // generator method should record and defer exceptions. this one got through
                string message = (exception is ApplicationException) ? exception.Message : exception.ToString();
                Program.WriteLog("OutputGeneric.ThreadMain", message);
                MessageBox.Show(message, "Synthesis Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            finally
            {
                state.waitFinishedHelper.NotifyFinished();
            }
        }