Changeset 5

User picture

Author: marisic.net

(2008/09/24 16:23) Over 3 years ago


  

Affected files

Updated TaskScheduler/TaskScheduler/CacheManager/Properties/AssemblyInfo.cs Download diff

45
1
using System.Reflection;
1
using System.Reflection;
2
using System.Runtime.CompilerServices;
3
using System.Runtime.InteropServices;
2
using System.Runtime.InteropServices;
4
3
5
// General Information about an assembly is controlled through the following 
4
// General Information about an assembly is controlled through the following 
6
// set of attributes. Change these attribute values to modify the information
5
// set of attributes. Change these attribute values to modify the information
7
// associated with an assembly.
6
// associated with an assembly.
7
8
[assembly: AssemblyTitle("CacheManager")]
8
[assembly: AssemblyTitle("CacheManager")]
9
[assembly: AssemblyDescription("")]
9
[assembly: AssemblyDescription("")]
10
[assembly: AssemblyConfiguration("")]
10
[assembly: AssemblyConfiguration("")]
...
...
17
// Setting ComVisible to false makes the types in this assembly not visible 
17
// Setting ComVisible to false makes the types in this assembly not visible 
18
// to COM components.  If you need to access a type in this assembly from 
18
// to COM components.  If you need to access a type in this assembly from 
19
// COM, set the ComVisible attribute to true on that type.
19
// COM, set the ComVisible attribute to true on that type.
20
20
[assembly: ComVisible(false)]
21
[assembly: ComVisible(false)]
21
22
22
// The following GUID is for the ID of the typelib if this project is exposed to COM
23
// The following GUID is for the ID of the typelib if this project is exposed to COM
24
23
[assembly: Guid("51d1585f-d234-4e94-a608-195543e969e5")]
25
[assembly: Guid("51d1585f-d234-4e94-a608-195543e969e5")]
24
26
25
// Version information for an assembly consists of the following four values:
27
// Version information for an assembly consists of the following four values:
...
...
32
// You can specify all the values or you can default the Build and Revision Numbers 
34
// You can specify all the values or you can default the Build and Revision Numbers 
33
// by using the '*' as shown below:
35
// by using the '*' as shown below:
34
// [assembly: AssemblyVersion("1.0.*")]
36
// [assembly: AssemblyVersion("1.0.*")]
37
35
[assembly: AssemblyVersion("1.0.0.0")]
38
[assembly: AssemblyVersion("1.0.0.0")]
36
[assembly: AssemblyFileVersion("1.0.0.0")]
39
[assembly: AssemblyFileVersion("1.0.0.0")]

Updated TaskScheduler/TaskScheduler/CacheManager/TaskList.cs Download diff

45
13
{
13
{
14
    public class TaskList : IList<Task>
14
    public class TaskList : IList<Task>
15
    {
15
    {
16
        private readonly List<Task> _tasks = new List<Task>();
17
        private readonly Cache _cache = HttpRuntime.Cache;
18
        //How long for jobs to wait before waking.
16
        //How long for jobs to wait before waking.
19
        private const double sleepLength = 1;
17
        private const double sleepLength = 1;
18
        private readonly Cache _cache = HttpRuntime.Cache;
19
        private readonly List<Task> _tasks = new List<Task>();
20
20
21
        public List<Task> Tasks
21
        public List<Task> Tasks
22
        {
22
        {
...
...
24
            {
24
            {
25
                if (Count == 0)
25
                if (Count == 0)
26
                {
26
                {
27
                    var enumerator = _cache.GetEnumerator();
27
                    IDictionaryEnumerator enumerator = _cache.GetEnumerator();
28
                    do
28
                    do
29
                    {
29
                    {
30
                        if (enumerator.Current is Task)
30
                        if (enumerator.Current is Task)
...
...
35
            }
35
            }
36
        }
36
        }
37
37
38
        public CacheItemRemovedCallback CacheItemRemovedCallback { get; set; }
39
38
        #region Implementation of IEnumerable
40
        #region Implementation of IEnumerable
39
41
40
        public IEnumerator<Task> GetEnumerator()
42
        public IEnumerator<Task> GetEnumerator()
...
...
58
        /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is
read-only.</exception>
60
        /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is
read-only.</exception>
59
        public void Add(Task item)
61
        public void Add(Task item)
60
        {
62
        {
61
            var task = _tasks.Find(t => t.Name == item.Name);
63
            Task task = _tasks.Find(t => t.Name == item.Name);
62
            if (task == null)
64
            if (task == null)
63
            {
65
            {
64
                _tasks.Add(item);
66
                _tasks.Add(item);
...
...
74
            }
76
            }
75
        }
77
        }
76
78
77
        public Task Find(Predicate<Task> match)
78
        {
79
            return _tasks.Find(match);
80
        }
81
82
        public void Clear()
79
        public void Clear()
83
        {
80
        {
84
            throw new NotImplementedException();
81
            throw new NotImplementedException();
...
...
109
            get { return true; }
106
            get { return true; }
110
        }
107
        }
111
108
109
        public Task Find(Predicate<Task> match)
110
        {
111
            return _tasks.Find(match);
112
        }
113
112
        #endregion
114
        #endregion
113
115
114
        #region Implementation of IList<Task>
116
        #region Implementation of IList<Task>
...
...
159
                           CacheItemRemovedCallback);
161
                           CacheItemRemovedCallback);
160
            }
162
            }
161
        }
163
        }
162
163
        public CacheItemRemovedCallback CacheItemRemovedCallback { get; set; }
164
    }
164
    }
