/// <summary>
        /// Initializes a new instance of the <see cref="ProcessViewSectionViewModel"/> class.
        /// </summary>
        /// <param name="model">The model.</param>
        /// <param name="parentViewModel">The parent view model.</param>
        public ProcessViewSectionViewModel(ProcessViewSectionEdit model, ProcessViewViewModel parentViewModel, bool composeParts = true)
        {
            if (composeParts) Ioc.ComposeParts(this); 

            Parent = parentViewModel;
            Fields = new ObservableCollection<ProcessViewFieldViewModel>();
            Steps = new ObservableCollection<IProcessViewSectionStepViewModel>();

            SetModel(model);
        }
Пример #2
0
        /// <summary>
        /// Populates the views.
        /// </summary>
        private void PopulateViews()
        {
            var selectedView = SelectedView;
            var selectedSection = SelectedSection;

            Views.Clear();

            if (Model != null)
            {
                foreach (var view in Model.ViewList)
                {
                    var viewViewModel = new ProcessViewViewModel(view, this);

                    Views.Add(viewViewModel);
                }
            }

            if (selectedView != null)
            {
                SelectedView = Views.FirstOrDefault(x => x.Model.Guid == selectedView.Model.Guid);
            }
            else
            {
                SelectedView = null;
            }

            if (SelectedView != null && selectedSection != null)
            {
                SelectedSection = SelectedView.Sections.FirstOrDefault(x => x.Model.Guid == selectedSection.Model.Guid);
            }
            else
            {
                SelectedSection = null;
            }
        }
Пример #3
0
        /// <summary>
        /// Executes the add view.
        /// </summary>
        /// <param name="obj">The object.</param>
        private void ExecuteAddView(object obj)
        {
            var item = ProcessViewEdit.NewProcessViewEdit();
            item.Name = this.GetNewViewName();
            Model.ViewList.Add(item);

            var itemViewModel = new ProcessViewViewModel(item, this);
            Views.Add(itemViewModel);
            SelectedView = itemViewModel;
        }