You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.1 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace Signal_Generator
{
/// <summary>
/// Логика взаимодействия для TaskWindow.xaml
/// </summary>
///
public partial class TaskWindow : Window
{
MultiSignal currentMultiSignal;
DrawTask currentTask;
public TaskWindow(MultiSignal s)
{
InitializeComponent();
currentMultiSignal = s;
}
private void start_Button_Click(object sender, RoutedEventArgs e)
{
signalGraph_Canvas.Children.Clear();
if (currentTask != null)
switch (currentTask.dStatus)
{
case DrawTask.DStatus.Paused:
goto case DrawTask.DStatus.Running;
case DrawTask.DStatus.Running:
currentTask.dStatus = DrawTask.DStatus.Canceled;
break;
}
Action newAction = () =>
{
currentTask.buildTask(currentMultiSignal, signalGraph_Canvas);
};
currentTask = new DrawTask(newAction);
currentTask.Start();
}
private void pause_Button_Click(object sender, RoutedEventArgs e)
{
switch (currentTask.dStatus) {
case DrawTask.DStatus.Paused:
currentTask.dStatus = DrawTask.DStatus.Running;
pause_Button.Content = "Приостановить";
break;
case DrawTask.DStatus.Running:
currentTask.dStatus = DrawTask.DStatus.Paused;
pause_Button.Content = "Возобновить";
break;
}
}
}
}