using System; using System.Collections.Generic; using System.Text; using System.Drawing; using System.Globalization; namespace AnotoData { public class AnotoRadarScreen : AnotoHotArea { CultureInfo ci = new CultureInfo("en-US"); public AnotoRadarScreen() { this.Category = Categories.Screen; this.PageIndex = -1; //Multi pages LastX = -1; LastY = -1; LastPage = ""; } public override bool IsInside(int x, int y, string page) { if ((page == "1728.0.0.8") || (page == "1728.0.0.9")) return true; return false; } private int LastX = -1; private int LastY = -1; private string LastPage = ""; public void SendIvyMsg(string penSerial, int x, int y, string page, IvyBus.IvyControl TheIvyBus) { if ((LastX != x) || (LastY != y) || (LastPage != page)) { //Normalize the data PointF ptN = GetNormilizedCoordinate(x, y, page); TheIvyBus.SendMsg("RadarScreenPenDown PenId=" + penSerial + " X=" + ptN.X.ToString(ci) + " Y=" + ptN.Y.ToString(ci)); LastX = x; LastY = y; LastPage = page; } } public PointF GetNormilizedCoordinate(int x, int y, string page) { float yn = (float)y / (float)AnotoHotArea.MaxY; float xn = (float)x / (float)AnotoHotArea.MaxX / 2.0f; if (page == "1728.0.0.9") xn += 0.5f; return new PointF(xn, yn); } } }