165
}
165
}

Added TaskScheduler/TaskScheduler/LocalTestRun.testrunconfig

Show contents

Updated TaskScheduler/TaskScheduler/TaskManager/Properties/AssemblyInfo.cs Download diff

45
1
using System.Reflection;
1
using System.Reflection;
2
using System.Runtime.CompilerServices;
3
using System.Runtime.InteropServices;
2
using System.Runtime.InteropServices;
4
3
5
// General Information about an assembly is controlled through the following 
4
// General Information about an assembly is controlled through the following 
6
// set of attributes. Change these attribute values to modify the information
5
// set of attributes. Change these attribute values to modify the information
7
// associated with an assembly.
6
// associated with an assembly.
7
8
[assembly: AssemblyTitle("TaskManager")]
8
[assembly: AssemblyTitle("TaskManager")]
9
[assembly: AssemblyDescription("")]
9
[assembly: AssemblyDescription("")]
10
[assembly: AssemblyConfiguration("")]
10
[assembly: AssemblyConfiguration("")]
...
...
17
// Setting ComVisible to false makes the types in this assembly not visible 
17
// Setting ComVisible to false makes the types in this assembly not visible 
18
// to COM components.  If you need to access a type in this assembly from 
18
// to COM components.  If you need to access a type in this assembly from 
19
// COM, set the ComVisible attribute to true on that type.
19
// COM, set the ComVisible attribute to true on that type.
20
20
[assembly: ComVisible(false)]
21
[assembly: ComVisible(false)]
21
22
22
// The following GUID is for the ID of the typelib if this project is exposed to COM
23
// The following GUID is for the ID of the typelib if this project is exposed to COM
24
23
[assembly: Guid("27a74ab0-59f5-417c-9f68-2844c7ac6081")]
25
[assembly: Guid("27a74ab0-59f5-417c-9f68-2844c7ac6081")]
24
26
25
// Version information for an assembly consists of the following four values:
27
// Version information for an assembly consists of the following four values:
...
...
32
// You can specify all the values or you can default the Build and Revision Numbers 
34
// You can specify all the values or you can default the Build and Revision Numbers 
33
// by using the '*' as shown below:
35
// by using the '*' as shown below:
34
// [assembly: AssemblyVersion("1.0.*")]
36
// [assembly: AssemblyVersion("1.0.*")]
37
35
[assembly: AssemblyVersion("1.0.0.0")]
38
[assembly: AssemblyVersion("1.0.0.0")]
36
[assembly: AssemblyFileVersion("1.0.0.0")]
39
[assembly: AssemblyFileVersion("1.0.0.0")]

Added TaskScheduler/TaskScheduler/Tasks.TestProject/AuthoringTests.txt

Show contents

Added TaskScheduler/TaskScheduler/Tasks.TestProject/PrintTaskOtherTest.cs

Show contents

Added TaskScheduler/TaskScheduler/Tasks.TestProject/PrintTaskTest.cs

Show contents

Added TaskScheduler/TaskScheduler/Tasks.TestProject/Properties/AssemblyInfo.cs

Show contents

