MinerControl
MinerControl copied to clipboard
timers
When you start one single algo, the timers in the grids (both "running" columns) are updated only if you click on one cell of the grid.
Edit: Just found that with the single algo start the "restart" countdown, after it reach 0, doesn't get reset to -3 hours and it continues to count up.
Another nice thing would be that when a new miner starts the console get cleared.
Great prog anyway.
Fixed the problem adding a new function in miningengine.cs
public void RunAlgo(bool isMinimizedToTray)
{
try
{
// Check for dead process
if (!_process.IsRunning() && _currentRunning != null)
{
lock (this)
{
_currentRunning.DeadTime = DateTime.Now;
LogActivity(_donationMiningMode == MiningModeEnum.Donation ? "DonationDead" : "Dead");
WriteConsole(string.Format("Dead {0} {1}", _currentRunning.ServicePrint, _currentRunning.Name), true);
RecordMiningTime();
}
}
// Clear information if process not running
if (_process == null || _process.HasExited)
{
_currentRunning = null;
_startMining = null;
_nextRun = null;
_nextRunFromTime = null;
}
// Restart miner if max time reached
if (RestartTime.HasValue && RestartTime.Value <= TimeSpan.Zero)
{
var tmp = _currentRunning;
StopMiner();
StartMiner(tmp, isMinimizedToTray);
}
// Update undead entries
var entries = PriceEntries.Where(o => !o.IsDead && o.DeadTime != DateTime.MinValue);
foreach (var entry in entries)
entry.DeadTime = DateTime.MinValue;
// Just update time if we are already running the right entry
if (_currentRunning != null)
_currentRunning.UpdateStatus();
}
catch (Exception ex)
{
ErrorLogger.Log(ex);
}
}
and changing tmrTimeUpdate_Tick in MainWindow.cs to
private void tmrTimeUpdate_Tick(object sender, EventArgs e)
{
UpdateTimes();
if (_engine.PricesUpdated)
{
UpdateGrid();
_engine.PricesUpdated = false;
}
var autoModes = new[] { MiningModeEnum.Automatic, MiningModeEnum.Donation };
if (!autoModes.Contains(_engine.MiningMode))
_engine.RunAlgo(IsMinimizedToTray);
else
RunBestAlgo();
}