Exemplo n.º 1
0
 public MainWindow()
 {
     InitializeComponent();
     using (GEOContext db = new GEOContext())
         Items.AddRange(db.ObjectItems.Include(oi => oi.Points).ToList());
     WindowState = WindowState.Maximized;
     ResizeMode  = ResizeMode.NoResize;
 }
Exemplo n.º 2
0
        private void SaveBtn_Click(object sender, RoutedEventArgs e)
        {
            ObjectItem item = new ObjectItem {
                Name = ObjectNameTB.Text
            };

            using (GEOContext db = new GEOContext())
            {
                Points.ForEach(p => p.ObjectItem = item);
                db.Points.AddRange(Points);
                db.ObjectItems.Add(item);
                db.SaveChanges();
                Items.Add(db.ObjectItems.Last());
            }
            this.DialogResult = true;
            this.Close();
        }