Пример #1
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            CryptoCoin knownCoin = null;
            if (coinCombo.SelectedIndex >= 0)
                knownCoin = filteredCoins[coinCombo.SelectedIndex];

            if (knownCoin == null)
            {
                CryptoCoin newCoin = new CryptoCoin();
                newCoin.Name = coinCombo.Text;
                newCoin.Algorithm = algoCombo.Text.ToAlgorithm();

                using (CoinEditForm coinEditForm = new CoinEditForm(newCoin))
                {
                    if (coinEditForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        SelectedCoin = newCoin;
                    else
                        DialogResult = System.Windows.Forms.DialogResult.Cancel;
                }
            }
            else
            {
                SelectedCoin = knownCoin;
            }
        }
Пример #2
0
        private Engine.Data.Configuration.Coin AddCoinConfiguration(CryptoCoin cryptoCoin)
        {
            //don't allow two configurations for the same coin symbol
            Engine.Data.Configuration.Coin configuration = configurations.SingleOrDefault(c => c.CryptoCoin.Symbol.Equals(cryptoCoin.Symbol, StringComparison.OrdinalIgnoreCase));
            if (configuration == null)
                //don't allow two configurations for the same coin name
                configuration = configurations.SingleOrDefault(c => c.CryptoCoin.Name.Equals(cryptoCoin.Name, StringComparison.OrdinalIgnoreCase));

            if (configuration != null)
            {
                coinListBox.SelectedIndex = configurations.IndexOf(configuration);
            }
            else
            {
                configuration = new Engine.Data.Configuration.Coin();

                configuration.CryptoCoin = knownCoins.SingleOrDefault(c => c.Symbol.Equals(cryptoCoin.Symbol, StringComparison.OrdinalIgnoreCase));

                //user may have manually entered a coin
                if (configuration.CryptoCoin == null)
                {
                    configuration.CryptoCoin = new CryptoCoin();
                    configuration.CryptoCoin.Name = cryptoCoin.Name;
                    configuration.CryptoCoin.Symbol = cryptoCoin.Symbol;
                    configuration.CryptoCoin.Algorithm = cryptoCoin.Algorithm;
                }

                MiningPool miningPool = new MiningPool()
                {
                    Host = "stratum+tcp://",
                    Port = 3333
                };
                configuration.Pools.Add(miningPool);

                configurations.Add(configuration);

                coinListBox.Items.Add(configuration.CryptoCoin.Name);
                coinListBox.SelectedIndex = configurations.IndexOf(configuration);
            }

            hostEdit.Focus();
            hostEdit.SelectionStart = hostEdit.SelectionLength;

            return configuration;
        }
Пример #3
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            CryptoCoin knownCoin = null;
            if (coinCombo.SelectedIndex >= 0)
                knownCoin = sortedCoins[coinCombo.SelectedIndex];
            
            if (knownCoin == null)
            {
                CryptoCoin newCoin = new CryptoCoin();
                newCoin.Name = coinCombo.Text;
                newCoin.Algorithm = Xgminer.Data.CoinAlgorithm.SHA256;

                CoinEditForm coinEditForm = new CoinEditForm(newCoin);
                if (coinEditForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    SelectedCoin = newCoin;
                else
                    DialogResult = System.Windows.Forms.DialogResult.Cancel;
            }
            else
            {
                SelectedCoin = knownCoin;
            }
        }
Пример #4
0
        public void GetApplicationModels(
            RemotingService sender,
            string clientAddress,
            string signature,
            out Data.Transfer.Device[] devices,
            out CryptoCoin[] configurations,
            out bool mining,
            out bool hasChanges,
            out bool dynamicIntensity)
        {
            ModelEventArgs ea = new ModelEventArgs();
            ea.IpAddress = clientAddress;
            ea.Signature = signature;

            if (GetModelRequested != null)
                GetModelRequested(sender, ea);

            devices = ea.Devices.ToArray();
            configurations = ea.ConfiguredCoins.ToArray();
            mining = ea.Mining;
            hasChanges = ea.HasChanges;
            dynamicIntensity = ea.DynamicIntensity;
        }
Пример #5
0
 public CoinEditForm(CryptoCoin cryptoCoin)
 {
     InitializeComponent();
     this.cryptoCoin = cryptoCoin;
 }
Пример #6
0
        private void EditCurrentCoin()
        {
            if (coinListBox.SelectedIndex == -1)
                return;

            Engine.Data.Configuration.Coin currentConfiguration = configurations[coinListBox.SelectedIndex];

            CryptoCoin workingCoin = new CryptoCoin();
            ObjectCopier.CopyObject(currentConfiguration.CryptoCoin, workingCoin);

            using (CoinEditForm coinEditForm = new CoinEditForm(workingCoin))
            {
                DialogResult dialogResult = coinEditForm.ShowDialog();

                if (dialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    if (configurations.SingleOrDefault(c => c.CryptoCoin.Symbol.Equals(workingCoin.Symbol, StringComparison.OrdinalIgnoreCase)) == null)
                    {
                        ObjectCopier.CopyObject(workingCoin, currentConfiguration.CryptoCoin);
                        coinListBox.Items[coinListBox.SelectedIndex] = workingCoin.Name;
                    }
                    else
                    {
                        //don't create a dupe
                        MessageBox.Show(String.Format("A configuration for {0} already exists.", workingCoin.Symbol),
                            "Duplicate Configuration", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }
Пример #7
0
 public Device()
 {
     Workers = new List<Device>();
     Coin = new CryptoCoin();
 }
Пример #8
0
        private void EditCurrentCoin()
        {
            if (coinListBox.SelectedIndex == -1)
                return;

            Engine.Data.Configuration.Coin currentConfiguration = configurations[coinListBox.SelectedIndex];

            CryptoCoin workingCoin = new CryptoCoin();
            ObjectCopier.CopyObject(currentConfiguration.CryptoCoin, workingCoin);

            using (CoinEditForm coinEditForm = new CoinEditForm(workingCoin))
            {
                DialogResult dialogResult = coinEditForm.ShowDialog();
                if (dialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    ObjectCopier.CopyObject(workingCoin, currentConfiguration.CryptoCoin);
                    coinListBox.Items[coinListBox.SelectedIndex] = workingCoin.Name;
                }
            }
        }