I am writing WCF code and hosted in my WPF application. I am writing a class to switch my MainWindow to show another page in my project
public static class Switcher
{
public static MainWindow pageSwitcher;
public static void Switch(Page newPage)
{
pageSwitcher.Navigate(newPage);
}
}
and I write my wcf service as follows:
[ServiceContract]
public interface IAppManager
{
[OperationContract]
void DoWork();
[OperationContract]
void Page1();
[OperationContract]
void Page2();
}
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Multiple)]
public class AppManager : IAppManager
{
public void DoWork()
{
}
public void Page1()
{
MainWindow.pageSwitcher = new MainWindow();
MainWindow.Switch(new Page1());
}
public void Page2()
{
MainWindow.pageSwitcher = new MainWindow();
MainWindow.Switch(new Page2());
}
}
I want to remotely change the page from another computer using WCF, but it doesn’t work and I trace the start and response wcf code, but I’m not doing anything, how can I go to the main stream to change the ui page or another element?
Faraz source
share