我正在爲CAM/CAD軟件編寫插件/界面,並使用此代碼打開「SaveWindow」。如何不能在CAM界面上同時打開多個窗口
public void Run(string theMode)
{
try
{
if (theMode == "SaveWindow")
{
string aPictureString = GetPictureString();
StartInterface(null, theMode, CreateAndSaveTheToolList(aPictureString));
}
else
{
string aPipeId = GetRandomString();
itsServerStream = new NamedPipeServerStream(aPipeId, PipeDirection.In, 1);
ThreadPool.QueueUserWorkItem(this.ListenToStream);
StartInterface(aPipeId, theMode, "");
StartNamedPipe(aPipeId);
itsRefreshThread = new Thread(this.RefreshTools);
itsRefreshThread.Start();
if (!InitLogger(Path.GetDirectoryName(this.GetType().Assembly.Location)))
{
MessageBox.Show(//Secured code);
return;
}
}
itsLogger.Info("Run execute was successful.");
}
catch (Exception aException)
{
//Secured code
}
LogManager.ResetConfiguration();
}
如果有一個接口打開,我再次單擊插件按鈕,它會打開另一個多個。如果第一個打開,我該如何編碼才能打開第二個。
最好的是要求支持它,因爲也許你錯過了某種「獨家」插件選項。否則,你可以嘗試IPC同步,例如[命名互斥體](https://stackoverflow.com/q/2186747/1997232)。 – Sinatr