Exemplo n.º 1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Curling = new CurlingContext();
            Curling.Teams.Load();
            Curling.Players.Load();
            teamGrid.ItemsSource   = Curling.Teams.Local.ToBindingList();
            playerGrid.ItemsSource = Curling.Players.Local.ToBindingList();

            this.Closing += MainWindow_Closing;
        }
Exemplo n.º 2
0
 public MainWindow()
 {
     using (CurlingContext db = new CurlingContext())
     {
         var sweden = new Team()
         {
             Country = "Sweden", Points = 89020, Rating = 1
         };
         var canada = new Team()
         {
             Country = "Canada", Points = 75980, Rating = 2
         };
         var usa = new Team()
         {
             Country = "Usa", Points = 71029, Rating = 3
         };
         var switzerland = new Team()
         {
             Country = "Switzerland", Points = 65196, Rating = 4
         };
         var schotland = new Team()
         {
             Country = "Schotland", Points = 52059, Rating = 5
         };
         db.Teams.AddRange(new List <Team>()
         {
             sweden, canada, usa, switzerland, schotland
         });
         var nicklas = new Player()
         {
             Name = "Nicklas Edin", Age = 35, Team = sweden
         };
         var oscar = new Player()
         {
             Name = "Oscar Ericsson", Age = 35, Team = sweden
         };
         var john = new Player()
         {
             Name = "John Shooster", Age = 35, Team = sweden
         };
         var rasmus = new Player()
         {
             Name = "Rasmus Vrano", Age = 35, Team = canada
         };
         var matt = new Player()
         {
             Name = "Matt Hamilton", Age = 35, Team = canada
         };
         var kevin = new Player()
         {
             Name = "Kevin Koe", Age = 35, Team = usa
         };
         var colton = new Player()
         {
             Name = "Colton Flash", Age = 35, Team = usa
         };
         var sven = new Player()
         {
             Name = "Sven Mishelle", Age = 35, Team = switzerland
         };
         var peter = new Player()
         {
             Name = "Peter de Cruz", Age = 35, Team = switzerland
         };
         var grant = new Player()
         {
             Name = "Grant Hardi", Age = 35, Team = schotland
         };
         var bobby = new Player()
         {
             Name = "Bobby Lemmi", Age = 35, Team = schotland
         };
         db.Players.AddRange(new List <Player>()
         {
             nicklas, oscar, john, rasmus, matt, kevin, colton, sven, peter, grant, bobby
         });
         db.Games.Add(new Game()
         {
             Place = "Torronto", Date = "2020/01/01", Team1 = sweden, Team2 = canada, Winner = sweden
         });
         db.SaveChanges();
     }
     InitializeComponent();
 }