private void Refresh(string CFile) { MiningModeEnum originalMode = _engine.MiningMode; string service = "Manual"; string algo = string.Empty; int id = 0; MT = _engine.miningTime; if (_engine.CurrentPriceEntry != null) { service = _engine.CurrentPriceEntry.ServiceEntry.ServiceName; algo = _engine.CurrentPriceEntry.AlgoName; id = _engine.CurrentPriceEntry.Id; } _engine.RequestStop(); _engine.Cleanup(); _engine = new MiningEngine { WriteConsoleAction = WriteConsole, WriteRemoteAction = WriteRemote }; _appStartTime = DateTime.Now; if (!_engine.LoadConfig(CFile)) { MessageBox.Show("Something went wrong with reloading your configuration file. Check for errors.", "Error loading conf", MessageBoxButtons.OK, MessageBoxIcon.Error); } dgServices.DataSource = new SortableBindingList <IService>(_engine.Services); dgPrices.DataSource = new SortableBindingList <PriceEntryBase>(_engine.PriceEntries); _engine.MiningMode = originalMode; _engine.LoadExchangeRates(); UpdateButtons(); //RunCycle(); _engine.CheckFees(); _engine.CheckPrices(); UpdateGrid(); _engine._autoMiningTime = MT; InitHistoryChart(); if (originalMode == MiningModeEnum.Manual) { //_engine.RequestStart(service, algo, IsMinimizedToTray); _engine.RequestStart(id, IsMinimizedToTray); } }
private void btnReloadConfig_Click(object sender, EventArgs e) { MiningModeEnum originalMode = _engine.MiningMode; ServiceEnum service = ServiceEnum.Manual; string algo = string.Empty; if (_engine.CurrentPriceEntry != null) { service = _engine.CurrentPriceEntry.ServiceEntry.ServiceEnum; algo = _engine.CurrentPriceEntry.AlgoName; } _engine.Cleanup(); _engine = new MiningEngine { WriteConsoleAction = WriteConsole, WriteRemoteAction = WriteRemote }; if (!_engine.LoadConfig()) { MessageBox.Show("Something went wrong with reloading your configuration file. Check for errors.", "Error loading conf", MessageBoxButtons.OK, MessageBoxIcon.Error); } dgServices.DataSource = new SortableBindingList <IService>(_engine.Services); dgPrices.DataSource = new SortableBindingList <PriceEntryBase>(_engine.PriceEntries); _engine.MiningMode = originalMode; _engine.LoadExchangeRates(); RunCycle(); UpdateButtons(); UpdateGrid(); HistoryChart historyChart = tabHistory.Controls["historyChart"] as HistoryChart; if (historyChart != null) { historyChart.UpdateChart(); } if (originalMode == MiningModeEnum.Manual) { _engine.RequestStart(service, algo, IsMinimizedToTray); } }
private void btnReloadConfig_Click(object sender, EventArgs e) { MiningModeEnum originalMode = _engine.MiningMode; string service = "Manual"; string algo = string.Empty; if (_engine.CurrentPriceEntry != null) { service = _engine.CurrentPriceEntry.ServiceEntry.ServiceName; algo = _engine.CurrentPriceEntry.AlgoName; } _engine.RequestStop(); _engine.Cleanup(); _engine = new MiningEngine { WriteConsoleAction = WriteConsole, WriteRemoteAction = WriteRemote }; _appStartTime = DateTime.Now; if (!_engine.LoadConfig()) MessageBox.Show("Something went wrong with reloading your configuration file. Check for errors.", "Error loading conf", MessageBoxButtons.OK, MessageBoxIcon.Error); dgServices.DataSource = new SortableBindingList<IService>(_engine.Services); dgPrices.DataSource = new SortableBindingList<PriceEntryBase>(_engine.PriceEntries); _engine.MiningMode = originalMode; _engine.LoadExchangeRates(); RunCycle(); UpdateButtons(); UpdateGrid(); InitHistoryChart(); if (originalMode == MiningModeEnum.Manual) { _engine.RequestStart(service, algo, IsMinimizedToTray); } }