예제 #1
0
        public static async Task <UICompanyRowDetail> GetUICompanyRowDetailTask(string symbol, List <UIComapnyRow> companyList)
        {
            try
            {
                FmgSingleQuote singleQuote = await RetrieveJsonDataHelper.RetrieveFmgSingleQuote(symbol);

                UIComapnyRow       companyRow = companyList.Find(c => c.Symbol == symbol);
                Company            company    = DatabaseHelper.GetCompanyFromDb(symbol);
                UICompanyRowDetail result     = new UICompanyRowDetail
                {
                    Symbol           = symbol,
                    Name             = company.CompanyName,
                    Price            = companyRow.Price,
                    Open             = companyRow.Open,
                    High             = singleQuote.dayHigh,
                    Low              = singleQuote.dayLow,
                    Volume           = companyRow.Volume,
                    Change           = companyRow.PriceChange,
                    ChangePercentage = companyRow.ChangePercentage,
                    Description      = company.Description,
                    Ceo              = company.CEO,
                    Industry         = company.Industry,
                    Sector           = company.Sector
                };
                return(result);
            }
            catch (SystemException ex)
            {
                throw new SystemException(ex.Message);
            }
        }
예제 #2
0
        private static async Task <UIComapnyRow> GetWatchUIComanyRowTask(int userId, Company company)
        {
            try
            {
                Stopwatch sw = Stopwatch.StartNew();

                FmgQuoteOnlyPrice fmgQuoteOnlyPrice =
                    await RetrieveJsonDataHelper.RetrieveFmgQuoteOnlyPrice(company.Symbol);

                FmgSingleQuote singleQuote = await RetrieveJsonDataHelper.RetrieveFmgSingleQuote(company.Symbol);

                UIComapnyRow
                    companyRow = new UIComapnyRow(company, fmgQuoteOnlyPrice, singleQuote); //ex: FormatException

                sw.Stop();
                Console.Out.WriteLine(
                    $"\n---- Add one companyRow to result in GetWatchUICompanyRowList: {company.Symbol}, time: {sw.Elapsed.TotalMilliseconds} mills");
                return(companyRow);
            }
            catch (SystemException ex)
            {
                throw new SystemException(ex.Message);
            }
        }
예제 #3
0
 public CompanyDetailDialog(UIComapnyRow comapnyRow)
 {
     InitializeComponent();
     gdCompanyDetailDialog.DataContext = comapnyRow;
 }