// constructor for new screen public ScreenInfo(string n, int index, int x, int y, int width, int height, double opacity) { name = n; screen_index = index; show_form = false; enabled = false; // check (0 <= opacity <= MAX_OPACITY) if (opacity > MAX_OPACITY) { opacity = MAX_OPACITY; } else if (opacity < 0) { opacity = 0; } form = new TranslucentForm(x, y, width, height, opacity); form.Hide(); }
// // </ATTRIBUTES AND CONSTANTS> // // // <CONSTRUCTORS> // // constructor for when xml file is found public ScreenInfo(XElement screen) { name = screen.Element("name").Value; int originX = Int32.Parse(screen.Element("originX").Value); int originY = Int32.Parse(screen.Element("originY").Value); int resX = Int32.Parse(screen.Element("resX").Value); int resY = Int32.Parse(screen.Element("resY").Value); double opacity = Double.Parse(screen.Element("opacity").Value); screen_index = Int32.Parse(screen.Element("index").Value); show_form = false; enabled = false; // check for values that are not too large or too small bool originXcheck = originX <MIN_ORIGINX || originX> MAX_ORIGINX; bool originYcheck = originY <MIN_ORIGINY || originY> MAX_ORIGINY; bool resXcheck = resX <MIN_RES || resX> MAX_RES; bool resYcheck = resY <MIN_RES || resY> MAX_RES; if (originXcheck || originYcheck || resXcheck || resYcheck) { throw new ArgumentOutOfRangeException(); } // check (0 <= opacity <= MAX_OPACITY) if (opacity > MAX_OPACITY) { opacity = MAX_OPACITY; } else if (opacity < 0) { opacity = 0; } form = new TranslucentForm(originX, originY, resX, resY, opacity); form.Hide(); }
// // </CONSTRUCTORS> // // // <INTERFACE> // public void Destroy() { form.Close(); form = null; }