C#库中有一个接口,我正试图在Python中使用它
这就是我在c中的用法:
using MyDll.MyClass;
public partial class Form1 : Form
{
MyClass myclas= new MyClass();
IMyClassInterface myInterface = null;
private void button_Click(object sender, EventArgs e)
{
myInterface = (IMyClassInterface)myclas.GetService(computer, port, MyClass.ServiceName.RUNTIME_CONTROL); } }
问题是如何从c#dll使用c#接口在python中启动相同的服务? 同样,我还想用python实现。Python代码如下:
import sys
sys.path.append(r"C:\Program Files\foldername")
import clr
clr.AddReference(r"C:\Program Files\foldername\MyDll.MyClass")
from MyDll.MyClass import MyClass
def OnRun(self, userExcInst):
myInterface = MyClass()
myInterface = (IMyClassInterface)myclas.GetService(computer, port, MyClass.ServiceName.RUNTIME_CONTROL); #??? This is what I am trying to implement
因此,我想在python中使用c#dll启动服务
目前没有回答
相关问题 更多 >
编程相关推荐