private void MakeLabel(string name) /*Creates Currency Example Label above the listbox*/ { Currency cur1 = new Currency(); Currency cur2 = new Currency(); string text = CurrencyListBox.GetItemText(CurrencyListBox.SelectedItem); if (text.Length > 3) { text = text.Substring(0, 3); } cur1 = FindCurrency(name); cur2 = FindCurrency(text); if (cur2 == null) { cur2 = FindCurrency("USD"); } ExampleLabel.Text = "e.g. 1 " + name + " = " + ReturnRate(cur1, cur2) + " " + cur2.GetCurrencyName(); }
/* * private void CreatePanel1() * /*Creates Form*/ /* { * ReadXMLData xml = new ReadXMLData(); * var myItems1 = new BindingList<string> { }; * var ComboItems = new BindingList<string> { }; * * xml.CreateList(); * CurrencyList = xml.GetCurrencyList(); * xml.Create90DaysList(); * Currency90DaysList = xml.GetCurrency90DaysList(); * * passwordText.PasswordChar = '*'; * * int i = 31; * * foreach (Currency90Days prime in Currency90DaysList) * { * if (i == 31) * { * myItems1.Add(prime.GetCurrencyName() + "\t\t" + prime.GetCurrencyRate() + "\t\t" + prime.GetCurrencyDate()); * i = 0; * } * else * { * myItems1.Add(prime.GetCurrencyName() + "\t\t" + prime.GetCurrencyRate()); * i++; * } * // CurrencyComboBox.Items.Add(prime.GetCurrencyName()); * } * * * //myItems1.RemoveAt(0); * //CurrencyComboBox.SelectedIndex = 0; * CurrencyListBox.DataSource = myItems1; * //MakeLabel(CurrencyComboBox.Text); * }*/ /* * private void CreatePanel1() * /*Creates Form*/ /* { * ReadXMLData xml = new ReadXMLData(); * var myItems1 = new BindingList<string> { }; * var ComboItems = new BindingList<string> { }; * * xml.CreateList(); * CurrencyList = xml.GetCurrencyList(); * //xml.Create90DaysList(); * //Currency90DaysList = xml.GetCurrency90DaysList(); * * xml.Create90DaysWithCurrencyList(); * Currency90DaysWithCurrencyList = xml.GetCurrency90DaysWithCurrencyList(); * Currency90DaysWithCurrencyList.RemoveAt(0); * * * passwordText.PasswordChar = '*'; * * int i = 31; * * foreach (Currency90DaysWithCurrencyList prime in Currency90DaysWithCurrencyList) * { * myItems1.Add(prime.GetCurrencyDate()); * foreach (Currency cur in prime.GetCurrencyList()) * { * myItems1.Add(cur.GetCurrencyName() + "\t\t" + cur.GetCurrencyRate()); * i++; * } * // CurrencyComboBox.Items.Add(prime.GetCurrencyName()); * } * * * //myItems1.RemoveAt(0); * //CurrencyComboBox.SelectedIndex = 0; * CurrencyListBox.DataSource = myItems1; * //MakeLabel(CurrencyComboBox.Text); * } * */ private void CurrencyListBox_DoubleClick(object sender, EventArgs e) { if (xml.CheckForInternetConnection()) { string text = CurrencyListBox.GetItemText(CurrencyListBox.SelectedItem); if (text.Length > 3) { text = text.Substring(0, 3); } Currency cur2 = FindCurrency(text); //Hide(); Statistic stat = new Statistic((string)CurrencyComboBox.SelectedItem, cur2.GetCurrencyName()); stat.ShowDialog(); //Show(); stat = null; } else { MessageBox.Show("Brak połączenia Internetowego!"); } }