コード例 #1
0
        private void OpenForeignDB(object sender, RoutedEventArgs e)
        {
            var DbFile = new Microsoft.Win32.OpenFileDialog() { Filter = "DataBase Files (*.db)|*.db" };
            var result = DbFile.ShowDialog();

            if ((bool)result)
            {
                var file = DbFile.FileName;

                ForeignDB = new DbHandle(new SQLIteClient("", "", "", @file));

                ForeignColection = new CookingBookDataCollection(ForeignDB);

                ForeignColection.GetAll();

                ForeignDbListViev.ItemsSource = ForeignColection.ListOfRecipes;

                CollectionView ForeignRecipeViev = (CollectionView)CollectionViewSource.GetDefaultView(ForeignDbListViev.ItemsSource);
                ForeignRecipeViev.Filter = (item => (String.IsNullOrEmpty(ForeignRecipeFilterText.Text) ? true : ((item as Recipe).Name.IndexOf(ForeignRecipeFilterText.Text, StringComparison.OrdinalIgnoreCase) >= 0)));
                OpenedName.Text = @DbFile.SafeFileName;
            }
            else
            {
                MessageBox.Show("dsfgds");
            }
        }
コード例 #2
0
        public MigrationBase2Base(IDbHandle dbCli)
        {
            InitializeComponent();

            MainDB = dbCli;

            MainColection = new CookingBookDataCollection(dbCli);
            
            MainColection.GetAll();

            MainDbListViev.ItemsSource = MainColection.ListOfRecipes;

            CollectionView MainRecipeViev = (CollectionView)CollectionViewSource.GetDefaultView(MainDbListViev.ItemsSource);
            MainRecipeViev.Filter = (item => (String.IsNullOrEmpty(MainRecipeFilterText.Text) ? true : ((item as Recipe).Name.IndexOf(MainRecipeFilterText.Text, StringComparison.OrdinalIgnoreCase) >= 0)));

        }