Server Monitor Changes

- removed old button click events and replaced with commands.
- removed shutdown methods and added shutdown parameter to stop methods.
This commit is contained in:
Brett Hewitson 2022-05-18 01:01:44 +10:00
parent 3f4cc944b7
commit 61991ac55f
12 changed files with 490 additions and 469 deletions

View file

@ -19,7 +19,6 @@ namespace ServerManagerTool.Common.Lib
public ActionQueue(TaskScheduler scheduler = null)
{
this.workQueue = new ActionBlock<Action>(a => a.Invoke(), new ExecutionDataflowBlockOptions { MaxDegreeOfParallelism = 1, TaskScheduler = scheduler ?? TaskScheduler.Default });
}
public Task<T> PostAction<T>(Func<T> action)

View file

@ -31,10 +31,7 @@ namespace ServerManagerTool.Common.Lib
/// <param name="canExecute">The execution status logic.</param>
public RelayCommand(Action<T> execute, Predicate<T> canExecute)
{
if (execute == null)
throw new ArgumentNullException("execute");
_execute = execute;
_execute = execute ?? throw new ArgumentNullException("execute");
_canExecute = canExecute;
}
@ -53,7 +50,7 @@ namespace ServerManagerTool.Common.Lib
{
try
{
return _canExecute == null ? true : _canExecute((T)parameter);
return _canExecute == null || _canExecute((T)parameter);
}
catch (Exception)
{