Exemplo n.º 1
0
        public MainFramesView(IEnumerable <CategoryModel> newCollection)
        {
            InitializeComponent();

            //collCategories = new ObservableCollection<CategoryModel>();

            _isNew  = true;
            Context = new OneDbContext(_isNew);

            Context.dbCategory.AddRange(newCollection);
            Context.SaveChanges();

            Context.dbCategory.Load();

            _windowDbView = new FrameDbView(Context.dbCategory.Local);
            this.MainFrame.NavigationService.Navigate(_windowDbView);
        }
Exemplo n.º 2
0
        public MainFramesView(string mdfFilename)
        {
            InitializeComponent();
            Context = new OneDbContext(mdfFilename);

            try
            {
                Context.dbCategory.Include(c => c.Keys).Include(c => c.S7Items).Include(c => c.Db).Load();
                Context.dbSymbolTableItem.Include(i => i.PeripheryCode).Load();
                var n = new SymbolTableItemModel();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Database load error: " + ex.Message.ToString());
            }

            _windowDbView = new FrameDbView(Context.dbCategory.Local);
            this.MainFrame.NavigationService.Navigate(_windowDbView);
        }
Exemplo n.º 3
0
        private void BtnDbCreateClick(object sender, RoutedEventArgs e)
        {
            //context.Database.Delete();
            //context.dbCategory.Load();
            //context.dbCategory.Include(c => c.DB);
            //collCategories = new ObservableCollection<CategoryModel>(context.dbCategory.Include(c => c.Keys).Include(c=>c.S7items));



            //foreach (CategoryModel mc in context.dbCategory)
            //{
            //    collCategories.Add(mc);
            //}

            Context.dbCategory.Include(c => c.Keys).Include(c => c.S7Items).Load();

            //ObservableCollection<DataBlockModel> dblist = new ObservableCollection<DataBlockModel>(context.dbDataBlock.ToList());

            _windowDbView = new FrameDbView(Context.dbCategory.Local);
            this.MainFrame.NavigationService.Navigate(_windowDbView);
        }