I am building a server manager application that displays list of servers. Each server provides some information which is arranged and grouped into 4 different windows.User can open any window from server's context menu. windows are opened and managed by ViewManager class which listens to different messages(via. messenger). I am using server ip as key for each instance in ServiceLocator. This way i can easily manage ViewModel instances of same type.
Problem I am facing is, how can i pass key to GetInstance() at runtime so that when window is initialized it uses the viewmodel with the specified key?
Currently i am using a static string variable(key) which i declared in ViewModelLocator.I initialize it with server's ip before instantiating window.
Is there any other solution?