Fix identation + display disabled program sources

This commit is contained in:
Jeremy Wu
2019-10-15 20:21:55 +11:00
parent bbe72f52ba
commit 06c9ff49a0

View File

@@ -14,14 +14,29 @@ namespace Wox.Plugin.Program.Views.Commands
var list = new List<ProgramSource>(); var list = new List<ProgramSource>();
programSources.ForEach(x => list programSources.ForEach(x => list
.Add( .Add(
new ProgramSource { new ProgramSource
Enabled = x.Enabled, {
Location = x.Location, Enabled = x.Enabled,
Name = x.Name, Location = x.Location,
UniqueIdentifier = x.UniqueIdentifier Name = x.Name,
} UniqueIdentifier = x.UniqueIdentifier
)); }
));
// Even though these are disabled, we still want to display them so users can enable later on
Main._settings
.DisabledProgramSources
.ForEach(x => list
.Add(
new ProgramSource
{
Enabled = x.Enabled,
Location = x.Location,
Name = x.Name,
UniqueIdentifier = x.UniqueIdentifier
}
));
return list; return list;
} }
@@ -32,27 +47,29 @@ namespace Wox.Plugin.Program.Views.Commands
.Where(t1 => !ProgramSetting.ProgramSettingDisplayList.Any(x => x.UniqueIdentifier == t1.UniqueIdentifier)) .Where(t1 => !ProgramSetting.ProgramSettingDisplayList.Any(x => x.UniqueIdentifier == t1.UniqueIdentifier))
.ToList() .ToList()
.ForEach(t1 => ProgramSetting.ProgramSettingDisplayList .ForEach(t1 => ProgramSetting.ProgramSettingDisplayList
.Add( .Add(
new ProgramSource { new ProgramSource
Name = t1.Name, {
Location = t1.ParentDirectory, Name = t1.Name,
UniqueIdentifier = t1.UniqueIdentifier, Location = t1.ParentDirectory,
Enabled = t1.Enabled UniqueIdentifier = t1.UniqueIdentifier,
} Enabled = t1.Enabled
)); }
));
Main._uwps Main._uwps
.Where(t1 => !ProgramSetting.ProgramSettingDisplayList.Any(x => x.UniqueIdentifier == t1.UniqueIdentifier)) .Where(t1 => !ProgramSetting.ProgramSettingDisplayList.Any(x => x.UniqueIdentifier == t1.UniqueIdentifier))
.ToList() .ToList()
.ForEach(t1 => ProgramSetting.ProgramSettingDisplayList .ForEach(t1 => ProgramSetting.ProgramSettingDisplayList
.Add( .Add(
new ProgramSource { new ProgramSource
Name = t1.DisplayName, {
Location = t1.Package.Location, Name = t1.DisplayName,
UniqueIdentifier = t1.UniqueIdentifier, Location = t1.Package.Location,
Enabled = t1.Enabled UniqueIdentifier = t1.UniqueIdentifier,
}) Enabled = t1.Enabled
); }
));
} }
internal static void SetProgramSourcesStatus(this List<ProgramSource> list, List<ProgramSource> selectedProgramSourcesToDisable, bool status) internal static void SetProgramSourcesStatus(this List<ProgramSource> list, List<ProgramSource> selectedProgramSourcesToDisable, bool status)