Added TaskScheduler/TaskScheduler/Tasks.TestProject/ServiceUpTaskTest.cs

Show contents

Added TaskScheduler/TaskScheduler/Tasks.TestProject/Tasks.TestProject.csproj

Show contents

Updated TaskScheduler/TaskScheduler/Tasks/ITask.cs Download diff

45
1
#region Using Statements
1
#region Using Statements
2
2
3
using System;
4
3
4
5
#endregion
5
#endregion
6
6
7
namespace Tasks
7
namespace Tasks

Updated TaskScheduler/TaskScheduler/Tasks/Properties/AssemblyInfo.cs Download diff

45
1
using System.Reflection;
1
using System.Reflection;
2
using System.Runtime.CompilerServices;
3
using System.Runtime.InteropServices;
2
using System.Runtime.InteropServices;
4
3
5
// General Information about an assembly is controlled through the following 
4
// General Information about an assembly is controlled through the following 
6
// set of attributes. Change these attribute values to modify the information
5
// set of attributes. Change these attribute values to modify the information
7
// associated with an assembly.
6
// associated with an assembly.
7
8
[assembly: AssemblyTitle("Tasks")]
8
[assembly: AssemblyTitle("Tasks")]
9
[assembly: AssemblyDescription("")]
9
[assembly: AssemblyDescription("")]
10
[assembly: AssemblyConfiguration("")]
10
[assembly: AssemblyConfiguration("")]
...
...
17
// Setting ComVisible to false makes the types in this assembly not visible 
17
// Setting ComVisible to false makes the types in this assembly not visible 
18
// to COM components.  If you need to access a type in this assembly from 
18
// to COM components.  If you need to access a type in this assembly from 
19
// COM, set the ComVisible attribute to true on that type.
19
// COM, set the ComVisible attribute to true on that type.
20
20
[assembly: ComVisible(false)]
21
[assembly: ComVisible(false)]
21
22
22
// The following GUID is for the ID of the typelib if this project is exposed to COM
23
// The following GUID is for the ID of the typelib if this project is exposed to COM
24
23
[assembly: Guid("76d03579-2f89-44d2-b327-f9a6dc3594b9")]
25
[assembly: Guid("76d03579-2f89-44d2-b327-f9a6dc3594b9")]
24
26
25
// Version information for an assembly consists of the following four values:
27
// Version information for an assembly consists of the following four values:
...
...
32
// You can specify all the values or you can default the Build and Revision Numbers 
34
// You can specify all the values or you can default the Build and Revision Numbers 
33
// by using the '*' as shown below:
35
// by using the '*' as shown below:
34
// [assembly: AssemblyVersion("1.0.*")]
36
// [assembly: AssemblyVersion("1.0.*")]
37
35
[assembly: AssemblyVersion("1.0.0.0")]
38
[assembly: AssemblyVersion("1.0.0.0")]
36
[assembly: AssemblyFileVersion("1.0.0.0")]
39
[assembly: AssemblyFileVersion("1.0.0.0")]

Added TaskScheduler/TaskScheduler/Tasks/ServiceUpTask.cs

Show contents

Updated TaskScheduler/TaskScheduler/Tasks/Task.cs Download diff

45
10
    [DebuggerDisplay("Name = {Name}, Id = {Id}, LastRan = {LastRan}")]
10
    [DebuggerDisplay("Name = {Name}, Id = {Id}, LastRan = {LastRan}")]
11
    public abstract class Task : ITask
11
    public abstract class Task : ITask
12
    {
12
    {
13
        public abstract void Run();
14
15
        public string Name { get; set; }
13
        public string Name { get; set; }
16
        public bool Active { get; set; }
14
        public bool Active { get; set; }
17
        public DateTime? LastRan { get; set; }
15
        public DateTime? LastRan { get; set; }
18
        public decimal? Id { get; set; }
16
        public decimal? Id { get; set; }
17
18
        #region ITask Members
19
20
        public abstract void Run();
21
22
        #endregion
19
    }
23
    }
20
}
24
}

Updated TaskScheduler/TaskScheduler/Tasks/Tasks.csproj Download diff

45
35
    <Reference Include="System.Core">
35
    <Reference Include="System.Core">
36
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
36
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
37
    </Reference>
37
    </Reference>
38
    <Reference Include="System.ServiceProcess" />
38
    <Reference Include="System.Xml.Linq">
