private void InitializeDataBindings() { if (_viewModel == null) { _logger.InfoFormat("can't initialize data binding the view model was null"); return; } try { _bindingSource = new BindingSource(); // assign the model to the binding source, binding source is the key component for the databinding to work _bindingSource.DataSource = _viewModel; txtDisplayName.DataBindings.Clear(); txtPackageType.DataBindings.Clear(); txtPathtoFile.DataBindings.Clear(); txtFileInfo.DataBindings.Clear(); MVVMUtils.AddDataBinding(txtDisplayName, "Text", _bindingSource, nameof(_viewModel.DisplayName)); MVVMUtils.AddDataBinding(txtPackageType, "Text", _bindingSource, nameof(_viewModel.PackageType)); MVVMUtils.AddDataBinding(txtPathtoFile, "Text", _bindingSource, nameof(_viewModel.PackagePath)); MVVMUtils.AddDataBinding(txtFileInfo, "Text", _bindingSource, nameof(_viewModel.FileInformation)); _logger.InfoFormat("databinding initialized"); } catch (Exception e) { Console.WriteLine(e); throw; } }
private void InitializeDataBindings() { if (_model == null) { _logger.InfoFormat("can't initialize data binding the datasource was null"); return; } try { // assign the model to the binding source, binding source is the key component for the databinding to work _bindingSource.DataSource = _viewModel; // examples to bind the controls to the model // MVVMUtils.AddDataBinding(txtPackagesDir, "Text", _bindingSource, nameof(_vm.SearchPath)); dataGridView.DataBindings.Clear(); statusFilesCount.DataBindings.Clear(); MVVMUtils.AddDataBinding(dataGridView, "DataSource", _bindingSource, nameof(_viewModel.PackagesList)); MVVMUtils.AddDataBinding(statusFilesCount, "Text", _bindingSource, nameof(_viewModel.Count)); _logger.InfoFormat("databinding initialized"); } catch (Exception e) { _logger.Error(e); throw; } }
private void ConfigureDataBindings() { if (_model != null) { _bindingsource.DataSource = _model; MVVMUtils.AddDataBinding(scintilla1, "Text", _bindingsource, nameof(_model.Code)); } }
private void ConfigureDataBindings() { if (_model != null) { _bindingsource.DataSource = _model; MVVMUtils.AddDataBinding(txtArguments, "Text", _bindingsource, nameof(_model.Arguments)); } }
private void ConfigureDataBindings() { if (_model != null) { _bindingSource.DataSource = _model; dataGridView.CellClick += DataGridView_CellClick; MVVMUtils.AddDataBinding(dataGridView, "DataSource", _bindingSource, nameof(_model.IniReplacements)); } }
private void InitializeDataBindings() { MVVMUtils.AddDataBinding(txtPackagesDir, "Text", _bindingSource, nameof(_vm.SearchPath)); MVVMUtils.AddDataBinding(txtfileNameFilter, "Text", _bindingSource, nameof(_vm.SearchFilter)); MVVMUtils.AddDataBinding(statusFilesCount, "Text", _bindingSource, nameof(_vm.FilesCount)); MVVMUtils.AddDataBinding(statusSearchInProgress, "Visible", _bindingSource, nameof(_vm.IsSearching)); MVVMUtils.AddDataBinding(gridPackagesSearch, "DataSource", _bindingSource, nameof(_vm.Files)); ConfigureGrid(); }