Get object property from running process
-
I am writing a logistics application suite. It will have a main program, a maintenance program, an order entry program, and an admin program. The main program will just control security while all other applications are running. Whenever any of the other programs start up, first it is going to check if there is already an instance of the application running using System.Diagnostics.Process.GetProcessesByName(). If there is then it will just activate that instance. If there isn't then it will then check if there is an instance of the main application using System.Diagnostics.Process.GetProcessesByName(). If there is an instance of the main application, then it will just get a reference to the user object from the main program. If there isn't an instance of the main application, then it will create a new process of the main application with System.Diagnostics.Process.Start(), which will require the user to log in and that will intialize the user object. Then the executing program will get a reference to the user object from the main program that was just started. I hope this explains everything I am trying to do. If you have any suggestions on how to do this or of a better way to reach the desired outcome, I would greatly appreciate it. Thanks Shaun
-
I am writing a logistics application suite. It will have a main program, a maintenance program, an order entry program, and an admin program. The main program will just control security while all other applications are running. Whenever any of the other programs start up, first it is going to check if there is already an instance of the application running using System.Diagnostics.Process.GetProcessesByName(). If there is then it will just activate that instance. If there isn't then it will then check if there is an instance of the main application using System.Diagnostics.Process.GetProcessesByName(). If there is an instance of the main application, then it will just get a reference to the user object from the main program. If there isn't an instance of the main application, then it will create a new process of the main application with System.Diagnostics.Process.Start(), which will require the user to log in and that will intialize the user object. Then the executing program will get a reference to the user object from the main program that was just started. I hope this explains everything I am trying to do. If you have any suggestions on how to do this or of a better way to reach the desired outcome, I would greatly appreciate it. Thanks Shaun
Since it is different applications using different AppDomains, you will probably want to go with a remoting singleton object. That would allow you to share the single instance between the applications. You could spin off an invisible WinApp UserData server module that will host your remote object. The UserData object could have a reference counter property to track how many client connections it currently has. When an application starts, if the UserData server is not in the proccess list, then it would start the UserData server, and call the UserData member to display and validate the login. Of course, if the server is already running then it does not do the login since the login has already occured and the UserData object will have your login instance. After the server is confirmed to be running, the program that was launched would remote connect to the UserData object and increment the ref count. When a application is closing, it decay the ref counter by one and if it is zero, it would trigger the UserData server to close. Rocky Moore <><
-
Since it is different applications using different AppDomains, you will probably want to go with a remoting singleton object. That would allow you to share the single instance between the applications. You could spin off an invisible WinApp UserData server module that will host your remote object. The UserData object could have a reference counter property to track how many client connections it currently has. When an application starts, if the UserData server is not in the proccess list, then it would start the UserData server, and call the UserData member to display and validate the login. Of course, if the server is already running then it does not do the login since the login has already occured and the UserData object will have your login instance. After the server is confirmed to be running, the program that was launched would remote connect to the UserData object and increment the ref count. When a application is closing, it decay the ref counter by one and if it is zero, it would trigger the UserData server to close. Rocky Moore <><
Do you have a code example of what you are talking about, because I am not quite sure how to implement what you are talking about? Thanks
-
Do you have a code example of what you are talking about, because I am not quite sure how to implement what you are talking about? Thanks
Yeah, I can through together a little sample for you tonight. Just heading to bed at the moment, but will e-mail it to you later tonight. Rocky Moore <><
-
Yeah, I can through together a little sample for you tonight. Just heading to bed at the moment, but will e-mail it to you later tonight. Rocky Moore <><
Thank you very much, it worked perfectly. I really appreciate your help. Shaun
-
Thank you very much, it worked perfectly. I really appreciate your help. Shaun
Your welcome, glad I could be of help! Rocky Moore <><