using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.IO;
using System.Text.RegularExpressions;
using ZennoLab.CommandCenter;
using ZennoLab.InterfacesLibrary;
using ZennoLab.InterfacesLibrary.ProjectModel;
using ZennoLab.InterfacesLibrary.ProjectModel.Collections;
using ZennoLab.InterfacesLibrary.ProjectModel.Enums;
using ZennoLab.Macros;
using Global.ZennoExtensions;
using ZennoLab.Emulation;
using ZennoLab.CommandCenter.TouchEvents;
using ZennoLab.CommandCenter.FullEmulation;
using ZennoLab.InterfacesLibrary.Enums;
namespace ZennoLab.OwnCode
{
/// <summary>
/// A simple class of the common code
/// </summary>
public class CommonCode
{
/// <summary>
/// Lock this object to mark part of code for single thread execution
/// </summary>
public static object SyncObject = new object();
[ThreadStatic] public static Random r = new Random();
// Insert your code here
}
public static class HelperExtension
{
/// <summary>
/// Эмулируем чтение текста
/// </summary>
/// <param name="tab"></param>
/// <param name="time">Сколько секунд будем читать</param>
public static void Read(this Tab tab, int time)
{
DateTime start = DateTime.Now.AddSeconds(time);
while(start > DateTime.Now)
{
HtmlElementCollection zag1 = tab.FindElementsByXPath("//h1");
HtmlElementCollection zag2 = tab.FindElementsByXPath("//h2");
HtmlElementCollection paragraph = tab.FindElementsByXPath("//p");
HtmlElementCollection bolt = tab.FindElementsByXPath("//b");
foreach(var z in zag1)
{
tab.FullEmulationMouseMoveAboveHtmlElement(z, ZennoLab.OwnCode.CommonCode.r.Next(10,20));
if(start < DateTime.Now) return;
}
foreach(var z in zag2)
{
tab.FullEmulationMouseMoveAboveHtmlElement(z, ZennoLab.OwnCode.CommonCode.r.Next(10,20));
if(start < DateTime.Now) return;
}
foreach(var z in paragraph)
{
tab.FullEmulationMouseMoveAboveHtmlElement(z, ZennoLab.OwnCode.CommonCode.r.Next(10,20));
if(start < DateTime.Now) return;
}
foreach(var z in bolt)
{
tab.FullEmulationMouseMoveAboveHtmlElement(z, ZennoLab.OwnCode.CommonCode.r.Next(10,20));
if(start < DateTime.Now) return;
}
}
}
}
}