mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 11:16:51 +02:00
Add initial disable program code
This commit is contained in:
@@ -28,5 +28,28 @@ namespace Wox.Plugin.Program.Views.Commands
|
||||
.ToList()
|
||||
.ForEach(t1 => ProgramSetting.ProgramSettingDisplayList.Add(new ProgramSource { Name = t1.DisplayName, Location = t1.Package.Location, Enabled = t1.Enabled }));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
Plugins/Wox.Plugin.Program/Views/Models/ProgramSource.cs
Normal file
18
Plugins/Wox.Plugin.Program/Views/Models/ProgramSource.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Wox.Plugin.Program.Views.Models
|
||||
{
|
||||
public class ProgramSource
|
||||
{
|
||||
private string name;
|
||||
|
||||
public string Location { get; set; }
|
||||
public string Name { get => name ?? new DirectoryInfo(Location).Name; set => name = value; }
|
||||
public bool Enabled { get; set; } = true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user