Пример #1
0
        public MainWindow()
        {
            InitializeComponent();

            var recentPoem = new LorryContext();

            recentPoem.Recent.Load();
            uxRecentPoem.DataContext = recentPoem.Recent.Local.ToObservableCollection();
        }
Пример #2
0
        public CoupletWindow()
        {
            InitializeComponent();

            var coupletContext = new LorryContext();

            coupletContext.Couplet.Load();

            uxList.ItemsSource = coupletContext.Couplet.Local.ToObservableCollection();
        }
Пример #3
0
        public void uxGenerateCouplet_Click(object sender, RoutedEventArgs e)
        {
            var coupletContext = new LorryContext();

            using (var dbContext = new LorryContext())
            {
                List <Couplet> coupletList = coupletContext.Couplet.ToList();

                Couplet randomCouplet = coupletList.RandomElement();

                MessageBox.Show(randomCouplet.CoupletContent);
            }
        }