⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 schedulerclient.cs

📁 SharpNuke源代码
💻 CS
字号:
using System;

using DotNetNuke.Common.Utilities;

//
// DotNetNuke -  http://www.dotnetnuke.com
// Copyright (c) 2002-2005
// by Shaun Walker ( sales@perpetualmotion.ca ) of Perpetual Motion Interactive Systems Inc. ( http://www.perpetualmotion.ca )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
// documentation files (the "Software"), to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions
// of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//



namespace DotNetNuke.Services.Scheduling
{
	public abstract class SchedulerClient
	{
		
		///''''''''''''''''''''''''''''''''''''''''''''''''
		//This class is inherited by any class that wants
		//to run tasks in the scheduler.
		///''''''''''''''''''''''''''''''''''''''''''''''''
		private WorkStarted processStartedEvent;
		private WorkProgressing processProgressingEvent;
		private WorkCompleted processCompletedEvent;
		private WorkErrored processErroredEvent;

		private string schedulerEventGuid;
		private string processMethod;
		private string status;
		private ScheduleHistoryItem scheduleHistoryItem;
		

		#region event handling
		public event WorkStarted ProcessStarted
		{
			add	{ this.processStartedEvent += value; }
			remove { this.processStartedEvent -= value; }
		}
		
		public event WorkProgressing ProcessProgressing
		{
			add { this.processProgressingEvent += value; }
			remove { this.processProgressingEvent -= value; }
		}
		
		public event WorkCompleted ProcessCompleted
		{
			add { this.processCompletedEvent += value; }
			remove { this.processCompletedEvent -= value; }
		}
		
		public event WorkErrored ProcessErrored
		{
			add { this.processErroredEvent += value; }
			remove { this.processErroredEvent -= value; }
		}
		
		public void Started ()
		{
			if (this.processStartedEvent != null)
				this.processStartedEvent(this);
		}

		public void Progressing ()
		{
			if (this.processProgressingEvent != null)
				this.processProgressingEvent(this);
		}

		public void Completed ()
		{
			if (this.processCompletedEvent != null)
				this.processCompletedEvent(this);
		}

		public void Errored (Exception exception)
		{
			if (this.processErroredEvent != null)
				this.processErroredEvent(this, exception);
		}
		#endregion

		///''''''''''''''''''''''''''''''''''''''''''''''''
		//This is the sub that kicks off the actual
		//work within the SchedulerClient's subclass
		///''''''''''''''''''''''''''''''''''''''''''''''''
		public abstract void DoWork ();
		
		public SchedulerClient() 
		{
			///''''''''''''''''''''''''''''''''''''''''''''''''
			//Assign the event a unique ID for tracking purposes.
			///''''''''''''''''''''''''''''''''''''''''''''''''
			this.schedulerEventGuid = Null.NullString; //@SV new Guid??
			this.processMethod = Null.NullString;
			this.status = Null.NullString;
			this.scheduleHistoryItem = new ScheduleHistoryItem();
		}
		
		public ScheduleHistoryItem ScheduleHistoryItem
		{
			get { return this.scheduleHistoryItem; }
			set { this.scheduleHistoryItem = value; }
		}

		public string SchedulerEventGUID
		{
			get { return this.schedulerEventGuid; }
			set { this.schedulerEventGuid = value; }
		}

		public string ProcessMethod
		{
			get { return this.processMethod; }
			set { this.processMethod = value; }
		}

		public string Status
		{
			get { return this.status; }
			set { this.status = value; }
		}
		
		public int ThreadID
		{
			get { return AppDomain.GetCurrentThreadId(); }
		}
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -