2019-09-08 20:16:47 +08:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Wox.Plugin.Program.Views.Models;
|
|
|
|
|
|
|
|
|
|
namespace Wox.Plugin.Program.Views.Commands
|
|
|
|
|
{
|
|
|
|
|
internal static class ProgramSettingDisplay
|
|
|
|
|
{
|
|
|
|
|
internal static List<ProgramSource> LoadProgramSources(this List<Settings.ProgramSource> programSources)
|
|
|
|
|
{
|
|
|
|
|
var list = new List<ProgramSource>();
|
|
|
|
|
|
|
|
|
|
programSources.ForEach(x => list.Add(new ProgramSource { Enabled = x.Enabled, Location = x.Location, Name = x.Name }));
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static void LoadAllApplications(this List<ProgramSource> listToUpdate)
|
|
|
|
|
{
|
|
|
|
|
Main._win32s
|
|
|
|
|
.ToList()
|
|
|
|
|
.ForEach(t1 => ProgramSetting.ProgramSettingDisplayList.Add(new ProgramSource { Name = t1.Name, Location = t1.ParentDirectory, Enabled = t1.Enabled }));
|
|
|
|
|
|
|
|
|
|
Main._uwps
|
|
|
|
|
.ToList()
|
|
|
|
|
.ForEach(t1 => ProgramSetting.ProgramSettingDisplayList.Add(new ProgramSource { Name = t1.DisplayName, Location = t1.Package.Location, Enabled = t1.Enabled }));
|
|
|
|
|
}
|
2019-09-08 20:18:55 +08:00
|
|
|
|
|
|
|
|
|
internal static void DisableProgramSources(this List<ProgramSource> listToUpdate, List<ProgramSource> selectedprogramSourcesToDisable)
|
|
|
|
|
{
|
|
|
|
|
ProgramSetting.ProgramSettingDisplayList
|
|
|
|
|
.Where(t1 => selectedprogramSourcesToDisable.Any(x => x.Name == t1.Name && x.Location == t1.Location && t1.Enabled))
|
|
|
|
|
.ToList()
|
|
|
|
|
.ForEach(t1 => t1.Enabled = false);
|
|
|
|
|
|
|
|
|
|
Main._win32s
|
|
|
|
|
.Where(t1 => selectedprogramSourcesToDisable.Any(x => x.Name == t1.Name && x.Location == t1.ParentDirectory && t1.Enabled))
|
|
|
|
|
.ToList()
|
|
|
|
|
.ForEach(t1 => t1.Enabled = false);
|
|
|
|
|
|
|
|
|
|
Main._uwps
|
|
|
|
|
.Where(t1 => selectedprogramSourcesToDisable.Any(x => x.Name == t1.DisplayName && x.Location == t1.Package.Location && t1.Enabled))
|
|
|
|
|
.ToList()
|
|
|
|
|
.ForEach(t1 => t1.Enabled = false);
|
|
|
|
|
|
|
|
|
|
Main._settings.ProgramSources
|
|
|
|
|
.Where(t1 => selectedprogramSourcesToDisable.Any(x => x.Name == t1.Name && x.Location == t1.Location && t1.Enabled))
|
|
|
|
|
.ToList()
|
|
|
|
|
.ForEach(t1 => t1.Enabled = false);
|
|
|
|
|
}
|
2019-09-08 20:16:47 +08:00
|
|
|
|
}
|
|
|
|
|
}
|