コード例 #1
0
        public override void OpenTableSettings(AbsM.ITableBaseM iTable, UIElement positionElement = null)
        {
            var vmpTable  = iTable as Model.CosmeticTableBaseM;
            var vmpLayerV = new View.CosmeticLayerV();

            vmpLayerV.DataContext = new Rekod.Services.BindingProxy()
            {
                Data = vmpTable
            };
            Window window = new Window();

            window.Title     = String.Format("Редактирование свойств слоя \"{0}\"", vmpTable.Text);
            window.Content   = vmpLayerV;
            window.Icon      = System.Windows.Media.Imaging.BitmapFrame.Create(new Uri("pack://application:,,,/Pie_Chart.ico", UriKind.Absolute));
            window.Height    = 450;
            window.Width     = 370;
            window.MinHeight = 450;
            window.MinWidth  = 370;
            window.Owner     = Program.WinMain;
            if (positionElement != null)
            {
                System.Windows.Point pt = positionElement.TranslatePoint(new System.Windows.Point(0, 0), Program.WinMain);
                window.Top  = pt.Y;
                window.Left = pt.X;
            }
            window.Show();
        }
コード例 #2
0
        public override object OpenTable(AbsM.ITableBaseM table, object id = null, bool isSelected = false, WindowViewModelBase_VM ownerMV = null)
        {
            //(new layerInfo(_mv, table.Name)).Show();
            //return null;

            if (table != null)
            {
                var tableViewVM = new CosmeticTableViewVM(table as CosM.CosmeticTableBaseM);
                var tableViewV  = new CosV.CosmeticTableViewV();
                if (isSelected)
                {
                    return(OpenWindowDialog(
                               tableViewV,
                               tableViewVM,
                               767, 570,
                               500, 300,
                               ownerMV
                               ));
                }
                else
                {
                    OpenWindow(
                        tableViewV,
                        tableViewVM,
                        767, 570,
                        500, 300,
                        ownerMV
                        );
                }
            }
            return(null);
        }
コード例 #3
0
        public CosmeticAttributesVM(AbsM.ITableBaseM table, int?obj, bool isReadOnly = false, string wkt = null, bool isDebug = false)
        {
            _table = table as CosM.CosmeticTableBaseM;
            if (_table == null)
            {
                throw new ArgumentNullException(Rekod.Properties.Resources.CosAttributes_TableIsNull);
            }
            else if (_table.PrimaryKeyField == null)
            {
                throw new ArgumentNullException(Rekod.Properties.Resources.CosAttributes_TableWithoutPK);
            }
            if (obj == null)
            {
                throw new ArgumentNullException(Rekod.Properties.Resources.CosAttributes_MvObjectIsNull);
            }

            _isDebug = isDebug;
            _source  = _table.Source as CosVM.CosmeticDataRepositoryVM;

            _tableObject = GetOrCreateTableObject(obj);

            _attributesListVM = new CosmeticAttributesListVM(this);

            if (_table.Type == AbsM.ETableType.MapLayer || _table.Type == AbsM.ETableType.View)
            {
                string curWKT = string.Empty;
                if (string.IsNullOrWhiteSpace(wkt))
                {
                    var layerMV = Source.MapViewer.getLayer(_table.NameMap);
                    if (layerMV != null)
                    {
                        var objMV = layerMV.getObject(_tableObject.Id);
                        if (objMV != null)
                        {
                            curWKT = objMV.getWKT();
                        }
                    }
                }
                else
                {
                    curWKT = wkt;
                }
                _pgGeometryVM = new PgVM.PgAttributes.PgAttributesGeomVM(_attributesListVM, curWKT, (int?)_attributesListVM.PkAttribute.Value);
            }

            _styleVM = GetStyle();
            Title    = String.Format("{0}: [id: {3}]; {1}: \"{4}\"; {2}: \"{5}\"",
                                     Rekod.Properties.Resources.CosAttributes_Object,
                                     Rekod.Properties.Resources.CosAttributes_Table,
                                     Rekod.Properties.Resources.CosAttributes_Type,
                                     _tableObject != null ? _tableObject.Id.ToString() : "null",
                                     _table.Text,
                                     _table.Source.Type);
        }
