private static AlertResult GetSingleAlert(AlertApiRequest request) { try { var symbol = request.StickerSymbol.ToUpper(); var task = Task.Run(() => { var mgr = new AlertMgr(symbol); return(mgr); }); task.Wait(); var myMgr = task.Result; var task2 = Task.Run(() => { return(myMgr.GetAlertResult()); }); task2.Wait(); var result = task2.Result; return(result); } catch (Exception ex) { return(new AlertResult { Success = false, Symbol = request.StickerSymbol, ErrorMessage = ex.Message }); } }
static void Main(string[] args) { var mgr = new AlertMgr("MSFT"); // var suggest = mgr.GetSuggestionForCurrentSticker(); //var result = mgr.CheckForAlert(); }