Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I identify my task/ how do I get the task name? (C#)

Hello,
although I am quite new to prgramming in C# and DAQ, I am trying to create a software which programmatically creates task, add channels, st timing parameters and dispose the task after use (lifetime of a task is about 4 weeks). As I need multiple Tasks I am using an array of Tasks but can't find a way to identify a certain task (except for its index in the array). As you can set the name of the Task via constructor "Task (string name)", I thought there should be a way to get the name in order to get the right array index for manipiulationg the task. Or can anyone think of a different way how to identify a task? (btw: i am not using Measurement Studio)

Thanks in advance
Andreas
0 Kudos
Message 1 of 3
(4,343 Views)
You could save your created tasks to the Measurement and Automation Explorer (MAX). If you do so, you can get an Array of Tasknames saved in MAX:
 
            string[] TaskNames;
            Task myTask = new Task("MyFirstTask");
            myTask.AIChannels.CreateVoltageChannel("Dev3/ai0", "TestChannel", AITerminalConfiguration.Differential, 0.0, 10.0, AIVoltageUnits.Volts);
            DaqSystem.Local.SaveTask(myTask);
            TaskNames=DaqSystem.Local.Tasks;
 
Hope this helps!
 
André
 
0 Kudos
Message 2 of 3
(4,334 Views)
Thanks for your answer! Unfortunately, the programme should run without supervision for several weeks, so the Tasks are to be created automatically. Thats also the reason, why I want to access the Tasks by some kind of identification, either Name or Number..
[edit]: maybe I should read the code as well 😉
This is worth a try, and its even a good oppurtunity to watch which tasks are active and which ressources have to be released. Thank you.

Message Edited by Lunarfur on 07-30-2007 10:49 AM

0 Kudos
Message 3 of 3
(4,326 Views)