private void LoadPoolListFromWebsite() { //Set Path string filepath = Application.StartupPath + "\\app_assets\\pools.txt"; //Download doc from website try { WebClient webClient = new WebClient(); webClient.DownloadFile("http://liamthrower.com/pools.txt", filepath); } catch (Exception e) { messager.PushMessage(e.Message, true); } //Build Collection of pools PoolsCollection cAllPools = new PoolsCollection(); cAllPools.Load(); foreach (var citem in cAllPools) { cboPool.Items.Add(new PoolComboBoxItems(citem.iID.ToString(), citem.sDisplayName)); } //Force selected item in dropdown list and fire the onselected change event which sets some global vars cboPool.SelectedIndex = 0; }
private void pool_SelectedIndexChanged_1(object sender, EventArgs e) { PoolsCollection cPoolCollection = new PoolsCollection(); cPoolCollection.Load(); foreach (var cItem in cPoolCollection) { if (cItem.sDisplayName.Equals(cboPool.SelectedItem.ToString())) { m_MiningURL = cItem.sPoolMiningURL; m_PoolWebsiteURL = cItem.sPoolWebsite; m_IPoolID = cItem.iID; PushStatusMessage(cItem.sDisplayName + " selected, " + cItem.sPoolWebsite + " | " + cItem.sPoolInformation, m_bDoLog); break; } } }
private void LoadRegistryConfig() { PushStatusMessage("Loading ETNCRAFT config from registry", m_bDoLog); wallet_address.Text = registryManager.GetWalletId(); port.Text = registryManager.GetPortNumber(); chkAutoLoadConfig.Checked = registryManager.GetAutoLoad(); txtCustomPool.Text = registryManager.GetCustomPool(); cpuorgpu.SelectedItem = registryManager.GetComponent(); txtTempLimit.Text = CheckTempLimitEntry(registryManager.GetTempLimit()); m_iTemperatureAlert = int.Parse(txtTempLimit.Text); chkMaxUp.Checked = registryManager.GetEnforceMaxUpTime(); m_sScheduleData = registryManager.GetScheduleData(); if (m_dMaxUpTimeSec == 0.00) { maxUpTimeMin.Text = Convert.ToString(registryManager.GetMaxUpTimeMin()); } #region Get Pool and select drop down bool bFoundPool = false; //i know i know.... this is the wrong way to go about this. Just for quick testing of registry additions. Git blame Liam PoolsCollection cPools = new PoolsCollection(); cPools.Load(); if (cPools.Count > 0) { foreach (var Pool in cPools) { if (Pool.iID.Equals(registryManager.GetPool())) { int index = cboPool.FindString(Pool.sDisplayName); cboPool.SelectedIndex = index; m_IPoolID = Pool.iID; bFoundPool = true; break; } } } if (!bFoundPool) { PushStatusMessage("Saved pool no longer exists in our database", m_bDoLog); } #endregion }