private void AddEntry(LogEntry logEntry) { LogEntryControl logEntryControl = new LogEntryControl(logEntry); this.entriesPanel.Controls.Add(logEntryControl); //this.entriesPanel.Controls.SetChildIndex(logEntry, 0); //logEntry.Location = new System.Drawing.Point(3, 186); //logEntry.Name = "logEntry1"; logEntryControl.Size = new System.Drawing.Size(this.entriesPanel.Width - 30, 22); //logEntry.TabIndex = 0; }
private void SaveToFile() { List <LogEntry> entries = new List <LogEntry>(); foreach (var c in entriesPanel.Controls) { LogEntryControl entry = c as LogEntryControl; entries.Add(entry.LogEntry); } var xs = new XmlSerializer(entries.GetType()); var xml = new StringWriter(); xs.Serialize(xml, entries); File.WriteAllText("entries.xml", xml.ToString()); }