public Manager() { Users = new List <User>(); ColorList = LoadColorList(); SessionID = Path.GetRandomFileName(); // State = STATE_INPUT; System.Threading.Timer t = new System.Threading.Timer( delegate { for (int i = Users.Count - 1; i >= 0; i--) { if (Users[i].Timeout) { lock (Users) { try { Users.RemoveAt(i); } catch {} } } } if (Users.Count == 0) { // State = STATE_INPUT; } }, null, 2000, 2000); }
public ColorCoresp LoadColorList() { ColorCoresp sts = new ColorCoresp(); XmlSerializer xml = new XmlSerializer(typeof(ColorCoresp)); StreamReader sr = null; try { sr = new StreamReader(ApplicationLocation.StartupPath + "\\" + "ColorList.xml"); sts = (ColorCoresp)xml.Deserialize(sr); } catch { if (sr != null) { sr.Close(); } return(sts); } if (sr != null) { sr.Close(); } return(sts); }