/// <summary> /// Reads Xml when the <see cref="Labels">Labels</see> is to be deserialized /// from a stream.</summary> /// <param name="reader">The stream from which the object will be deserialized.</param> void System.Xml.Serialization.IXmlSerializable.ReadXml(System.Xml.XmlReader reader) { // Advance until the first Label node is recognized. if (!reader.IsEmptyElement) { while (reader.Read()) { if (reader.NodeType == System.Xml.XmlNodeType.EndElement) { reader.Read(); break; } // Found a Label node. Deserialize it into a new Label object. Label label = new Label(); ((IXmlSerializable)label).ReadXml(reader); _labels.Add(label); // Move to the next node. reader.Read(); } } else // The reader is empty. Advance to the next node in anticipation // of finding a Textboxes node. reader.Read(); }
/// <summary> /// Adds a <see cref="Label">Label</see> object to the /// <see cref="Labels">Labels</see> collection.</summary> /// <param name="l"><see cref="Label">Label</see> object to add to the collection.</param> public void Add(Label l) { _labels.Add(l); }
public LoginForm(int width, int height, string name) : base(width, height) { Name = name; Label lblTitle = new Label("lblTitle", new Point(1, 2), 10, "Login", ConsoleColor.Green, ConsoleColor.Black); Label lblserver = new Label("lblserver", new Point(1, 10), 28, "server", ConsoleColor.Green, ConsoleColor.Black); Label lblUsername = new Label("lbluname", new Point(1, 12), 10, "Username", ConsoleColor.Green, ConsoleColor.Black); Label lblPass = new Label("lblpass", new Point(1, 14), 10, "Password", ConsoleColor.Green, ConsoleColor.Black); Textbox txtServer = new Textbox("txtServer", new Point(12, 10), 30, string.Empty, ConsoleColor.White, ConsoleColor.DarkGray); Textbox txtUser = new Textbox("txtUser", new Point(12, 12), 30, string.Empty, ConsoleColor.White, ConsoleColor.DarkGray); Textbox txtPassword = new Textbox("txtPass", new Point(12, 14), 30, string.Empty, ConsoleColor.White, ConsoleColor.DarkGray) { PasswordChar = '*' }; Add(lblTitle); Add(lblTitle); Add(lblserver); Add(lblUsername); Add(lblPass); Add(txtServer); Add(txtUser); Add(txtPassword); }