KrunalC

I have editor sort of application developed in c# using .Net 3.0 framework. My editor works in two different modes i.e. in Enginnering mode & Standalone mode.

My requirements are
I should be able to run multiple instances of my application on same system in different modes. When I open the file in the editor then prior opening the file, it should check whether any instance of my application is running in particular mode or not. If the instance is running then file should use the running instance to open the file.

Considering above requirements, can some one give me ideas on following :

1) Out of all the running instances how I can select particular instance to operate upon
2) How I can store my attributes i.e. mode of editor etc. in the running instance

I hope, I'm clear with my question. If you want me to clarify more pls revert with your questions. I hope this forum will get me some directions.

Thanks

Krunal C




Re: Visual C# General managing different instances of application

OmegaMan

Questions:
  1. When you say check for instance, do you mean on the local box or network
  2. How should the application know to whether it should run in application mode or engineering mode Is it user selectable or by domain user's credentials





Re: Visual C# General managing different instances of application

KrunalC

Omegaman,

Thank you very much for your reply.

1) Well, all my instances will run on local machine only.

2) I have some logic in my application which determines whether to launch application in Engineering mode or standalone mode. If I'm opening up some file from the project then my application should launch in Engineering mode. If I'm opening the file out of project then my application should launch in Standalone mode. Mode of application has nothing to do with user credential and user can not set the mode.

My question is suppose two of my application instances are already running in say Engineering and Standalone mode. Now when user tries to open file and file needs to open in Engineering mode then how I should be able to identify which instance of mine is running in Engineering mode Using PROCESS class I can get the collection of the instances running on my system but my problem is how I can identify that particular instance is of Engineering mode or Standalone mode.

Krunal C






Re: Visual C# General managing different instances of application

OmegaMan

I have an article which discusses how to use a Mutex in C# to make sure that you only have one application running at a time. One could take that article and name the mutex pipe according to which operation is going. So you could have two pipes running, one a Engineering and the other Standalone. Upon the third attempt, regardless of which is chosen, you would disallow a third...or do logic which you feel is appropriate.

Here is my blog article, Having One Instance Of an Application in .Net. Good luck and have fun.





Re: Visual C# General managing different instances of application

KrunalC

Omeagaman,

Thanks again for replying.

The one you have suggested had already come across my mind but that thing is not helping. That thing only prevent the launching of new instance but will not help me in getting the particular mode instance.

i.e. suppost two instance are running then after prohibiting the launching of new instance how I can decide which instance I can use out of two running instances Also I will have process objects from that how i can get instance object Hope my question is clear to you.

thanks,

Krunal C






Re: Visual C# General managing different instances of application

OmegaMan

> That thing only prevent the launching of new instance but will not help me in getting the particular mode instance.

Maybe I was not clear in my first post, you will create a named mutex with different names. That differentiates what is running.

Well you have come to OmegaMan's one stop shopping as to getting info across to the applications; Create a named pipe using WCF between the applications. I discuss it in my article entitled Create a Intra-Application Named Pipe using WCF in .Net.




Re: Visual C# General managing different instances of application

KrunalC

Omegaman,

Thank you very much.

It seems like the link provided by you is what I was looking for. I'm trying to implement the same. If any problem persists will get back to you. I couldn't understand the shopping funda...

Krunal C






Re: Visual C# General managing different instances of application

OmegaMan

Feel free to provide any code issues or suggestions by replying on my blog...thanks!