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; } } }
static void Main(string[] args) { // Starting UPnP Device //System.Console.WriteLine("UPnP .NET Framework Stack"); //System.Console.WriteLine("Device Builder Build#1.0.4561.18413"); LocalAudioBroadcast lab = new LocalAudioBroadcast(); lab.Start(); System.Console.WriteLine(Environment.NewLine + "Control:" + Environment.NewLine + "RETURN ... exit" + Environment.NewLine + "P ........ play to default renderer" + Environment.NewLine + "S ........ stop playback" + Environment.NewLine + "R ........ rescan renderers" + Environment.NewLine + "+ ........ increase volume" + Environment.NewLine + "- ........ decrease volume" + Environment.NewLine + "M ........ mute" + Environment.NewLine ); while (true) { ConsoleKeyInfo key = System.Console.ReadKey(true); if (key.Key == ConsoleKey.Enter) { break; } else if (key.Key == ConsoleKey.Add || key.Key == ConsoleKey.OemPlus) { lab.ControlPoint.VolumeIncrease(); Console.WriteLine("Vol+"); } else if (key.Key == ConsoleKey.Subtract || key.Key == ConsoleKey.OemMinus) { lab.ControlPoint.VolumeDecrease(); Console.WriteLine("Vol-"); } else if (key.Key == ConsoleKey.M) { lab.ControlPoint.MuteToggle(); Console.WriteLine("Mute"); } else if (key.Key == ConsoleKey.P) { lab.ControlPoint.Playback(); Console.WriteLine("Playback"); } else if (key.Key == ConsoleKey.R) { lab.ControlPoint.Rescan(); Console.WriteLine("Rescan"); } else if (key.Key == ConsoleKey.S) { lab.ControlPoint.Stop(); Console.WriteLine("Stop"); } } lab.Stop(); }
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(); }