Automatically apply theme when combo box selection changed

This commit is contained in:
Jaex 2019-09-07 16:23:18 +03:00
parent f82cabfab1
commit a9fa73e2a6

View file

@ -446,6 +446,12 @@ private void UpdateThemeControls()
cbThemes.Enabled = btnThemeRemove.Enabled = btnApplyTheme.Enabled = cbThemes.Items.Count > 0;
}
private void ApplySelectedTheme()
{
Program.MainForm.UpdateTheme();
ShareXResources.ApplyTheme(this);
}
private void CbThemes_SelectedIndexChanged(object sender, EventArgs e)
{
Program.Settings.SelectedTheme = cbThemes.SelectedIndex;
@ -460,6 +466,7 @@ private void CbThemes_SelectedIndexChanged(object sender, EventArgs e)
}
UpdateThemeControls();
ApplySelectedTheme();
}
private void BtnThemeAdd_Click(object sender, EventArgs e)
@ -505,8 +512,7 @@ private void BtnApplyTheme_Click(object sender, EventArgs e)
Program.Settings.Themes[index] = (ShareXTheme)pgTheme.SelectedObject;
cbThemes.Items[index] = Program.Settings.Themes[index];
UpdateThemeControls();
ShareXResources.ApplyTheme(this);
Program.MainForm.UpdateTheme();
ApplySelectedTheme();
}
}