Exemple #1
0
        public static CancellationToken Register(object operation, CancellationToken cancellationToken)
        {
            BackgroundOperation backgroundOperation = new BackgroundOperation(operation, cancellationToken);

            Operations.Add(backgroundOperation);

            return(backgroundOperation.CancellationTokenSource.Token);
        }
Exemple #2
0
        public static void UnRegister(object operation)
        {
            BackgroundOperation backgroundOperation = Operations.FirstOrDefault(x => x.Operation == operation);

            if (backgroundOperation != null)
            {
                Operations.Remove(backgroundOperation);
            }
        }
Exemple #3
0
        public static void Register(object operation, ICommand cancelCommand)
        {
            BackgroundOperation backgroundOperation = new BackgroundOperation(operation, cancelCommand);

            Operations.Add(backgroundOperation);
        }