Mk0.Software.ImageSorter/Mk0.Software.ImageSorter/Settings.cs

115 lines
4.6 KiB
C#

using System;
using System.Drawing;
using System.Windows.Forms;
namespace Mk0.Software.ImageSorter
{
public partial class Settings : Form
{
public Settings()
{
InitializeComponent();
}
private void Settings_Shown(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(Properties.Settings.Default.targetPath))
{
labelTargetPath.Text = Properties.Settings.Default.targetPath;
}
else
{
labelTargetPath.Text = Application.StartupPath;
Properties.Settings.Default.targetPath = Application.StartupPath;
Properties.Settings.Default.Save();
}
checkBoxSingleInstance.Checked = Properties.Settings.Default.singleInstance;
checkBoxFileAssociation.Checked = Properties.Settings.Default.fileAssociation;
checkBoxFading.Checked = Properties.Settings.Default.fading;
trackBarFadingSpeed.Value = Properties.Settings.Default.fadingSpeed;
panelDarkBackgroundColour.BackColor = Properties.Settings.Default.darkBackgroundColour;
panelLightBackgroundColour.BackColor = Properties.Settings.Default.lightBackgroundColour;
}
private void ButtonChangeTargetPath_Click(object sender, EventArgs e)
{
DialogResult result = folderBrowserDialog.ShowDialog();
if (result == DialogResult.OK)
{
Properties.Settings.Default.targetPath = folderBrowserDialog.SelectedPath;
Properties.Settings.Default.Save();
}
labelTargetPath.Text = Properties.Settings.Default.targetPath;
}
private void CheckBoxSingleInstance_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.singleInstance = checkBoxSingleInstance.Checked;
Properties.Settings.Default.Save();
}
private void CheckBoxFileAssociation_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.fileAssociation = checkBoxFileAssociation.Checked;
Properties.Settings.Default.Save();
}
private void CheckBoxFading_CheckedChanged(object sender, EventArgs e)
{
Properties.Settings.Default.fading = checkBoxFading.Checked;
trackBarFadingSpeed.Enabled = checkBoxFading.Checked;
label6.Enabled = checkBoxFading.Checked;
label7.Enabled = checkBoxFading.Checked;
label8.Enabled = checkBoxFading.Checked;
Properties.Settings.Default.Save();
}
private void TrackBarFadingSpeed_Scroll(object sender, EventArgs e)
{
Properties.Settings.Default.fadingSpeed = trackBarFadingSpeed.Value;
Properties.Settings.Default.Save();
}
private void ButtonResetBackgroundColours_Click(object sender, EventArgs e)
{
Properties.Settings.Default.lightBackgroundColour = SystemColors.Control;
Properties.Settings.Default.darkBackgroundColour = Color.Black;
Properties.Settings.Default.Save();
panelLightBackgroundColour.BackColor = Properties.Settings.Default.lightBackgroundColour;
panelDarkBackgroundColour.BackColor = Properties.Settings.Default.darkBackgroundColour;
}
private void ButtonChangeLightBackgroundColour_Click(object sender, EventArgs e)
{
ColorDialog colorDlg = new ColorDialog
{
Color = Properties.Settings.Default.lightBackgroundColour,
AnyColor = true,
SolidColorOnly = false
};
if (colorDlg.ShowDialog() == DialogResult.OK)
{
Properties.Settings.Default.lightBackgroundColour = colorDlg.Color;
panelLightBackgroundColour.BackColor = Properties.Settings.Default.lightBackgroundColour;
Properties.Settings.Default.Save();
}
}
private void ButtonChangeDarkBackgroundColour_Click(object sender, EventArgs e)
{
ColorDialog colorDlg = new ColorDialog
{
Color = Properties.Settings.Default.darkBackgroundColour,
AnyColor = true,
SolidColorOnly = false
};
if (colorDlg.ShowDialog() == DialogResult.OK)
{
Properties.Settings.Default.darkBackgroundColour = colorDlg.Color;
panelDarkBackgroundColour.BackColor = Properties.Settings.Default.darkBackgroundColour;
Properties.Settings.Default.Save();
}
}
}
}