コード例 #4
0
ファイル: PgFieldM.cs プロジェクト: luckymenslife/autobase
        public PgFieldM(AbsM.ITableBaseM table, int id)
        {
            _id = id;
            var pgTable = table as PgM.PgTableBaseM;

            if (pgTable == null)
            {
                throw new ArgumentNullException("Нет ссылки на таблицу");
            }
            _table   = pgTable;
            _idTable = _table.Id;
        }
コード例 #5
0
        public PgAttributesVM(AbsM.ITableBaseM table, object idObject, bool isReadOnly = false, bool isDebug = false, String wkt = null)
        {
            var pgTable = table as PgM.PgTableBaseM;

            if (pgTable == null)
            {
                throw new ArgumentNullException("Нет ссылки на таблицу");
            }
            else if (pgTable.PrimaryKeyField == null)
            {
                throw new ArgumentNullException("В таблице нет первичного ключа");
            }

            _isDebug = isDebug;
            _connect = ((PgVM.PgDataRepositoryVM)pgTable.Source).Connect;
            _table   = pgTable;
            _source  = pgTable.Source as PgVM.PgDataRepositoryVM;

            // Проверка прав на объект с атрибутами
            if (isReadOnly || pgTable.IsReadOnly || !pgTable.CanWrite)
            {
                _isReadOnly = true;
            }

            _attributesListVM = new PgAtVM.PgAttributesListVM(this, idObject);
            if (_table.FileInfo != null)
            {
                _filesVM = new PgAtVM.PgAttributeFilesVM(this);
            }
            if (_table.IsMapStyle && idObject != null)
            {
                _styleVM = new PgAttributesStyleVM(this);
            }
            if (_table.Type == AbsM.ETableType.MapLayer || _table.Type == AbsM.ETableType.View)
            {
                //_pgGeometryVM = new PgAttributesGeomVM(this, wkt);
                _pgGeometryVM = new PgAttributesGeomVM(_table.Id, wkt, false, (int?)_attributesListVM.PkAttribute.Value, (_table.Source as PgVM.PgDataRepositoryVM).Connect);
            }
            Title = String.Format("Объект: [id: {0}]; Таблица: \"{1}\"; Источник: \"{3}@{4}:{5} ({6})\"; Тип: \"{2}\"",
                                  idObject ?? "null",
                                  _table.Text,
                                  _table.Source.Type,
                                  _source.Connect.Database,
                                  _source.Connect.Host,
                                  _source.Connect.Port,
                                  _source.CurrentUser.NameFull);
        }
コード例 #6
0
        public CosmeticFieldM(AbsM.ITableBaseM table,
                              string name, string text, AbsM.EFieldType type, bool isReadOnly = false)
        {
            var cosmTable = table as CosmeticTableBaseM;

            if (cosmTable == null)
            {
                throw new ArgumentNullException("Нет ссылки на таблицу");
            }
            _id         = CosmeticFieldM.cosmeticFieldId++;
            _table      = cosmTable;
            _idTable    = _table.Id;
            _name       = name;
            _text       = text;
            _type       = type;
            _isReadOnly = isReadOnly;
        }
コード例 #7
0
        /// <summary>
        /// Открытие таблицы
        /// </summary>
        /// <param name="parameter">Таблица, которую необходимо открыть</param>
        public void OpenTable(object parameter = null)
        {
            AbsM.ITableBaseM iTable = null;
            if (parameter is CommandEventParameter)
            {
                iTable = (parameter as CommandEventParameter).CommandParameter as AbsM.ITableBaseM;
            }
            else
            {
                iTable = parameter as AbsM.ITableBaseM;
            }

            if (iTable != null)
            {
                OpenTable(iTable);
            }
        }
