public GeneralVM(ScreenVM screenVM) { ScreenVm = screenVM; WebSocketConnector = new WebSocketConnector(); ConnectToServerCommand = new ConnectToServerCommand(this); ExitCommand = new ExitCommand(this); ConnectedForegroundColor = Brushes.Black; SetConnectButtonAndLabel(false); ExitButtonText = "Exit"; if (AutoConnectOnOpen) { if (ConnectToServerCommand.CanExecute(null)) { ConnectToServerCommand.Execute(null); } } if (Application.Current.MainWindow != null) { Application.Current.MainWindow.Closing += MainWindow_Closing; } }
public static ICouchClient ConnectTo(string address) { ICouchProxy couchProxy = new CouchProxy(new Uri(address)); ICouchCommand couchCommand = new ConnectToServerCommand(); ConnectToServerResult couchResult = couchProxy.Execute <ConnectToServerResult>(couchCommand); return(new CouchClient(couchProxy, couchResult.Version)); }