Beispiel #1
0
        private void saveSwag_Click(object sender, EventArgs e)
        {
            var swags = SwagCollection.Create();

            foreach (DataGridViewRow swagRow in swagGrid.Rows)
            {
                if (swagRow.Cells[0].Value != null && swagRow.Cells[1].Value != null)
                {
                    swags.Add(new Swag {
                        Company = swagRow.Cells[0].Value.ToString(), Thing = swagRow.Cells[1].Value.ToString()
                    });
                }
            }
            using (var fs = File.Open(GetPathFor("Swag.xml"), FileMode.Truncate, FileAccess.Write))
            {
                new XmlSerializer(typeof(SwagCollection)).Serialize(fs, swags);
            }
        }
Beispiel #2
0
        private void configForm_Load(object sender, EventArgs e)
        {
            var swags = SwagCollection.Load(GetPathFor("Swag.xml"));

            foreach (var swag in swags)
            {
                var newRow = new DataGridViewRow();
                newRow.Cells.Add(new DataGridViewTextBoxCell {
                    Value = swag.Company
                });
                newRow.Cells.Add(new DataGridViewTextBoxCell {
                    Value = swag.Thing
                });
                swagGrid.Rows.Add(newRow);
            }

            var people = AttendeeCollection.Load(GetPathFor("Attendees.xml"));

            foreach (var person in people)
            {
                textBox1.AppendText(person.Name + Environment.NewLine);
            }
        }
Beispiel #3
0
 protected override IThingCollection <SwagBase> GetCollection()
 {
     return(SwagCollection.Create());
 }
Beispiel #4
0
 protected override IList <SwagBase> LoadThings(string thingLocation)
 {
     return(SwagCollection.Load(thingLocation));
 }