39
    <Reference Include="System.Xml.Linq">
39
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
40
      <RequiredTargetFramework>3.5</RequiredTargetFramework>
40
    </Reference>
41
    </Reference>
...
...
46
  </ItemGroup>
47
  </ItemGroup>
47
  <ItemGroup>
48
  <ItemGroup>
48
    <Compile Include="PrintTaskOther.cs" />
49
    <Compile Include="PrintTaskOther.cs" />
50
    <Compile Include="ServiceUpTask.cs" />
49
    <Compile Include="Task.cs" />
51
    <Compile Include="Task.cs" />
50
    <Compile Include="PrintTask.cs" />
52
    <Compile Include="PrintTask.cs" />
51
    <Compile Include="ITask.cs" />
53
    <Compile Include="ITask.cs" />

Updated TaskScheduler/TaskScheduler/TaskScheduler.sln Download diff

45
9
EndProject
9
EndProject
10
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CacheManager", "CacheManager\CacheManager.csproj",
"{18D49395-1DB3-492A-B320-963A06059155}"
10
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CacheManager", "CacheManager\CacheManager.csproj",
"{18D49395-1DB3-492A-B320-963A06059155}"
11
EndProject
11
EndProject
12
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tasks.TestProject", "Tasks.TestProject\Tasks.TestProject.csproj",
"{FDEEFE43-D08F-444B-9320-4EDC84ECE1EF}"
13
EndProject
14
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items",
"{BC73D6F5-3C1F-4161-99B0-B02E3E5AB30D}"
15
	ProjectSection(SolutionItems) = preProject
16
		LocalTestRun.testrunconfig = LocalTestRun.testrunconfig
17
		TaskScheduler.vsmdi = TaskScheduler.vsmdi
18
	EndProjectSection
19
EndProject
12
Global
20
Global
13
	GlobalSection(SubversionScc) = preSolution
21
	GlobalSection(SubversionScc) = preSolution
14
		Svn-Managed = True
22
		Svn-Managed = True
15
		Manager = AnkhSVN - Subversion Support for Visual Studio
23
		Manager = AnkhSVN - Subversion Support for Visual Studio
16
	EndGlobalSection
24
	EndGlobalSection
25
	GlobalSection(TestCaseManagementSettings) = postSolution
26
		CategoryFile = TaskScheduler.vsmdi
27
	EndGlobalSection
17
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
28
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
18
		Debug|Any CPU = Debug|Any CPU
29
		Debug|Any CPU = Debug|Any CPU
19
		Release|Any CPU = Release|Any CPU
30
		Release|Any CPU = Release|Any CPU
...
...
35
		{18D49395-1DB3-492A-B320-963A06059155}.Debug|Any CPU.Build.0 = Debug|Any CPU
46
		{18D49395-1DB3-492A-B320-963A06059155}.Debug|Any CPU.Build.0 = Debug|Any CPU
36
		{18D49395-1DB3-492A-B320-963A06059155}.Release|Any CPU.ActiveCfg = Release|Any CPU
47
		{18D49395-1DB3-492A-B320-963A06059155}.Release|Any CPU.ActiveCfg = Release|Any CPU
37
		{18D49395-1DB3-492A-B320-963A06059155}.Release|Any CPU.Build.0 = Release|Any CPU
48
		{18D49395-1DB3-492A-B320-963A06059155}.Release|Any CPU.Build.0 = Release|Any CPU
