예제 #1
0
        private void DisplayErrors()
        {
            _errors.Clear();
            foreach (var error in Parent.GetErrors())
            {
                IDataObject obj = error as IDataObject;
                if (obj == null && error is ViewModel)
                {
                    var vmdl = (ViewModel)error;
                    if (vmdl.Parent is DataObjectViewModel)
                    {
                        obj = ((DataObjectViewModel)vmdl.Parent).Object;
                    }
                }

                _errors.Add(ViewModelFactory.CreateViewModel <ErrorDescriptor.Factory>().Invoke(
                                DataContext, this,
                                obj == null ? null : DataObjectViewModel.Fetch(ViewModelFactory, DataContext, this, obj),
                                new List <string>()
                {
                    error.Error
                }));
            }
        }
예제 #2
0
 public ErrorDescriptor(IViewModelDependencies dependencies, IZetboxContext dataCtx, ViewModel parent, DataObjectViewModel item, IList<string> errors)
     : base(dependencies, dataCtx, parent)
 {
     this._item = item;
     this._errors = errors;
 }
예제 #3
0
 private DataObjectViewModel CreateNewDataObjectViewModel()
 {
     var newMock = scope.Resolve<ZetboxMockFactory>().CreateTestObject();
     var dom = new DataObjectViewModel(null, GetContext(), null, newMock.Object);
     models[objMock.Object] = dom;
     return dom;
 }
예제 #4
0
        public void CreateRelation()
        {
            var rel = _class.CreateRelation();

            ViewModelFactory.ShowModel(DataObjectViewModel.Fetch(ViewModelFactory, DataContext, this, rel), true);
        }
예제 #5
0
        public string ExtractFormattedValue(DataObjectViewModel obj)
        {
            if (obj == null) return string.Empty;

            string val = null;
            switch (this.Type)
            {
                case ColumnDisplayModel.ColumnType.ViewModelProperty:
                    var propVal = obj.GetPropertyValue<object>(this.Path);
                    val = propVal != null ? propVal.ToString() : string.Empty;
                    break;
                case ColumnDisplayModel.ColumnType.PropertyModel:
                    DataObjectViewModel objVmdl = obj;
                    IFormattedValueViewModel resultVMdl = null;
                    foreach (var current in this.Path.Split('.'))
                    {
                        if (objVmdl == null) break;

                        resultVMdl = objVmdl.PropertyModelsByName[current];
                        if (resultVMdl is ObjectReferenceViewModel)
                        {
                            objVmdl = ((ObjectReferenceViewModel)resultVMdl).Value;
                        }
                    }
                    val = resultVMdl != null ? resultVMdl.FormattedValue : string.Empty;
                    break;
            }
            return val;
        }
예제 #6
0
 public JavaScriptObjectMoniker(DataObjectViewModel m)
 {
     Init(m);
 }
예제 #7
0
 private void Init(DataObjectViewModel m)
 {
     ID = m.ID;
     Type = m.GetInterfaceType().ToSerializableType();
     Text = m.Name;
 }
예제 #8
0
 public ErrorDescriptor(IViewModelDependencies dependencies, IZetboxContext dataCtx, ViewModel parent, DataObjectViewModel item, IList <string> errors)
     : base(dependencies, dataCtx, parent)
 {
     this._item   = item;
     this._errors = errors;
 }