добавили форму истории
This commit is contained in:
parent
face9ba963
commit
adf1401a26
|
|
@ -13,11 +13,13 @@ namespace Reseter2
|
|||
public long Ping { get; set; }
|
||||
public int TimeoutPing { get; set; }
|
||||
public IPAddress Ip;
|
||||
public PingResult(long ping, int timeoutPing, IPAddress ip)
|
||||
public bool TimedOut;
|
||||
public PingResult(long ping, int timeoutPing, IPAddress ip, bool timedOut)
|
||||
{
|
||||
Ping = ping;
|
||||
TimeoutPing = timeoutPing;
|
||||
TimeoutPing = timeoutPing;
|
||||
Ip = ip;
|
||||
TimedOut = timedOut;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace Reseter2
|
|||
}
|
||||
}
|
||||
if (pingable) TimeoutCount++;
|
||||
return new PingResult(ping, TimeoutCount, Ip);
|
||||
return new PingResult(ping, TimeoutCount, Ip, pingable);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,17 @@ namespace Reseter2
|
|||
if (task.IsCompleted){
|
||||
//this.DataContrl(Ping().ToString(), Timeout().ToString());
|
||||
pingResult = await task;
|
||||
taskControl.DataContrl(pingResult.Ping.ToString() + "ms", pingResult.TimeoutPing.ToString(), pingResult.Ip, sw.Elapsed);
|
||||
|
||||
string p;
|
||||
if (pingResult.TimedOut)
|
||||
{
|
||||
p = "----";
|
||||
}
|
||||
else
|
||||
{
|
||||
p = pingResult.Ping.ToString() + "ms";
|
||||
}
|
||||
taskControl.DataContrl(p, pingResult.TimeoutPing.ToString(), pingResult.Ip, sw.Elapsed);
|
||||
StatusTask.Next();
|
||||
task = Task.Run(StatusTask.Tick);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using System.Diagnostics;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Reseter2
|
||||
{
|
||||
|
|
@ -17,7 +18,8 @@ namespace Reseter2
|
|||
{
|
||||
if (param.Length > 0)
|
||||
{
|
||||
StartShutDown("-r -m \\\\" + param + "-f -t 5");
|
||||
MessageBox.Show(@"-r -m \\" + param + " -f -t 5");
|
||||
StartShutDown(@"-r -m \\" + param + " -f -t 5");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,11 +10,12 @@ namespace Reseter2
|
|||
internal class StatusReboot : AStatusTask
|
||||
{
|
||||
private int TimeCount;
|
||||
private PingResult PingResult = new PingResult(0, 0, null);
|
||||
|
||||
private PingResult PingResult = new PingResult(0, 0, null, false);
|
||||
public StatusReboot(ReseterTask reseterTask) : base(reseterTask)
|
||||
{
|
||||
resetertask.SetNameStage("Отправляем команду перезагрузки");
|
||||
//Shutdown.RestartPC(reseterTask.Comp.GetName());
|
||||
Shutdown.RestartPC(reseterTask.Comp.GetResetName());
|
||||
}
|
||||
|
||||
public override Task<PingResult> Tick()
|
||||
|
|
@ -24,11 +25,11 @@ namespace Reseter2
|
|||
}
|
||||
public override void Next()
|
||||
{
|
||||
if (PingResult.Ping == 0)
|
||||
if (PingResult.TimedOut == true)
|
||||
{
|
||||
TimeCount++;
|
||||
}
|
||||
if (TimeCount > 2)
|
||||
if (TimeCount > 3)
|
||||
{
|
||||
resetertask.StatusTask = new StatusRebooting(resetertask);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Reseter2
|
|||
internal class StatusRebooting : AStatusTask
|
||||
{
|
||||
private int TimeCount;
|
||||
private PingResult PingResult = new PingResult(0, 0, null);
|
||||
private PingResult PingResult = new PingResult(0, 0, null, false);
|
||||
public StatusRebooting(ReseterTask reseterTask) : base(reseterTask)
|
||||
{
|
||||
resetertask.SetNameStage("Перезагрузка");
|
||||
|
|
@ -23,13 +23,13 @@ namespace Reseter2
|
|||
}
|
||||
public override void Next()
|
||||
{
|
||||
if (PingResult.Ping > 0)
|
||||
if (PingResult.TimedOut == false)
|
||||
{
|
||||
TimeCount++;
|
||||
}
|
||||
if (TimeCount > 10)
|
||||
if (TimeCount > 50)
|
||||
{
|
||||
resetertask.StatusTask = new StatusPreReboot(resetertask);
|
||||
resetertask.StatusTask = new StatusRebootSucces(resetertask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Reseter2
|
|||
internal class StatusPreReboot : AStatusTask
|
||||
{
|
||||
private int time;
|
||||
private PingResult PingResult = new PingResult(0,0,null);
|
||||
private PingResult PingResult = new PingResult(0,0,null, false);
|
||||
public StatusPreReboot(ReseterTask reseterTask) : base(reseterTask)
|
||||
{
|
||||
resetertask.SetNameStage("Проверка связи");
|
||||
|
|
@ -26,13 +26,11 @@ namespace Reseter2
|
|||
}
|
||||
public override void Next()
|
||||
{
|
||||
if (PingResult.Ping != null)
|
||||
{
|
||||
if (PingResult.Ping > 0)
|
||||
if (!PingResult.TimedOut)
|
||||
{
|
||||
resetertask.StatusTask = new StatusReboot(resetertask);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue