Exemplo n.º 1
0
        public MainForm()
        {
            InitializeComponent();

            _viewModel = new MainFormViewModel();
            StringHelper.ViewModel = _viewModel;

            InputProgressBar.DataBindings.Add(new Binding("Maximum", _viewModel, "InputProgressBarMax"));
            InputProgressBar.DataBindings.Add(new Binding("Value", _viewModel, "InputProgressBarValue"));

            CheckedPicto.DataBindings.Add(new Binding("Visible", _viewModel, "CheckedPictoVisibility"));
            WarningPicto.DataBindings.Add(new Binding("Visible", _viewModel, "WarningPictoVisibility"));

            FilterArtistCheckBox.DataBindings.Add(new Binding("Checked", _viewModel, "FilterArtistChecked"));
            FilterWorkCheckBox.DataBindings.Add(new Binding("Checked", _viewModel, "FilterWorkChecked"));

            InputFormat.SelectedIndex = 0;

            _viewModel.PropertyChanged += OnViewModelPropertyChanged;

        }
        public void TestInsertMany()
        {
            _viewModel = new MainFormViewModel();

            // TODO: Load sample Catalog here.

            MySqlDriverService.Instance.Initialize(new DbDriverConfig
            {
                DbEngineType = "mysql",
                DbServerName = "localhost",
                DbDatabaseName = "babelmetadev",
                DbDatabaseUser = "******",
                DbDatabasePassword = "",
            });

            if (MySqlDriverService.Instance.IsValidTable<Album>())
            {
                Debug.WriteLine("Album ok");
            }

            MySqlDriverService.Instance.InitializeTable<Album>();
            MySqlDriverService.Instance.InsertMany(CatalogContext.Instance.Albums);
            MySqlDriverService.Instance.InitializeTable<Artist>();
            MySqlDriverService.Instance.InsertMany(CatalogContext.Instance.Artists);
            MySqlDriverService.Instance.InitializeTable<Asset>();
            MySqlDriverService.Instance.InsertMany(CatalogContext.Instance.Assets);
            MySqlDriverService.Instance.InitializeTable<Lang>();
            MySqlDriverService.Instance.InsertMany(CatalogContext.Instance.Langs);
            MySqlDriverService.Instance.InitializeTable<Quality>();
            MySqlDriverService.Instance.InsertMany(CatalogContext.Instance.Qualities);
            MySqlDriverService.Instance.InitializeTable<Role>();
            MySqlDriverService.Instance.InsertMany(CatalogContext.Instance.Roles);
            MySqlDriverService.Instance.InitializeTable<Tag>();
            MySqlDriverService.Instance.InsertMany(CatalogContext.Instance.Tags);
            MySqlDriverService.Instance.InitializeTable<Work>();
            MySqlDriverService.Instance.InsertMany(CatalogContext.Instance.Works);
        }