public void AddActionCommand(ActionCommandObject command)
 {
     lock (commands)
     {
         commands.Add(command);
         Sort();
     }
     OnCountChangeEvent?.Invoke();
 }
        public async void PerformAllActions()
        {
            await Task.Run(() =>
            {
                lock (commands)
                {
                    while (commands.Count > 0)
                    {
                        ActionCommandObject command = commands[0];
                        OnCommandWillStartEvent?.Invoke(command);
                        command.PerformAction();

                        commands = commands.GetRange(1, commands.Count - 1);
                        Sort();
                        OnCommandDidFinishEvent?.Invoke(command);
                        OnCountChangeEvent?.Invoke();
                    }
                }
                OnPerformEndEvent?.Invoke();
            });
        }
 public void ClearActions()
 {
     commands.Clear();
     OnCountChangeEvent?.Invoke();
 }