Пример #1
0
        public virtual Preset Init(IUiFasade uiFasade)
        {
            _config = uiFasade.GetViewModelConfig(OwnerMnemonic);
            IsInit = true;

            return this;
        }
Пример #2
0
        public ListBoContractResolver(string mnemonic, IUiFasade uiFasade)
        {
            _uiFasade = uiFasade;

            if (!String.IsNullOrEmpty(mnemonic))
            {
                _config = uiFasade.GetViewModelConfig(mnemonic);
                _columns = uiFasade.GetColumns(mnemonic);
            }
        }
Пример #3
0
        public BoContractResolver(string mnemonic, IUiFasade uiFasade)
        {
            _uiFasade = uiFasade;

            if (!String.IsNullOrEmpty(mnemonic))
            {
                _config = uiFasade.GetViewModelConfig(mnemonic);
                _editors = uiFasade.GetEditors(mnemonic);
            }
        }
Пример #4
0
 public BaseViewModel(BaseViewModel baseViewModel)
 {
     _securityUser = baseViewModel.SecurityUser;
     _uiFasade = baseViewModel.UiFasade;
 }
Пример #5
0
 public BaseViewModel(IBaseController controller)
 {
     _securityUser = controller.SecurityUser;
     _uiFasade = controller.UiFasade;
 }
Пример #6
0
 public ContractResolverFactory(ICacheWrapper cache, IUiFasade uiFasade)
 {
     _cache = cache;
     _uiFasade = uiFasade;
 }
Пример #7
0
        public override Preset Init(IUiFasade uiFasade)
        {
            base.Init(uiFasade);

            var columns = uiFasade.GetColumns(OwnerMnemonic)
                .Where(x => x.PropertyInfo.IsDefined(typeof(ListViewAttribute), false)).ToList();

            if (this.Columns == null)
            {
                this.PageSize = OwnerConfig.ListView.DataSource.PageSize;
                this.Groupable = OwnerConfig.ListView.DataSource.Groups.Groupable;

                this.Columns = new List<ColumnSetting>();

                columns.ForEach(col =>
                {
                    var columnSetting = this.Columns.FirstOrDefault(x => x.Name == col.PropertyName);

                    if (columnSetting == null)
                    {
                        columnSetting = new ColumnSetting(col)
                        {
                            Visible = col.Visible,
                            Width = col.Width,
                            SortOrder = col.Order,
                        };

                        columnSetting.ID = this.Columns.Count() + 1;

                        this.Columns.Add(columnSetting.Init(col));
                    }
                });
            }
            else
            {
                bool changeConfig = false;

                var properties = columns.Select(x => x.PropertyName).ToList();

                foreach (var col in this.Columns)
                {
                    var vm = columns.FirstOrDefault(x => x.PropertyName == col.Name);

                    if (vm == null)
                    {
                        changeConfig = true;
                        break;
                    }

                    properties.Remove(vm.PropertyName);

                    col.Init(vm);
                }

                if (changeConfig || properties.Count > 0)
                {
                    this.Columns = null;

                    return this.Init(uiFasade);
                }
            }


            return this;
        }