add prevention from double clicking disable in context menu

This commit is contained in:
Jeremy Wu 2019-10-24 09:23:57 +11:00
parent e1b211ed8e
commit 6f8d252dc6

View File

@ -162,21 +162,24 @@ namespace Wox.Plugin.Program
return menuOptions;
}
private void DisableProgram(IProgram ProgramToDelete)
private void DisableProgram(IProgram programToDelete)
{
if(_uwps.Any(x => x.UniqueIdentifier == ProgramToDelete.UniqueIdentifier))
_uwps.Where(x => x.UniqueIdentifier == ProgramToDelete.UniqueIdentifier).FirstOrDefault().Enabled = false;
if (_settings.DisabledProgramSources.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier))
return;
if (_win32s.Any(x => x.UniqueIdentifier == ProgramToDelete.UniqueIdentifier))
_win32s.Where(x => x.UniqueIdentifier == ProgramToDelete.UniqueIdentifier).FirstOrDefault().Enabled = false;
if (_uwps.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier))
_uwps.Where(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier).FirstOrDefault().Enabled = false;
if (_win32s.Any(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier))
_win32s.Where(x => x.UniqueIdentifier == programToDelete.UniqueIdentifier).FirstOrDefault().Enabled = false;
_settings.DisabledProgramSources
.Add(
new Settings.DisabledProgramSource
{
Name = ProgramToDelete.Name,
Location = ProgramToDelete.Location,
UniqueIdentifier = ProgramToDelete.UniqueIdentifier,
Name = programToDelete.Name,
Location = programToDelete.Location,
UniqueIdentifier = programToDelete.UniqueIdentifier,
Enabled = false
}
);