49
		{FDEEFE43-D08F-444B-9320-4EDC84ECE1EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
50
		{FDEEFE43-D08F-444B-9320-4EDC84ECE1EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
51
		{FDEEFE43-D08F-444B-9320-4EDC84ECE1EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
52
		{FDEEFE43-D08F-444B-9320-4EDC84ECE1EF}.Release|Any CPU.Build.0 = Release|Any CPU
38
	EndGlobalSection
53
	EndGlobalSection
39
	GlobalSection(SolutionProperties) = preSolution
54
	GlobalSection(SolutionProperties) = preSolution
40
		HideSolutionNode = FALSE
55
		HideSolutionNode = FALSE

Added TaskScheduler/TaskScheduler/TaskScheduler.vsmdi

Show contents

Updated TaskScheduler/TaskScheduler/TaskScheduler/Default.aspx.cs Download diff

45
15
15
16
        protected void Page_Load(object sender, EventArgs e)
16
        protected void Page_Load(object sender, EventArgs e)
17
        {
17
        {
18
            var printTask = taskManager.TaskList.Find(t => t.Id.GetValueOrDefault() == 1);
18
            Task printTask = taskManager.TaskList.Find(t => t.Id.GetValueOrDefault() == 1);
19
19
20
            lblStatus.Text = printTask != null ? (printTask.Active ? "Active" : "InActive") : "Task not found";
20
            lblStatus.Text = printTask != null ? (printTask.Active ? "Active" : "InActive") : "Task not found";
21
        }
21
        }
...
...
24
        {
24
        {
25
            taskManager.TaskList.Add(new PrintTask {Active = true, Id = 1, Name = "PrintTask1"});
25
            taskManager.TaskList.Add(new PrintTask {Active = true, Id = 1, Name = "PrintTask1"});
26
            taskManager.TaskList.Add(new PrintTaskOther {Active = true, Id = 2, Name = "PrintTaskOther2"});
26
            taskManager.TaskList.Add(new PrintTaskOther {Active = true, Id = 2, Name = "PrintTaskOther2"});
27
            taskManager.TaskList.Add(new PrintTask {Active = true, Id = 3, Name = "PrintTask3"});
27
            //taskManager.TaskList.Add(new PrintTask {Active = true, Id = 3, Name = "PrintTask3"});
28
            taskManager.TaskList.Add(new PrintTask {Active = true, Id = 4, Name = "PrintTask4"});
28
            //taskManager.TaskList.Add(new PrintTask {Active = true, Id = 4, Name = "PrintTask4"});
29
            taskManager.TaskList.Add(new PrintTaskOther {Active = true, Id = 5, Name = "PrintTaskOther5"});
29
            //taskManager.TaskList.Add(new PrintTaskOther {Active = true, Id = 5, Name = "PrintTaskOther5"});
30
31
            taskManager.TaskList.Add(new ServiceUpTask {Active = true, Id = 5, Name = "UnitTestServiceUpTask", ServiceName = "Telnet"});
30
        }
32
        }
31
    }
33
    }
32
}
34
}

Updated TaskScheduler/TaskScheduler/TaskScheduler/Properties/AssemblyInfo.cs Download diff

45
1
using System.Reflection;
1
using System.Reflection;
2
using System.Runtime.CompilerServices;
3
using System.Runtime.InteropServices;
2
using System.Runtime.InteropServices;
4
3
5
// General Information about an assembly is controlled through the following 
4
// General Information about an assembly is controlled through the following 
6
// set of attributes. Change these attribute values to modify the information
5
// set of attributes. Change these attribute values to modify the information
7
// associated with an assembly.
6
// associated with an assembly.
7
8
[assembly: AssemblyTitle("TaskScheduler")]
8
[assembly: AssemblyTitle("TaskScheduler")]
9
[assembly: AssemblyDescription("")]
9
[assembly: AssemblyDescription("")]
10
[assembly: AssemblyConfiguration("")]
10
[assembly: AssemblyConfiguration("")]
...
...
17
// Setting ComVisible to false makes the types in this assembly not visible 
17
// Setting ComVisible to false makes the types in this assembly not visible 
18
// to COM components.  If you need to access a type in this assembly from 
18
// to COM components.  If you need to access a type in this assembly from 
19
// COM, set the ComVisible attribute to true on that type.
19
// COM, set the ComVisible attribute to true on that type.
20
20
[assembly: ComVisible(false)]
21
[assembly: ComVisible(false)]
21
22
22
// The following GUID is for the ID of the typelib if this project is exposed to COM
23
// The following GUID is for the ID of the typelib if this project is exposed to COM
24
23
[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]
25
[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]
24
26
25
// Version information for an assembly consists of the following four values:
27
// Version information for an assembly consists of the following four values:
...
...
31
//
33
//
32
// You can specify all the values or you can default the Revision and Build Numbers 
34
// You can specify all the values or you can default the Revision and Build Numbers 
33
// by using the '*' as shown below:
35
// by using the '*' as shown below:
36
34
[assembly: AssemblyVersion("1.0.0.0")]
37
[assembly: AssemblyVersion("1.0.0.0")]
35
[assembly: AssemblyFileVersion("1.0.0.0")]
38
[assembly: AssemblyFileVersion("1.0.0.0")]