Hi Jonas,
Apart from the EventLogExporter.cs file, We have also created a new TaskBase class in MapInfo.AddIns.Common assembly which encapsulates lots of functionality that you see in EventLogExporter.cs
We have also added TaskMessage, TaskCommand classes within the same assembly as you see in EventLogExporter.cs file. Take a look at sample below, for more information you can refer to EventLogExporter.cs file.
public class NewBGTask : TaskBase
{
public override void worker_DoWork(object sender, DoWorkEventArgs e)
{
throw new NotImplementedException();
}
protected override void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
base.worker_RunWorkerCompleted(sender, e);
}
}
------------------------------
Anshul Goel
Knowledge Community Shared Account
Shelton CT
------------------------------
Original Message:
Sent: 08-02-2022 10:01
From: Jonas Nordlund
Subject: Adding background tasks
Hi!
I've been unable to find documentation on how to add a MapInfo Pro background task via the .NET API.
The type IMapInfoApplication
has a collection of BackgroundTasks
.
So, if MIApp is an instance that implements that interface, I can do:
MIApp.BackgroundTasks.AddTask(task);
However, how do I even create a task? AddTask wants an ITask
but this is merely the interface and I don't know how to construct a task, or what they are exactly (a sequence of MapBasic statements??)
------------------------------
Jonas Nordlund
Software Developer
Norconsult AB
Sweden
------------------------------