コード例 #8
0
        /// <summary>
        /// ViewModel для окна списка объектов
        /// </summary>
        /// <param name="table">Таблица с объектами</param>
        /// <param name="filter">Фильтр который нужно применить для данного окна</param>
        /// <param name="id">Перейти к нужному объекту</param>
        /// <param name="toSelected"> Открыть окно для выбора объекта</param>
        /// <param name="isDebug"> Debug режим </param>
        public PgTableViewVM(AbsM.ITableBaseM table, FilterRelationModel filter = null, object id = null, bool toSelected = false, bool isDebug = false)
        {
            var pgTable = table as PgM.PgTableBaseM;

            if (pgTable == null)
            {
                throw new ArgumentNullException("table");
            }
            _table      = pgTable;
            _isReadOnly = _table.IsReadOnly;
            _source     = pgTable.Source as PgVM.PgDataRepositoryVM;
            _connect    = Source.Connect;
            _sysScheme  = "sys_scheme";
            _isDebug    = isDebug;
            Title       = String.Format("Таблица: \"{0}\"; Источник: \"{2}@{3}:{4} ({5})\"; Тип: \"{1}\"",
                                        pgTable.Text,
                                        _source.Type,
                                        _source.Connect.Database,
                                        _source.Connect.Host,
                                        _source.Connect.Port,
                                        _source.CurrentUser.NameFull);

            _columns  = new ObservableCollection <HeaderValue>();
            sqlSelect = GetSQL();

            _filterVM = new PgTableView.PgTableViewFilterVM(this, filter);

            if (id != null)
            {
                int?page = GetPageInTable(id);
                if (page != null)
                {
                    PageCurrent = page;
                }
            }
            GetColumns();
            Reload();
            if (id != null)
            {
                CurrentRowView = GetRow(id);
            }
            _toSelected = toSelected;

            _source.EventUpdateAttribute += _source_EventUpdateAttribute;
            this.PropertyChanged         += PgTableViewVM_PropertyChanged;
        }
コード例 #9
0
        /// <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);
        }
コード例 #10
0
 public PgAttributeEventArgs(AbsM.ITableBaseM table, object id, attributeTypeChange typeChange)
 {
     _table      = table;
     _id         = id;
     _typeChange = typeChange;
 }
コード例 #11
0
 /// <summary>
 /// Поиск поля в таблце
 /// </summary>
 /// <param name="table">Таблица</param>
 /// <param name="id">Идентификатор поля</param>
 /// <returns></returns>
 public virtual AbsM.IFieldM FindField(AbsM.ITableBaseM table, object id)
 {
     //todo-Yoda: сделать поиск поля по всем таблицам, а если таблица указана, то только по одной таблице
     return(table.Fields.FirstOrDefault(f => f.Id == (int)id));
 }
コード例 #12
0
 public PgFileInfoM(AbsM.ITableBaseM table)
 {
     Table = table;
 }
コード例 #13
0
 public virtual object OpenTable(AbsM.ITableBaseM table, object id = null, bool isSelected = false, WindowViewModelBase_VM ownerMV = null)
 {
     return(null);
 }
コード例 #14
0
 public virtual void OpenObject(AbsM.ITableBaseM table, object id, String wkt = null, WindowViewModelBase_VM ownerMV = null)
 {
     return;
 }
コード例 #15
0
 public override object OpenTable(AbsM.ITableBaseM table, object id = null, bool isSelected = false, WindowViewModelBase_VM ownerMV = null)
 {
     (new layerInfo(_mv, table.Name)).Show();
     return(null);
 }
コード例 #16
0
ファイル: PgFieldM.cs プロジェクト: luckymenslife/autobase
 public PgFieldM(AbsM.ITableBaseM table)
     : this(table, 0)
 {
     _isNew = true;
 }
コード例 #17
0
 /// <summary>
 /// Показать окно настроек таблицы
 /// </summary>
 /// <param name="iTable"></param>
 /// <param name="positionElement"></param>
 public virtual void OpenTableSettings(AbsM.ITableBaseM iTable, System.Windows.UIElement positionElement = null)
 {
 }