public KurSecim()
        {
            InitializeComponent();

            List <Doviz> CurList = null;

            using (WebClient client = new WebClient())
            {
                var json = client.DownloadString("http://www.doviz.com/api/v1/currencies/all/latest");
                CurList = JsonConvert.DeserializeObject <List <Doviz> >(json);
            }
            Doviz dov = new Doviz();

            if (CurList == null)
            {
                return;
            }

            foreach (Doviz d in CurList)
            {
                comboBox1.Items.Add(d.code);
                comboBox2.Items.Add(d.code);
                comboBox3.Items.Add(d.code);
            }
        }
Example #2
0
        private void listBox1_SelectedValueChanged(object sender, EventArgs e)
        {
            List <Doviz> CurList = null;

            using (WebClient client = new WebClient())
            {
                var json = client.DownloadString("http://www.doviz.com/api/v1/currencies/all/latest");
                CurList = JsonConvert.DeserializeObject <List <Doviz> >(json);
            }
            Doviz dov = new Doviz();

            if (CurList == null)
            {
                return;
            }

            foreach (Doviz d in CurList)
            {
                if (d.name == listBox1.SelectedItem.ToString())
                {
                    dov = d;
                }
            }
            label2.Text = dov.name;
            label6.Text = dov.buying.ToString();
            label5.Text = dov.selling.ToString();

            if (dov.change_rate > 0)
            {
                label5.ForeColor = Color.ForestGreen;
            }
            else
            {
                label5.ForeColor = Color.IndianRed;
            }
        }