|
|
|
using BBWY.Client.APIServices;
|
|
|
|
using BBWY.Client.APIServices.QiKu;
|
|
|
|
using BBWY.Client.Models;
|
|
|
|
using BBWY.Client.Models.APIModel;
|
|
|
|
using BBWY.Controls;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Text;
|
|
|
|
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;
|
|
|
|
using WebSocketSharp;
|
|
|
|
|
|
|
|
namespace BBWY.Client.Views.SplitTask
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// SplitTaskWindow.xaml 的交互逻辑
|
|
|
|
/// </summary>
|
|
|
|
public partial class SplitTaskWindow : BWindow
|
|
|
|
{
|
|
|
|
public SplitTaskWindow(PackTaskService packTaskService, long taskId, TaskState abortTaskState, Action splitTask)
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
this.TaskId = taskId;
|
|
|
|
AbortTaskState = abortTaskState;
|
|
|
|
this.packTaskService = packTaskService;
|
|
|
|
SplitTask = splitTask;
|
|
|
|
|
|
|
|
this.DataContext = this;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Action SplitTask { get; set; }
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 任务挂起类型
|
|
|
|
/// </summary>
|
|
|
|
public TaskState AbortTaskState { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
PackTaskService packTaskService;
|
|
|
|
|
|
|
|
|
|
|
|
private long taskId;
|
|
|
|
/// <summary>
|
|
|
|
/// 任务id
|
|
|
|
/// </summary>
|
|
|
|
public long TaskId { get => taskId; set { Set(ref taskId, value); } }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int exceptionCount;
|
|
|
|
/// <summary>
|
|
|
|
/// 异常任务数
|
|
|
|
/// </summary>
|
|
|
|
public int ExceptionCount { get => exceptionCount; set { Set(ref exceptionCount, value); } }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void BButton_Click(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
var res = packTaskService.SplitPackTask(TaskId, ExceptionCount, AbortTaskState);
|
|
|
|
if (res == null || !res.Success)
|
|
|
|
{
|
|
|
|
MessageBox.Show(res?.Msg);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
SplitTask?.Invoke();
|
|
|
|
this.Close();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|