Exemple #1
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            var       Value = new Kryptools.Data.CoinData();
            DataTable dt;

            decimal item       = Convert.ToDecimal(txtCalculator.Text);
            decimal coinValue  = ((CalculatorComboBoxItem)cbCoin.SelectedItem).ValueBTC;
            string  coinSymbol = ((CalculatorComboBoxItem)cbCoin.SelectedItem).Symbol;
            string  coinRate   = "(1" + coinSymbol + "=" + coinValue + "B)";

            decimal sum      = currentValue + (item * coinValue);
            string  listItem = item.ToString() + "x" + coinSymbol + " - [" + coinValue + "B] - Total: " + currentValue;

            currentValue = sum;
            lvCalculator.Items.Add(listItem);
        }
Exemple #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            alert = new List <Alert>();

            var Market = new Kryptools.Data.CoinData();

            DataTable dtMarket = new DataTable();

            dtMarket             = Market.GetMarket();
            dgMarket.DataContext = dtMarket.DefaultView;

            DataTable CoinList = new DataTable();

            CoinList = Market.GetCoinPrices();

            cbCoin.Items.Add("--COIN--");

            cbCoin.SelectedIndex = 0;


            foreach (DataRow i in CoinList.Rows)
            {
                String DisplayText = "[" + i["Symbol"].ToString().ToUpper() + "] - " + i["Name"] + " - (" + i["Price(B)"] + "B)";

                CalculatorComboBoxItem item = new CalculatorComboBoxItem(DisplayText,
                                                                         i["id"].ToString(),
                                                                         i["Symbol"].ToString(),
                                                                         Convert.ToDecimal(i["Price(B)"].ToString()),
                                                                         i["Name"].ToString());
                cbCoin.Items.Add(item);
            }

            foreach (DataRow j in dtMarket.Rows)
            {
                String DisplayText = j["Symbol"].ToString() + "- [" + j["Name"].ToString() + "] - (" + j["Price(BTC)"].ToString() + " btc)";

                CalculatorComboBoxItem item = new CalculatorComboBoxItem(DisplayText,
                                                                         j["id"].ToString(),
                                                                         j["Symbol"].ToString(),
                                                                         Convert.ToDecimal(j["Price(BTC)"].ToString()),
                                                                         j["Name"].ToString());

                cbAlert.Items.Add(item);
            }

            ColumnDefinition TitleCol     = new ColumnDefinition();
            ColumnDefinition SubRedditCol = new ColumnDefinition();
            ColumnDefinition DateCol      = new ColumnDefinition();
            ColumnDefinition URLCol       = new ColumnDefinition();

            grdNews.ColumnDefinitions.Add(TitleCol);
            grdNews.ColumnDefinitions.Add(SubRedditCol);
            grdNews.ColumnDefinitions.Add(DateCol);
            grdNews.ColumnDefinitions.Add(URLCol);

            Kryptools.Data.NewsData nd = new NewsData();

            DataTable dt = new DataTable();

            dt = nd.GetNews();

            int index = 0;

            foreach (DataRow dr in dt.Rows)
            {
                RowDefinition rd = new RowDefinition();
                rd.Height = new GridLength(0, GridUnitType.Auto);
                grdNews.RowDefinitions.Insert(grdNews.RowDefinitions.Count, rd);

                TextBlock tbURL = new TextBlock();

                //Label lblTitle = new Label();
                //lblTitle.Content = dr["Title"];
                Label lblSubReddit = new Label();
                lblSubReddit.Content = dr["SubReddit"];
                Label lblDate = new Label();
                lblSubReddit.Content = dr["Date"].ToString();

                Run url = new Run(dr["URL"].ToString());
                tbURL.Inlines.Add(new Hyperlink(url));
                tbURL.Text = dr["Title"].ToString();

                //Label lblURL= new Label();
                //lblSubReddit.Content = dr["URL"];



                Grid.SetColumn(lblDate, 0);
                Grid.SetRow(lblDate, index);

                Grid.SetColumn(tbURL, 1);
                Grid.SetRow(tbURL, index);

                Grid.SetColumn(lblSubReddit, 2);
                Grid.SetRow(lblSubReddit, index);


                //Grid.SetColumn(tbURL, 3);
                //Grid.SetRow(tbURL, index);

                //grdNews.Children.Add(lblTitle);
                grdNews.Children.Add(lblSubReddit);
                grdNews.Children.Add(lblDate);
                grdNews.Children.Add(tbURL);

                index++;
            }
        }