예제 #1
0
 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);
     }
 }
예제 #2
0
        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();
            }
        }