Are you sure this is the right way to make two applications talk to each other?
If you do not have the source code for BApp, and it also does not have an API that you can use, then pretending to be an interactive user may be the only way to interact with it. Just keep in mind that this is fraught with problems, think what will happen when
- BApp not yet launched
- BApp has an open modal dialogue
- BApp is in the middle of an operation (or hanging), and its menu is disabled.
- BApp is updated to a new version and changes to its user interface.
- The interactive user changes focus in the middle of the operation.
An alternative to this would be the same thing you do when you test the application using the user interface. This is because you are doing the same thing, automating the application, making calls that perform its functions, in this case, to check the results, as expected. Since this WPF message suggests that you are writing an application with MVVM, the best way (to avoid being fragile when changing the user interface) is to ignore the user interface (View) and call the layer below it, i.e. virtual machine (ViewModel).
Itβs actually quite simple to add a self-contained WCF connection inside your BApp application so that it can be called from the outside.
this._host = new ServiceHost(service); this._host.AddServiceEndpoint(typeof(IContract), new NetTcpBinding(), address); this._host.Open();
This would allow you to make both speak completely independently.
Alski source share