Skip to content

Commit

Permalink
Modified SaveDisplaySettings Output Location & Added Textbox for Prof…
Browse files Browse the repository at this point in the history
…ile Name (#53)

* Centered window on launch and added text box for display profile name

* Modified SaveDisplaySettings to output to a subfolder in %appdata%. Added check to ensure folder exists, otherwise create one.
  • Loading branch information
Fahim-zzz authored Oct 1, 2024
1 parent 64d4889 commit 8384ec1
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 75 deletions.
34 changes: 24 additions & 10 deletions DAIRemote/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ public Form1()
trayIconManager = new TrayIconManager(this);
this.Load += Form1_Load;
this.FormClosing += Form1_FormClosing;
this.StartPosition = FormStartPosition.CenterScreen;
}

private void Form1_Load(object sender, EventArgs e)
{
this.Hide();
this.Hide();
}

private void BtnShowAudioOutputs_Click(object sender, EventArgs e)
Expand All @@ -40,18 +41,18 @@ private void BtnShowAudioOutputs_Click(object sender, EventArgs e)
{
TopLevel = false,
FormBorderStyle = FormBorderStyle.None,
Dock = DockStyle.Fill
Dock = DockStyle.Fill
};

audioFormPanel.Controls.Add(audioForm);
audioForm.Show();
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();
}
}
Expand All @@ -60,17 +61,30 @@ private void InitializeCustomComponents()
{
this.audioFormPanel = new Panel
{
Location = new System.Drawing.Point(10, 60),
Size = new System.Drawing.Size(760, 370),
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");
string fileName = profileNameTextBox.Text;
if (fileName != "")
{
DisplayConfig.SaveDisplaySettings(fileName + ".json");
} else
{
MessageBox.Show("Invalid input, name cannot be empty");
}

profileNameTextBox.Clear();
}

private void BtnLoadDisplayConfig_Click(object sender, EventArgs e)
{
DisplayConfig.SetDisplaySettings("displayConfig" + ".json");
}
}
}
64 changes: 49 additions & 15 deletions DAIRemote/Form1.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8384ec1

Please sign in to comment.