59 lines
1.2 KiB
C#
59 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace DTS.DASLib.Command
|
|
{
|
|
public enum CommandStatus
|
|
{
|
|
Success,
|
|
Failure,
|
|
Canceled
|
|
}
|
|
|
|
public enum CommandErrorReason
|
|
{
|
|
SendFailed,
|
|
ReceiveFailed,
|
|
InvalidMode,
|
|
Canceled
|
|
}
|
|
|
|
public class CommandException : ApplicationException
|
|
{
|
|
public CommandErrorReason Error { get; set; }
|
|
|
|
public CommandException(CommandErrorReason _err)
|
|
{
|
|
Error = _err;
|
|
}
|
|
|
|
public CommandException(CommandErrorReason _err, string msg)
|
|
: base(msg)
|
|
{
|
|
Error = _err;
|
|
}
|
|
}
|
|
|
|
public enum CommandReceiveAction
|
|
{
|
|
StopReceiving,
|
|
ContinueReceiving
|
|
}
|
|
|
|
public interface ICommandReport
|
|
{
|
|
object CallbackObject { get; set; }
|
|
CommandStatus Status { get; set; }
|
|
}
|
|
|
|
public delegate CommandReceiveAction CommandCallback(ICommandReport report);
|
|
|
|
public interface ICommand
|
|
{
|
|
void Execute(CommandCallback Callback,
|
|
object CallbackObject);
|
|
void SyncExecute();
|
|
}
|
|
}
|