|
@ -65,14 +65,11 @@ namespace Signal_Generator |
|
|
if (currentTask == null) return "Запустить"; |
|
|
if (currentTask == null) return "Запустить"; |
|
|
switch (currentTask.state) |
|
|
switch (currentTask.state) |
|
|
{ |
|
|
{ |
|
|
case DrawTask.State.Created: |
|
|
|
|
|
return "Запустить"; |
|
|
|
|
|
case DrawTask.State.Running: |
|
|
case DrawTask.State.Running: |
|
|
return "Завершить"; |
|
|
|
|
|
case DrawTask.State.Paused: |
|
|
case DrawTask.State.Paused: |
|
|
goto case DrawTask.State.Running; |
|
|
return "Завершить"; |
|
|
default: |
|
|
default: |
|
|
goto case DrawTask.State.Created; |
|
|
return "Запустить"; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -81,14 +78,12 @@ namespace Signal_Generator |
|
|
if (currentTask == null) return new Tuple<bool, string>(false, "Пауза"); |
|
|
if (currentTask == null) return new Tuple<bool, string>(false, "Пауза"); |
|
|
switch (currentTask.state) |
|
|
switch (currentTask.state) |
|
|
{ |
|
|
{ |
|
|
case DrawTask.State.Created: |
|
|
|
|
|
return new Tuple<bool, string>(false, "Пауза"); |
|
|
|
|
|
case DrawTask.State.Running: |
|
|
case DrawTask.State.Running: |
|
|
return new Tuple<bool, string>(true, "Пауза"); |
|
|
return new Tuple<bool, string>(true, "Пауза"); |
|
|
case DrawTask.State.Paused: |
|
|
case DrawTask.State.Paused: |
|
|
return new Tuple<bool, string>(true, "Возобновить"); |
|
|
return new Tuple<bool, string>(true, "Возобновить"); |
|
|
default: |
|
|
default: |
|
|
goto case DrawTask.State.Created; |
|
|
return new Tuple<bool, string>(false, "Пауза"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -113,14 +108,13 @@ namespace Signal_Generator |
|
|
|
|
|
|
|
|
private void startOrCancelTask () |
|
|
private void startOrCancelTask () |
|
|
{ |
|
|
{ |
|
|
targetCanvas.Children.Clear(); |
|
|
|
|
|
if (currentTask != null) |
|
|
if (currentTask != null) |
|
|
switch (currentTask.state) |
|
|
switch (currentTask.state) |
|
|
{ |
|
|
{ |
|
|
case DrawTask.State.Paused: |
|
|
case DrawTask.State.Paused: |
|
|
goto case DrawTask.State.Running; |
|
|
|
|
|
case DrawTask.State.Running: |
|
|
case DrawTask.State.Running: |
|
|
currentTask.state = DrawTask.State.Canceled; |
|
|
currentTask.state = DrawTask.State.Canceled; |
|
|
|
|
|
targetCanvas.Children.Clear(); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
Action newAction = () => |
|
|
Action newAction = () => |
|
|