private void userNameCombo_SelectedIndexChanged(object sender, EventArgs e) { MiningPool currentPool = (MiningPool)miningPoolBindingSource.Current; if (currentPool == null) { return; } //if the password is blank if (String.IsNullOrEmpty(currentPool.Password)) { //and a workername is selected if (userNameCombo.SelectedItem != null) { string workerName = (string)userNameCombo.SelectedItem; LiquidHash.Engine.Data.Configuration.Coin configuration = configurations .FirstOrDefault(c => c.Pools.Any(p => p.Username.Equals(workerName))); //default to the password used for the same worker on another config if (configuration != null) { currentPool.Password = configuration.Pools.First(p => p.Username.Equals(workerName)).Password; } } } }
private void copyCoinButton_Click(object sender, EventArgs e) { CoinChooseForm coinChooseForm = new CoinChooseForm(knownCoins); DialogResult dialogResult = coinChooseForm.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { PoolGroup destinationCoin = coinChooseForm.SelectedCoin; Engine.Data.Configuration.Coin sourceConfiguration = configurations[coinListBox.SelectedIndex]; LiquidHash.Engine.Data.Configuration.Coin destinationConfiguration = AddCoinConfiguration(destinationCoin); ObjectCopier.CopyObject(sourceConfiguration, destinationConfiguration, "CryptoCoin"); BindToCurrentConfiguration(); coinConfigurationBindingSource.ResetBindings(false); miningPoolBindingSource.ResetBindings(false); } }