Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProcessViewViewModel"/> class.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="parentViewModel">The parent view model.</param>
        public ProcessViewViewModel(ProcessViewEdit model, ProcessViewsViewModel parentViewModel)
        {
            Parent = parentViewModel;
            Sections = new ObservableCollection<ProcessViewSectionViewModel>();

            SetModel(model);
        }
        /// <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 = (DocumentProcessViewConfigurator)viewConfigurator;
            RaisePropertyChanged(() => ViewConfigurator);

            _parentViewModel = parentViewModel;
            RaisePropertyChanged(() => Parent);
        }
        public void OnInit_ShouldAdd_CurrentStateField()
        {
            var viewConfigurator = new DataCollectProcessViewConfigurator();

            var process = Mock.Create<ProcessEdit>(Behavior.Loose);

            process.IsStateEnabled = true;
            process.FilterList = new ProcessFilterList();
            process.ViewList = new ProcessViewList();

            var processVVM = new ProcessViewsViewModel { Model = process };
            var vm = new DataCollectionProcessViewConfiguratorViewModel();

            vm.Init(viewConfigurator, processVVM);

            var currentStateFieldVM = vm.AvailableFields.FirstOrDefault(f => f.Name.Contains(Constants.CurrentStateColumnName));

            Assert.IsNotNull(currentStateFieldVM);
            Assert.IsTrue(currentStateFieldVM.Model.IsBuiltIn);
        }
        /// <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();
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Handles the <see cref="E:ModelPropertyChanged" /> event.
 /// </summary>
 /// <param name="viewModel">The view model.</param>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="PropertyChangedEventArgs"/> instance containing the event data.</param>
 private static void OnModelPropertyChanged(ProcessViewsViewModel viewModel, object sender, PropertyChangedEventArgs e)
 {
     if (ProcessEdit.IsStateEnabledProperty.Name.Equals(e.PropertyName))
     {
         //viewModel.OnFieldListChanged(viewModel, EventArgs.Empty);
         //UpdateFilters(viewModel);
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Handles the <see cref="E:ModelChildChanged" /> event.
        /// </summary>
        /// <param name="viewModel">The view model.</param>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="ChildChangedEventArgs"/> instance containing the event data.</param>
        private static void OnModelChildChanged(ProcessViewsViewModel viewModel, object sender, ChildChangedEventArgs e)
        {
            if (e.ChildObject is FieldEdit || e.ChildObject is FieldList || e.ChildObject is ProcessSections || e.ChildObject is SectionEdit)
            {
                viewModel.RaisePropertyChanged(() => viewModel.ProcessFields);
            }
            if (e.ChildObject is ProcessViewEdit && e.ChildObject == viewModel.SelectedView && ProcessViewEdit.ViewTypeProperty.Name.Equals(e.PropertyChangedArgs.PropertyName))
            {
                viewModel.UpdateViewConfigurator();
            }

            ((IActionCommand)viewModel.ChangeFieldIconCommand).RaiseCanExecuteChanged();
        }