public static Conclusion WaitForShellCycle(Tasker tasker, Object syncObject = null) { var hostForm = tasker.GetSpecificViews <Form>().FirstOrDefault(); if (hostForm == default(Form)) { hostForm = tasker.HostForm; } if (hostForm.InvokeRequired) { return((Conclusion)hostForm.Invoke(new Func <Tasker, object, Conclusion>(WaitForShellCycle), new object[] { tasker, syncObject })); } tasker.SetStatus(Resources.WaitingForDevice); tasker.PushState(State.Waiting); var result = WaitingShellCycleForm.WaitForDevice(hostForm, MembootWaitDelay); tasker.PopState(); if (result == DialogResult.OK) { return(Conclusion.Success); } return(Conclusion.Abort); }
public static Conclusion WaitForShellCycle(Tasker tasker, Object syncObject = null, int maxWaitTime = -1, string title = null, string message = null) { var hostForm = tasker.GetSpecificViews <Form>().FirstOrDefault(); if (hostForm == default(Form)) { hostForm = tasker.HostForm; } if (hostForm.InvokeRequired) { return((Conclusion)hostForm.Invoke(new Func <Tasker, object, int, string, string, Conclusion>(WaitForShellCycle), new object[] { tasker, syncObject, maxWaitTime, title, message })); } tasker.SetStatus(Resources.WaitingForDevice); tasker.PushState(State.Waiting); var result = WaitingShellCycleForm.WaitForDevice(hostForm, maxWaitTime == -1 ? MembootWaitDelay : maxWaitTime); tasker.PopState(); if (result == DialogResult.OK) { return(Conclusion.Success); } else if (result == DialogResult.No) { MessageForm.Show(hostForm, title == null ? Resources.WaitingForDevice : title, message == null ? Resources.WaitingForDeviceTakingALongTime : message, Resources.sign_clock); } return(Conclusion.Abort); }
public static Conclusion WaitForShellCycle(Tasker tasker, Object syncObject = null) { if (tasker.HostForm.InvokeRequired) { return((Conclusion)tasker.HostForm.Invoke(new Func <Tasker, object, Conclusion>(WaitForShellCycle), new object[] { tasker, syncObject })); } tasker.SetStatus(Resources.WaitingForDevice); tasker.PushState(State.Waiting); var result = WaitingShellCycleForm.WaitForDevice(tasker.HostForm, MembootWaitDelay); tasker.PopState(); if (result == DialogResult.OK) { return(Conclusion.Success); } return(Conclusion.Abort); }