簡體   English   中英

如何檢查表單實例是否已存在?

[英]How do i check if an instance of the form already exists?

我正在為Rhino開發一個插件,當我運行命令啟動插件時,我執行以下操作。 它創建一個啟動表單,上面有一個計時器,並在2秒后加載另一個表單。

如果我不小心再次單擊了插件圖標,它將創建spash表單的另一個實例,該實例將再次加載插件。

我該如何預防?

這是構成表格的代碼。

public override IRhinoCommand.result RunCommand(IRhinoCommandContext context)
            {

                Splash Splash = new Splash();
                Splash.Show();

                return IRhinoCommand.result.success;
            }
public override IRhinoCommand.result RunCommand(IRhinoCommandContext context)
{
    if (!Application.OpenForms.OfType<Splash>().Any())
    {
        new Thread(() => Application.Run(new Splash())).Start();
    }
    return IRhinoCommand.result.success;
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM