private void OpCurrencyv_onItemSelected(object sender, EventArgs e) { if (OpCurrencyv.selectedIndex == 0) { OpCurrencyv.selectedIndex = 0; PublicCurrencyIndex = 0; OpTimePeriodv.Clear(); OpTimePeriodv.AddItem("USD ($)"); OpTimePeriodv.AddItem("BTC (Satoshi)"); lblCurrencyPreview.Text = "XXX/USD"; } else if (OpCurrencyv.selectedIndex == 1) { OpCurrencyv.selectedIndex = 1; PublicCurrencyIndex = 1; OpTimePeriodv.Clear(); OpTimePeriodv.AddItem("AUD ($)"); OpTimePeriodv.AddItem("BTC (Satoshi)"); lblCurrencyPreview.Text = "XXX/AUD"; } Reference.CryptoForm.SyncingTest(); //Refreshs Data. //lblDefaultSetVisible = false; }
//Function for Loading the Selected Profile. //ProfileNumber is sourced from LoginScreen. public void LoadProfile(double ProfileNumber) { try { StartingPeriod = File.ReadAllText(@"C:\Users\" + Environment.UserName + @"\Documents\CryptoCentral\Profiles\" + Convert.ToString(Profile) + @"\TimePeriod.txt"); StartingTimeZone = File.ReadAllText(@"C:\Users\" + Environment.UserName + @"\Documents\CryptoCentral\Profiles\" + Convert.ToString(Profile) + @"\TimeZone.txt"); StartingCurrency = File.ReadAllText(@"C:\Users\" + Environment.UserName + @"\Documents\CryptoCentral\Profiles\" + Convert.ToString(Profile) + @"\Currency.txt"); PageNumber = File.ReadAllText(@"C:\Users\" + Environment.UserName + @"\Documents\CryptoCentral\Profiles\" + Convert.ToString(Profile) + @"\PageStart.txt"); Pages = File.ReadAllText(@"C:\Users\" + Environment.UserName + @"\Documents\CryptoCentral\Profiles\" + Convert.ToString(Profile) + @"\Pages.txt"); CurrencyNumber = Convert.ToInt32(StartingCurrency); TimeZoneNumber = Convert.ToInt32(StartingTimeZone); PageCalculation = Convert.ToInt32(Pages); for (int i = 0; i < PageCalculation; i++) { // PagevAddItem(new Item(Convert.ToString(pages), pages)); //Add Item to Combo Box based on txt file. pages = pages + 1; //Universal Way of Checking Current Page Number. if (pages > PageCalculation) { pages = pages - 1; //Pages is added before the end of the loop this ensures it is correct. } } //Setting Correct Starting Index for Combo Boxes. if (CurrencyNumber == 0) { OpCurrencyv.selectedIndex = 0; PublicCurrencyIndex = 0; OpTimePeriodv.Clear(); OpTimePeriodv.AddItem("USD ($)"); OpTimePeriodv.AddItem("BTC (Satoshi)"); lblCurrencyPreview.Text = "XXX/USD"; } else if (CurrencyNumber == 1) { OpCurrencyv.selectedIndex = 1; PublicCurrencyIndex = 1; OpTimePeriodv.Clear(); OpTimePeriodv.AddItem("AUD ($)"); OpTimePeriodv.AddItem("BTC (Satoshi)"); lblCurrencyPreview.Text = "XXX/AUD"; } if (TimeZoneNumber == 0) { OpTimeZonev.selectedIndex = 0; } else if (TimeZoneNumber == 1) { OpTimeZonev.selectedIndex = 1; } if (StartingPeriod == "USD ($)") { TimePeriodNumber = 0; } else if (StartingPeriod == "AUD ($)") { TimePeriodNumber = 1; } else if (StartingPeriod == "BTC (Satoshi)") { TimePeriodNumber = 2; } //Set all lines from txt file into Array //Set Custonm Coins to data taken from the Array ProfileCoinsLoaded = File.ReadAllLines(@"C:\Users\" + Environment.UserName + @"\Documents\CryptoCentral\Profiles\" + Convert.ToString(Profile) + @"\Page" + PageNumber + ".txt"); coin1 = ProfileCoinsLoaded[0]; coin2 = ProfileCoinsLoaded[1]; coin3 = ProfileCoinsLoaded[2]; coin4 = ProfileCoinsLoaded[3]; coin5 = ProfileCoinsLoaded[4]; coin6 = ProfileCoinsLoaded[5]; coin7 = ProfileCoinsLoaded[6]; coin8 = ProfileCoinsLoaded[7]; coin9 = ProfileCoinsLoaded[8]; txtCustom01.Text = coin1; txtCustom02.Text = coin2; txtCustom03.Text = coin3; txtCustom04.Text = coin4; txtCustom05.Text = coin5; txtCustom06.Text = coin6; txtCustom07.Text = coin7; txtCustom08.Text = coin8; txtCustom09.Text = coin9; TestCoinSummary(); Reference.CryptoForm.GETINFOSummary(); ProfileLoaded = true; //Make sure program understands profile loaded successfully. } catch (Exception) { Reference.CryptoForm.lblSync.Text = "Saving Error"; Reference.CryptoForm.lblSync.Visible = true; } }