Beispiel #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;
 }
Beispiel #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();
        }