public override bool TryConnect(out string message) { try { message = "Connected."; api.SetOptions(Options); var task = api.Connect(); task.Wait(); return(true); } catch (Exception ex) { message = ex.ToString(); return(false); } }
public override bool TryConnect(out string message) { Task runner = null; try { message = "Connected."; api.SetOptions(Options); runner = api.Connect(); runner.Wait(); return(true); } catch (Exception ex) { message = ex.ToString(); return(false); } finally { runner?.Dispose(); } }