I am having problems with the code below. It is writen in C# on .Net 3.5. The actual code is much more lengthy, but I copied what should be important. The error I keep generating in VS is "An object reference is required for the non-static field, method, or property" with each of the DoCommand sections. I'm hoping this is an easy solution with a more seasoned set of eyes.
Thanks for any input.
namespace Sample
{
public class Sample : SampleBase
{
public Sample(IExecutionContext context)
: base(context)
{
}
public override string CallFunc(object sender, string function,
object args, out object ret)
{
RunSequence();
ret = null;
return "Ret";
}
static void RunSequence()
{
long actionNumber = 123456789;
DoCommand(OpsCommandType.Action, (long)actionNumber);
}
private void DoCommand(OpsCommandType command, long number)
{
var opsCommand = new OpsCommand();
opsCommand.Command = command;
opsCommand.Number = number;
DoCommand(opsCommand);
}
private void DoCommand(OpsCommand opsCommand)
{
var status = OpsContext.ProcessCommand(opsCommand);
if (!status.IsSuccess)
MessageBox.Show("ERROR");
}
public override void Destroy()
{
base.Destroy();
}
}
}