public ServerStatus SetServerStatus(Action<ServerStatus> callback) { var result = ServerStatus.Communicating; try { var client = new MainClient(); client.GetDBStatusAsync(); client.GetDBStatusCompleted += (sender, e) => { if (e.Error != null) result = ServerStatus.Error; else if (e.Result) result = ServerStatus.Ok; else result = ServerStatus.Error; callback(result); }; } catch (Exception) { //throw; result = ServerStatus.Error; } return result; }