Last active
May 14, 2020 16:47
-
-
Save clope031/17afa4e042bb719213163c8aaa403c64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.ComponentModel; | |
using System.Data; | |
using System.Drawing; | |
using System.Linq; | |
using System.Text; | |
using System.Windows.Forms; | |
using ORiN2.interop.CAO; | |
namespace RC8_with_ORiN_VS2010 | |
{ | |
public partial class Task : Form | |
{ | |
private CaoEngine g_eng; //CaoEngine object variable | |
private CaoController g_ctrl; //CaoController object variable | |
private CaoTask g_task; //CaoTask object variable | |
private CaoTask g_task2; | |
public Task() | |
{ | |
InitializeComponent(); | |
} | |
private void Command1_Click(object sender, EventArgs e) | |
{ | |
g_task.Start(1, ""); //Start Task | |
} | |
private void Command2_Click(object sender, EventArgs e) | |
{ | |
g_task.Stop(4, ""); //Stop Task | |
} | |
private void Task_Load(object sender, EventArgs e) | |
{ | |
g_eng = new CaoEngine(); //CaoEngine object creation | |
//Connect RC: IP setting depends on your RC setting. | |
g_ctrl = g_eng.Workspaces.Item(0).AddController("RC8", "CaoProv.DENSO.RC8", "", "Server=192.168.0.1"); | |
g_task = g_ctrl.AddTask("PRO1", ""); //Task name PRO1 | |
g_task2 = g_ctrl.AddTask("Test1", ""); | |
} | |
private void Task_FormClosed(object sender, FormClosedEventArgs e) | |
{ | |
//Delete task object | |
g_ctrl.Tasks.Clear(); | |
System.Runtime.InteropServices.Marshal.ReleaseComObject(g_task); | |
g_task = null; | |
//Delete controller object | |
g_eng.Workspaces.Item(0).Controllers.Remove(g_ctrl.Index); | |
System.Runtime.InteropServices.Marshal.ReleaseComObject(g_ctrl); | |
g_ctrl = null; | |
//Delete engine object | |
System.Runtime.InteropServices.Marshal.ReleaseComObject(g_eng); | |
g_eng = null; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment