using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel.Composition;
using Microsoft.WebAnalytics;
using System.Diagnostics;

namespace Analytics
{
    public class DataObject
    {
        public string Name { get; set; }
        public int Age { get; set; }
        public string Description { get; set; }

        public override string ToString()
        {
            return Name + ", " + Age + ", " + Description;
        }
    }

    public partial class MainPage : UserControl
    {
        [Import]
        public WebAnalyticsEvents Events { get; set; }

        public MainPage()
        {
            InitializeComponent();
            CompositionInitializer.SatisfyImports(this);
            Events.TrackEvent += (s, e) =>
            {
                events.Items.Insert(0, e.AnalyticsEvent);
            };
            dataGrid.ItemsSource = new[] { new DataObject { Name = "Data 1" }, new DataObject { Name = "Data 2" } };
        }
    }
}
