public MainWindow() { InitializeComponent(); System.Globalization.CultureInfo customCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone(); customCulture.NumberFormat.NumberDecimalSeparator = "."; System.Threading.Thread.CurrentThread.CurrentCulture = customCulture; service = Service.getInstance(this); CourseModeSelect.Items.Add(new ComboboxItem("Synchronous", "Synchronous")); CourseModeSelect.Items.Add(new ComboboxItem("Asynchronous", "Asynchronous")); CourseModeSelect.Items.Add(new ComboboxItem("Self-Paced", "Self-Paced")); PrompterModeSelect.Items.Add(new ComboboxItem("Synchronous", "Synchronous")); PrompterModeSelect.Items.Add(new ComboboxItem("Asynchronous", "Asynchronous")); PrompterModeSelect.Items.Add(new ComboboxItem("Self-Paced", "Self-Paced")); sequenceTimer = new System.Timers.Timer(); sequenceTimer.Interval = 100; sequenceTimer.Elapsed += Sequence_Timer_TickEvent; Mic1_VolumeBar.DataContext = this; Mic2_VolumeBar.DataContext = this; service.getMicrophoneList(); WM1_groupbox.DataContext = service.wm1_data_context; WM2_groupbox.DataContext = service.wm2_data_context; Mic1_VolumeBar.DataContext = service.mic_data_context; Microphone1_ComboBox.ItemsSource = service.mic_data_context.Mics; Mic2_VolumeBar.DataContext = service.mic_data_context; Microphone2_ComboBox.ItemsSource = service.mic_data_context.Mics; }
//Make two threads to test if that improves the GUI responsiveness of the led points. Theoretically it should as there would be way less calls to the OnNext method . Ideally //it would have a frequence of around 60 to 100 fps. //Made service as a Singleton public static Service getInstance(MainWindow observer) { if (instance == null) instance = new Service(observer); return instance; }