using OpenQA.Selenium.Remote;
using RuriLib.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace RuriLib.Runner
{
///
/// Bot class. Includes a Worker that is used to perform checks on input data in the Runner.
///
public class RunnerBotViewModel : ViewModelBase
{
private int id;
/// The unique id of the bot (usually between 1 and the total amount of Bots).
public int Id { get { return id; } set { id = value; OnPropertyChanged(); } }
private string data = "";
/// The data that needs to be checked.
public string Data { get { return data; } set { data = value; OnPropertyChanged(); } }
private string proxy = "";
/// The proxy that the Worker is using to perform requests.
public string Proxy { get { return proxy; } set { proxy = value; OnPropertyChanged(); } }
private string status = "";
/// The status of the bot.
public string Status { get { return status; } set { status = value; OnPropertyChanged(); } }
/// The Worker that performs the checks.
public AbortableBackgroundWorker Worker { get; set; }
/// The Selenium WebDriver.
public RemoteWebDriver Driver { get; set; } = null;
/// Whether the Selenium WebDriver is open or not.
public bool IsDriverOpen { get; set; } = false;
///
/// Creates an instance of a bot given an id.
///
/// The unique id that will be assigned to the bot.
public RunnerBotViewModel(int id)
{
Id = id;
Worker = new AbortableBackgroundWorker();
Worker.WorkerSupportsCancellation = true;
Worker.Id = id;
}
}
}