Esempio n. 1
0
        private void ConfigureSettingsLocally()
        {
            bool oldNetworkDeviceDetection = applicationConfiguration.NetworkDeviceDetection;
            bool oldCoinWarzValue = applicationConfiguration.UseCoinWarzApi;
            string oldCoinWarzKey = applicationConfiguration.CoinWarzApiKey;

            string oldConfigPath = pathConfiguration.SharedConfigPath;

            SettingsForm settingsForm = new SettingsForm(
                applicationConfiguration,
                engineConfiguration.XgminerConfiguration,
                pathConfiguration,
                perksConfiguration);

            DialogResult dialogResult = settingsForm.ShowDialog();

            if (dialogResult == System.Windows.Forms.DialogResult.OK)
            {
                System.Windows.Forms.Application.DoEvents();

                pathConfiguration.SavePathConfiguration();

                //save settings as the "shared" config path may have changed
                //these are settings not considered machine/device-specific
                //e.g. no device settings, no miner settings
                string newConfigPath = pathConfiguration.SharedConfigPath;
                MigrateSettingsToNewFolder(oldConfigPath, newConfigPath);

                applicationConfiguration.SaveApplicationConfiguration(newConfigPath);
                perksConfiguration.SavePerksConfiguration(newConfigPath);
                engineConfiguration.SaveCoinConfigurations(newConfigPath);
                engineConfiguration.SaveStrategyConfiguration(newConfigPath);
                engineConfiguration.SaveMinerConfiguration();
                SaveKnownCoinsToFile();

                //don't refresh coin stats excessively
                if ((oldCoinWarzValue != applicationConfiguration.UseCoinWarzApi) ||
                    !oldCoinWarzKey.Equals(applicationConfiguration.CoinWarzApiKey))
                    RefreshCoinStats();

                //if we are not detecting Network Devices, start the async checks
                if (applicationConfiguration.NetworkDeviceDetection &&
                    (!oldNetworkDeviceDetection))
                {
                    CheckNetworkDevicesAsync();
                    FindNetworkDevicesAsync();
                }

                SubmitMobileMinerPools();

                RefreshViewForConfigurationChanges();
                RefreshListViewFromViewModel();
            }
            else
            {
                engineConfiguration.LoadMinerConfiguration();
                pathConfiguration.LoadPathConfiguration();
                applicationConfiguration.LoadApplicationConfiguration(pathConfiguration.SharedConfigPath);
            }
        }
Esempio n. 2
0
        private void ConfigureSettingsRemotely()
        {
            Data.Configuration.Application workingApplicationConfiguration = new Data.Configuration.Application();
            Engine.Data.Configuration.Engine workingEngineConfiguration = new Engine.Data.Configuration.Engine();
            Paths workingPathConfiguration = new Paths();
            Perks workingPerksConfiguration = new Perks();

            GetRemoteApplicationConfiguration(this.selectedRemoteInstance);

            ObjectCopier.CopyObject(this.remoteApplicationConfig.ToModelObject(), workingApplicationConfiguration);
            ObjectCopier.CopyObject(this.remoteEngineConfig.ToModelObject(), workingEngineConfiguration);
            ObjectCopier.CopyObject(this.remotePathConfig, workingPathConfiguration);
            ObjectCopier.CopyObject(this.remotePerksConfig, workingPerksConfiguration);

            SettingsForm settingsForm = new SettingsForm(
                workingApplicationConfiguration,
                workingEngineConfiguration.XgminerConfiguration,
                workingPathConfiguration,
                workingPerksConfiguration);

            settingsForm.Text = String.Format("{0}: {1}", settingsForm.Text, this.selectedRemoteInstance.MachineName);
            DialogResult dialogResult = settingsForm.ShowDialog();

            if (dialogResult == System.Windows.Forms.DialogResult.OK)
            {
                ObjectCopier.CopyObject(workingApplicationConfiguration.ToTransferObject(), this.remoteApplicationConfig);
                ObjectCopier.CopyObject(workingEngineConfiguration.ToTransferObject(), this.remoteEngineConfig);
                ObjectCopier.CopyObject(workingPathConfiguration, this.remotePathConfig);
                ObjectCopier.CopyObject(workingPerksConfiguration, this.remotePerksConfig);

                SetConfigurationRemotely(this.selectedRemoteInstance, this.remoteApplicationConfig, this.remoteEngineConfig, this.remotePathConfig, null);
            }
        }
Esempio n. 3
0
        private void HandleConfigureSettings(object sender, ConfigurationEventArgs e)
        {
            SettingsForm settingsForm = new SettingsForm(e.Application, e.Engine.XgminerConfiguration, e.Paths, e.Perks);
            if (app.SelectedRemoteInstance != null)
                settingsForm.Text = String.Format("{0}: {1}", settingsForm.Text, app.SelectedRemoteInstance.MachineName);

            e.ConfigurationModified = settingsForm.ShowDialog() == DialogResult.OK;
        }