Little Registry Cleaner/Common Tools/TaskScheduler/Action.cs

(开头部分) 22KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Collections;

namespace Common_Tools.TaskScheduler
{
	/// <summary>
	/// Defines the type of actions a task can perform.
	/// </summary>
	/// <remarks>The action type is defined when the action is created and cannot be changed later. See <see cref="ActionCollection.AddNew"/>.</remarks>
	public enum TaskActionType
	{
		/// <summary>This action fires a handler.</summary>
		ComHandler = 5,
		/// <summary>This action performs a command-line operation. For example, the action can run a script, launch an executable, or, if the name of a document is provided, find its associated application and launch the application with the document.</summary>
		Execute = 0,
		/// <summary>This action sends and e-mail.</summary>
		SendEmail = 6,
		/// <summary>This action shows a message box.</summary>
		ShowMessage = 7
	}

	/// <summary>
	/// Abstract base class that provides the common properties that are inherited by all action objects. An action object is created by the <see cref="ActionCollection.AddNew"/> method.
	/// </summary>
	public abstract class Action : IDisposable, ICloneable
	{
		internal V2Interop.IAction iAction = null;

		/// <summary>List of unbound values when working with Actions not associated with a registered task.</summary>
		protected Dictionary<string, object> unboundValues = new Dictionary<string, object>();

		internal virtual bool Bound { get { return this.iAction != null; } }

		internal virtual void Bind(V1Interop.ITask iTask)
		{
		}

		internal virtual void Bind(V2Interop.ITaskDefinition iTaskDef)
		{
			V2Interop.IActionCollection iActions = iTaskDef.Actions;
			switch (this.GetType().Name)
			{
				case "ComHandlerAction":
					iAction = iActions.Create(TaskActionType.ComHandler);
					break;
				case "ExecAction":
					iAction = iActions.Create(TaskActionType.Execute);
					break;
				case "EmailAction":
					iAction = iActions.Create(TaskActionType.SendEmail);
					break;
				case "ShowMessageAction":
					iAction = iActions.Create(TaskActionType.ShowMessage);
					break;
				default:
					throw new ArgumentException();
			}
后面还有 617 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。