private void MainForm_Shown(Object sender, EventArgs e)
        {
            // start after the form has loaded, else the BeginInvoke methods in the event handlers
            // won't be executed in cases where a device is found before the form is loaded
            lab.Start();

            StreamingFormat format;

            try {
                // try to get default format from settings
                format = StreamingFormat.GetFormat(Settings.Default.StreamingFormat);
                StreamingFormat.DefaultFormat = format;
            }
            catch {
                // no (valid) default format in settings
                format = StreamingFormat.DefaultFormat;
            }

            foreach (RadioButton rb in new[] { rbFormatLPCM, rbFormatWAV, rbFormatPCM })
            {
                if (rb.Tag.ToString() == format.Id)
                {
                    rb.Checked = true;
                    break;
                }
            }
        }
        private void rbFormat_CheckedChanged(object sender, EventArgs e)
        {
            StreamingFormat format = StreamingFormat.GetFormat(((RadioButton)sender).Tag.ToString());

            StreamingFormat.DefaultFormat    = format;
            Settings.Default.StreamingFormat = format.Id;
            Settings.Default.Save();

            // reinitialize directory after format change to reflect the current format in the item XMl definitions
            DirectoryServer.Directory.Init(DirectoryServer.S1);
        }