static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //TODO:передавать через DI var player = new NAudioSoundPlayer(null); var spc = new SoundQueueConsumer(new SoundQueue.Concrete.SoundQueue(player)); Application.Run(new MainForm(spc)); //КОНТРОЛЬ ВЫПОЛНЕНИЯ ФОНОВЫХ ЗАДАЧ---------------------------------------------------------------------- //foreach (var backGroundTask in BackGroundTasks) //{ // // backGroundTask.Dispose(); //} // var taskFirst = Task.WhenAny(BackGroundTasks).GetAwaiter().GetResult(); // if (taskFirst.Exception != null) //критическая ошибка фоновой задачи //ErrorString = taskFirst.Exception.ToString(); }
public MainForm(SoundQueueConsumer soundQueueConsumer) { _soundQueueConsumer = soundQueueConsumer; DispouseTemplateChangeRx = _soundQueueConsumer.SoundMessageChangeRx.Subscribe(SoundMessageChangeRxEventHandler); DispouseQueueChangeRx = _soundQueueConsumer.QueueChangeRx.Subscribe(QueueChangeRxEventHandler); _soundQueueConsumer.StartQueue(); InitializeComponent(); }