diff --git a/DAIRemote/AudioOutputForm.cs b/DAIRemote/AudioOutputForm.cs new file mode 100644 index 0000000..a2bb869 --- /dev/null +++ b/DAIRemote/AudioOutputForm.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; +using NAudio.CoreAudioApi; + +namespace DAIRemote +{ + public partial class AudioOutputForm : System.Windows.Forms.Form + { + private ComboBox audioDeviceComboBox; + + public AudioOutputForm() + { + InitializeComponent(); + LoadAudioDevices(); + } + + private void InitializeComponent() + { + audioDeviceComboBox = new ComboBox(); + SuspendLayout(); + + audioDeviceComboBox.DropDownStyle = ComboBoxStyle.DropDownList; + audioDeviceComboBox.FormattingEnabled = true; + audioDeviceComboBox.Location = new Point(12, 100); + audioDeviceComboBox.Name = "audioDeviceComboBox"; + audioDeviceComboBox.Size = new Size(260, 33); + audioDeviceComboBox.TabIndex = 0; + audioDeviceComboBox.DropDown += audioDeviceComboBox_DropDown; + audioDeviceComboBox.SelectedIndexChanged += audioDeviceComboBox_SelectedIndexChanged; + + ClientSize = new Size(284, 100); + Controls.Add(audioDeviceComboBox); + Name = "AudioOutputForm"; + Text = "Audio Output Switcher"; + Load += AudioOutputForm_Load; + ResumeLayout(false); + } + + private void LoadAudioDevices() + { + var devices = GetAudioDevices(); + audioDeviceComboBox.DataSource = devices; + } + + public List GetAudioDevices() + { + var enumerator = new MMDeviceEnumerator(); + var devices = enumerator.EnumerateAudioEndPoints(DataFlow.Render, DeviceState.Active); + return devices.Select(d => d.FriendlyName).ToList(); + } + + private void audioDeviceComboBox_DropDown(object sender, EventArgs e) + { + LoadAudioDevices(); + } + + private void audioDeviceComboBox_SelectedIndexChanged(object sender, EventArgs e) + { + + } + + private void AudioOutputForm_Load(object sender, EventArgs e) + { + + } + } +} \ No newline at end of file diff --git a/DAIRemote/AudioOutputForm.resx b/DAIRemote/AudioOutputForm.resx new file mode 100644 index 0000000..8b2ff64 --- /dev/null +++ b/DAIRemote/AudioOutputForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DAIRemote/DAIRemote.csproj b/DAIRemote/DAIRemote.csproj index 090aeee..697c353 100644 --- a/DAIRemote/DAIRemote.csproj +++ b/DAIRemote/DAIRemote.csproj @@ -6,10 +6,16 @@ enable true enable + true + + + + + \ No newline at end of file diff --git a/DAIRemote/DAIRemote.csproj.user b/DAIRemote/DAIRemote.csproj.user index 7814ea2..fc98e0d 100644 --- a/DAIRemote/DAIRemote.csproj.user +++ b/DAIRemote/DAIRemote.csproj.user @@ -1,8 +1,11 @@  - - - Form - - - + + + Form + + + Form + + + \ No newline at end of file diff --git a/DAIRemote/Form1.cs b/DAIRemote/Form1.cs index 6a4e539..ed66844 100644 --- a/DAIRemote/Form1.cs +++ b/DAIRemote/Form1.cs @@ -4,13 +4,15 @@ namespace DAIRemote { - public partial class Form1 : Form + public partial class Form1 : System.Windows.Forms.Form { private TrayIconManager trayIconManager; + private Panel audioFormPanel; public Form1() { InitializeComponent(); + InitializeCustomComponents(); trayIconManager = new TrayIconManager(this); this.Load += Form1_Load; this.FormClosing += Form1_FormClosing; @@ -18,21 +20,48 @@ public Form1() private void Form1_Load(object sender, EventArgs e) { - this.Hide(); + this.Hide(); + } + + private void BtnShowAudioOutputs_Click(object sender, EventArgs e) + { + audioFormPanel.Controls.Clear(); + + AudioOutputForm audioForm = new AudioOutputForm + { + TopLevel = false, + FormBorderStyle = FormBorderStyle.None, + Dock = DockStyle.Fill + }; + + audioFormPanel.Controls.Add(audioForm); + audioForm.Show(); } private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { - e.Cancel = false; + e.Cancel = false; trayIconManager.HideIcon(); } } - string fileName = "displayConfig"; + + private void InitializeCustomComponents() + { + this.audioFormPanel = new Panel + { + Location = new System.Drawing.Point(10, 60), + Size = new System.Drawing.Size(760, 370), + }; + + this.Controls.Add(this.audioFormPanel); + } + private void BtnSaveDisplayConfig_Click(object sender, EventArgs e) { + string fileName = "displayConfig"; DisplayConfig.SaveDisplaySettings(fileName + ".json"); } } -} +} \ No newline at end of file diff --git a/DAIRemote/Form1.Designer.cs b/DAIRemote/Form1.designer.cs similarity index 53% rename from DAIRemote/Form1.Designer.cs rename to DAIRemote/Form1.designer.cs index 9256bb7..cd417fc 100644 --- a/DAIRemote/Form1.Designer.cs +++ b/DAIRemote/Form1.designer.cs @@ -2,14 +2,10 @@ { partial class Form1 { - /// - /// Required designer variable. - /// + private System.ComponentModel.IContainer components = null; - /// - /// Clean up any resources being used. - /// + /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { @@ -22,32 +18,37 @@ protected override void Dispose(bool disposing) #region Windows Form Designer generated code - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// + private void InitializeComponent() { BtnSaveDisplayConfig = new Button(); + BtnShowAudioOutputs = new Button(); SuspendLayout(); - // - // BtnSaveDisplayConfig - // + BtnSaveDisplayConfig.AccessibleName = "BtnSaveDisplayConfig"; - BtnSaveDisplayConfig.Location = new Point(20, 8); + BtnSaveDisplayConfig.Location = new Point(20, 10); BtnSaveDisplayConfig.Name = "BtnSaveDisplayConfig"; - BtnSaveDisplayConfig.Size = new Size(75, 23); + BtnSaveDisplayConfig.Size = new Size(200, 40); BtnSaveDisplayConfig.TabIndex = 0; - BtnSaveDisplayConfig.Text = "SaveDisplayConfig"; - BtnSaveDisplayConfig.UseVisualStyleBackColor = true; + BtnSaveDisplayConfig.Text = "Save Display Config"; + BtnSaveDisplayConfig.BackColor = Color.LightSkyBlue; BtnSaveDisplayConfig.Click += BtnSaveDisplayConfig_Click; - // - // Form1 - // - AutoScaleDimensions = new SizeF(7F, 15F); + + BtnShowAudioOutputs.AccessibleName = "BtnShowAudioOutputs"; + BtnShowAudioOutputs.Location = new Point(20, 70); + BtnShowAudioOutputs.Name = "BtnShowAudioOutputs"; + BtnShowAudioOutputs.Size = new Size(200, 40); + BtnShowAudioOutputs.TabIndex = 1; + BtnShowAudioOutputs.Text = "Show Audio Outputs"; + BtnShowAudioOutputs.BackColor = Color.LightSkyBlue; + BtnShowAudioOutputs.Click += BtnShowAudioOutputs_Click; + + AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(800, 450); + ClientSize = new Size(300, 450); + BackColor = Color.FromArgb(225, 246, 225); Controls.Add(BtnSaveDisplayConfig); + Controls.Add(BtnShowAudioOutputs); Name = "Form1"; Text = "DAIRemote"; Load += Form1_Load; @@ -57,5 +58,6 @@ private void InitializeComponent() #endregion private Button BtnSaveDisplayConfig; + private Button BtnShowAudioOutputs; } -} +} \ No newline at end of file diff --git a/DAIRemote/Form1.resx b/DAIRemote/Form1.resx index af32865..8b2ff64 100644 --- a/DAIRemote/Form1.resx +++ b/DAIRemote/Form1.resx @@ -1,7 +1,7 @@