/// <summary> /// Initializes the specified view configurator. /// </summary> /// <param name="viewConfigurator">The view configurator.</param> /// <param name="parentViewModel">The parent view model.</param> public void Init(IProcessViewConfigurator viewConfigurator, ProcessViewsViewModel parentViewModel) { _viewConfigurator = (DataCollectProcessViewConfigurator) viewConfigurator; RaisePropertyChanged(() => ViewConfigurator); _parentViewModel = parentViewModel; RaisePropertyChanged(() => Parent); AvailableFields = new ObservableCollection<IDisplayFieldViewModel>(); SelectedDisplayFields.Clear(); foreach (var df in _viewConfigurator.ExistingRecordFields) { var vm = new SelectedFieldViewModel(); vm.Initialize(df, this); SelectedDisplayFields.Add(vm); var node = FindNode(df.FullPath); if (node != null) { node.IsSelected = false; } } UpdateCanMoveFields(); SetupProcessFields(); LoadFilters(); SetEventListener(); }
public void SelectDisplayField(IDisplayFieldViewModel fieldViewModel) { var path = fieldViewModel.FullSystemPath; if (ContainsSelectedField(path)) { return; } var maxOrder = 0.0; if (this.ViewConfigurator.ExistingRecordFields.Any()) { maxOrder = this.ViewConfigurator.ExistingRecordFields.Max(x => x.Order); } var newField = new DisplayField(fieldViewModel.FullPath, fieldViewModel.FullSystemPath, maxOrder + 1.0, fieldViewModel.Model.IsBuiltIn); this.ViewConfigurator.ExistingRecordFields.Add(newField); var vm = new SelectedFieldViewModel(); vm.Initialize(newField, this); this.SelectedDisplayFields.Add(vm); this.UpdateCanMoveFields(); }