/// <summary>
        /// Открыть окно атрибутов объекта
        /// </summary>
        /// <param name="table">Слой</param>
        /// <param name="id"></param>
        /// <param name="wkt"></param>
        /// <param name="ownerMV"></param>
        public override void OpenObject(AbsM.ITableBaseM table, object idObject, string wkt = null, WindowViewModelBase_VM ownerMV = null)
        {
            if (idObject != null && !(idObject is int))
            {
                throw new Exception("Неверный параметр");
            }

            var cosmTable       = table as CosM.CosmeticTableBaseM;
            var cosmAttributeVM = new CosmeticAttributes.CosmeticAttributesVM(table, (int?)idObject, false, wkt);

            cosmAttributeVM.Reload();

            OpenWindow(
                new View.CosmeticAttributes.CosmeticAttributesV(),
                cosmAttributeVM,
                750, 550,
                400, 300,
                ownerMV);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Работы с атрибутами объекта
        /// </summary>
        /// <param name="table">Ссылка на таблицу</param>
        /// <param name="mapObj">Объекта слоя с атрибутами.</param>
        /// <exception cref="ArgumentNullException"/>
        public CosmeticAttributesListVM(CosmeticAttributesVM attributeVM)
        {
            _attributeVM = attributeVM;

            _isDebug = attributeVM.IsDebug;
            _table   = attributeVM.Table;

            _geomAttribute = new CosM.CosmeticAttributes.CosmeticAttributeM((CosM.CosmeticFieldM)_table.Fields.First(p => p.Name == _table.GeomFieldName));
            _pkAttribute   = new CosM.CosmeticAttributes.CosmeticAttributeM((CosM.CosmeticFieldM)_table.PrimaryKeyField);

            if (_attributeVM.TableObject != null)
            {
                int id = _attributeVM.TableObject.Id;
                if (id >= 0)
                {
                    _pkAttribute.Value = id;
                }
            }

            _isNew = (_pkAttribute.Value == null);

            _attributes = new ObservableCollection <CosM.CosmeticAttributes.CosmeticAttributeM>();
        }