简体   繁体   中英

.NET How to communicate with Windows Forms app from Sharpshell COM Extension?

I have a windows form application (Synchronization application Like DropBox and Google Drive) and also COM Components(Shell extensions) that I created using SharpShell that added features to windows file system. My question is how the COM communicate with the Windows Form application. eg

When I create a singleton in my windows forms application, the COM extension can't see this Singleton(null) as I think it is a different process. my question is I want the best practice of how COM Process(C# code) communicate with Windows forms app(also c# code) or I want my singleton to be seen by both of the apps.

public class FileLoggerDoubleCheckLocking : BaseFileLogger
{
    private static FileLoggerDoubleCheckLocking _instance;
    private static readonly object _lock = new object();

    private FileLoggerDoubleCheckLocking()
    {
    }

    public static FileLoggerDoubleCheckLocking Instance
    {
        get
        {
            if (_instance == null)
            {
                lock (_lock)
                {
                    if (_instance == null)
                    {
                        _instance = new FileLoggerDoubleCheckLocking();
                    }
                }
            }
            return _instance;
        }
    }
}

谢谢,我已经通过使用WCF命名管道解决了WCF命名管道

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM