Автозаряд и авторазряд will do well.
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
||||
namespace charger_gui.operations
|
||||
{
|
||||
class AutomaticOperation
|
||||
{
|
||||
|
||||
private Thread workingThread;
|
||||
|
||||
public bool IsComplete
|
||||
{
|
||||
get
|
||||
{
|
||||
return workingThread == null || workingThread.IsAlive;
|
||||
}
|
||||
}
|
||||
|
||||
public event Action StatusChanged;
|
||||
public virtual string Status
|
||||
{
|
||||
get
|
||||
{
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
protected Logger log;
|
||||
protected MainWindowViewModel model;
|
||||
|
||||
public AutomaticOperation(Logger log, MainWindowViewModel model)
|
||||
{
|
||||
this.log = log;
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
workingThread = new Thread(Work);
|
||||
workingThread.Start();
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
if (workingThread != null)
|
||||
{
|
||||
workingThread.Abort();
|
||||
}
|
||||
}
|
||||
|
||||
protected void OnStatusChanged()
|
||||
{
|
||||
StatusChanged?.Invoke();
|
||||
}
|
||||
|
||||
protected virtual void Work()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user