开发者

How to restore the window allowing single instance of the application in c#?

开发者 https://www.devze.com 2023-03-27 14:02 出处:网络
i implemented allowing to open single instance of the application by using the following thread Restoring window from the system tray when allowing only one instance of that program

i implemented allowing to open single instance of the application by using the following thread

Restoring window from the system tray when allowing only one instance of that program

it is working ,but the currently open window is not restoring.I haven't used the MDI Parent concept.To navigate the form just i used the hide() and show(). I tried the codeproject link from the above thread.I created first instance and i am in mainform.now i tried to open the second instance of the application, it is restoring the same windo开发者_运维问答w. After navigating to any of the window in the application.if i do the same,now it is opening the mainform in new window along with existing window.If i closed any one, both are closing.

How to modify the code to solve this?


I didnt take alook at the link in your post. But i am assuming your using Mutex to launch only 1 instance of the application to load no matter how many times you try to launch it.

If its an child app, then you can have a static object of that child and keep launching the same object with ShowDialog call (Winform).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号