Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        private void MainWindow_Shown(object sender, EventArgs e)
        {
            // speeds up data grid view performance.
            typeof(DataGridView).InvokeMember("DoubleBuffered",
                                              BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, null, dgPrices,
                                              new object[] { true });
            typeof(DataGridView).InvokeMember("DoubleBuffered",
                                              BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, null, dgServices,
                                              new object[] { true });

            dgServices.AutoGenerateColumns = false;
            dgServices.DataSource          = new SortableBindingList <IService>(_engine.Services);

            dgPrices.AutoGenerateColumns = false;
            dgPrices.DataSource          = new SortableBindingList <PriceEntryBase>(_engine.PriceEntries);

            HideColumns();


            if (!_engine.DoDonationMinging)
            {
                textDonationStart.Enabled = false;
                textDonationEnd.Enabled   = false;
            }

            lblCurrencySymbol.Text = string.Empty; // Avoid flashing template value when starting

            if (!_engine.RemoteReceive)
            {
                tabPage.TabPages.Remove(tabRemote);
            }

            UpdateButtons();
            //RunCycle();
            _engine.CheckFees();
            _engine.CheckPrices();
            UpdateGrid(true);


            if (Program.MinimizeOnStart)
            {
                MinimizeWindow();
            }

            tmrPriceCheck.Enabled = true;
            tmrIdleCheck.Enabled  = true;
            if (!string.IsNullOrWhiteSpace(_engine.CurrencyCode))
            {
                tmrExchangeUpdate.Enabled = true;
            }
            if (Program.HasAutoStart)
            {
                _engine.MiningMode = MiningModeEnum.Automatic;
                UpdateButtons();
                RunBestAlgo();
            }

            if (_engine.ShowHistory)
            {
                InitHistoryChart();
            }
            else
            {
                tabHistory.Controls.Clear();
                tabPage.TabPages.Remove(tabHistory);
            }
        }