public void Restart(string endpoint)
 {
     var mainWindow = new MainWindow();
     mainWindow.Connect(new EndpointAddress(endpoint));
     mainWindow.ClosedEvent += OnClosed;
     mainWindow.Update += OnUpdate;
     mainWindow.Show();
 }
 private void OpenClient()
 {
     var mainWindow = new MainWindow();
     mainWindow.Connect(servicesAddressList[0]);
     mainWindow.Show();
     mainWindow.WindowState = WindowState.Maximized;
     mainWindow.Update += (sender, e) =>
         {
             if (Update != null)
                 Update(sender, e);
         };
     mainWindow.Activate();
     mainWindow.ClosedEvent += (sender, e) => Dispatcher.Invoke(new Action(FindAndConnect));
 }