public AppViewModel() { RserveClient = new RserveConnection(); CreateDesign(); InitHandlers(); InitViewMode(); InitCommands(); }
//public static readonly TimeSpan DefaultTimeOut = TimeSpan.FromMinutes(1); private static RserveConnection NewConnection() { var waitHandle = new AutoResetEvent(false); var connection = new RserveConnection(); connection.Connect((connectionState_, socketError_) => waitHandle.Set()); waitHandle.WaitOne(DefaultTimeOut); if (connection.ConnectionState != ConnectionState.Connected) { throw new Exception("Connection failure"); } return connection; }