Saving ResourceDictionary theme
You can substitute


if (existingResourceDictionary.Source.ToString().Contains("Light"))
{
    Settings.Default.Theme = true;
    Settings.Default.Save();
}
else
{
    Settings.Default.Theme = false;
    Settings.Default.Save();
}



by

Settings.Default.Theme = existingResourceDictionary.Source.ToString().Contains("Light");
Settings.Default.Save();


to shorten it a bit.