Statistics
| Branch: | Revision:

root / trunk / hammock / src / net35 / Hammock / Tasks / TaskOptions.cs @ 0eea575a

History | View | Annotate | Download (1.3 kB)

1
using System;
2

    
3
namespace Hammock.Tasks
4
{
5

    
6

    
7
#if !SILVERLIGHT
8
    [Serializable]
9
#endif
10
    public class TaskOptions<T> : TaskOptions, ITaskOptions<T>
11
    {
12
        private RateLimitType _rateLimitType = RateLimitType.ByPredicate;
13
        private double? _rateLimitPercent; 
14

    
15
        public virtual RateLimitType RateLimitType { get { return _rateLimitType; } }
16
        public virtual Predicate<T> RateLimitingPredicate { get; set; }
17
        public virtual Func<T> GetRateLimitStatus { get; set; }
18
        public virtual double? RateLimitPercent
19
        {
20
            get { return _rateLimitPercent; }
21
            set
22
            {
23
                if ( value != null)
24
                {
25
                    _rateLimitType = RateLimitType.ByPercent;
26
                }
27
                else
28
                {
29
                    _rateLimitType = RateLimitType.ByPredicate;
30
                }
31
                _rateLimitPercent = value;
32
            }
33
        }
34
    }
35

    
36
#if !SILVERLIGHT
37
    [Serializable]
38
#endif
39
    public class TaskOptions : ITaskOptions
40
    {
41
        public virtual TimeSpan DueTime { get; set; }
42
        public virtual int RepeatTimes { get; set; }
43
        public virtual TimeSpan RepeatInterval { get; set; }
44
        public virtual bool ContinueOnError { get; set; }
45
    }
46
}