问题描述
- C#程序麻烦高手解释一下,小弟先谢谢了
-
using System;
using System.Threading;namespace Example_L2_Basic_Device_Access
{
[System.AddIn.AddIn("S", Version = "4", Publisher = "aaa", Description = "Provides examples on how to communicate with devices. Such as how to call methods of a Standard Resource or read Standard Names.")]
public partial class ISTARSServices : STARS.InternalInterfaces.VSTAItf.ISTARSServices
{
private MyAddin m_MyAddin;private void ISTARSServices_Startup(object sender, EventArgs e) { m_MyAddin = new MyAddin(); m_MyAddin.Run(this); } private void ISTARSServices_Shutdown(object sender, EventArgs e) { IDisposable dis = m_MyAddin as IDisposable; if (dis != null) dis.Dispose(); } #region VSTA generated code private void InternalStartup() { this.Startup += new System.EventHandler(ISTARSServices_Startup); this.Shutdown += new System.EventHandler(ISTARSServices_Shutdown); } #endregion }
}
解决方案
不知道“STARS”是什么。但是从字面理解,service startup是启动服务运行的逻辑。addin说明这是一个插件。
解决方案二:
using System;
using System.Collections.Generic;
using System.Text;
using STARS;
namespace Example_L2_Basic_Device_Access
{
public class MyAddin : ApplicationAddIn
{
protected override void Initialize()
{
base.Initialize();
STARSApplication.MainForm.Show(new STARSMainForm(this));
}
}
}
解决方案三:
请各位大哥指教一下以上程序大致是干啥的。尤其是以下几句代码,请指教
private void ISTARSServices_Startup(object sender, EventArgs e)
{
m_MyAddin = new MyAddin();
m_MyAddin.Run(this);
}
base.Initialize();
STARSApplication.MainForm.Show(new STARSMainForm(this));
解决方案四:
自己写的程序别人无法知道它的接口规范,除非有文档、或者例子。
给excel编写插件倒是容易,在code.msdn.microsoft.com codeproject.com上有很多例子,用 google 搜索下。