示例#1
0
    /*
    // Existing known properties
    private string _firstName;
    private string _lastName;

    public string FirstName
    {
      get { return _firstName; }
      set { _firstName = value; RaisePropertyChanged(); }
    }

    public string LastName
    {
      get { return _lastName; }
      set { _lastName = value; RaisePropertyChanged(); }
    }
    */
    #endregion


    public Item(BaseItemsViewModel vmItems)
    {
      _vmItems = vmItems;
      _schema  = vmItems.Schema;
      _values  = new ItemValues(vmItems);

      _values.PropertyChanged += (s, e) => PropertyChanged(this, e);
    }
        /*
         * // Existing known properties
         * private string _firstName;
         * private string _lastName;
         *
         * public string FirstName
         * {
         * get { return _firstName; }
         * set { _firstName = value; RaisePropertyChanged(); }
         * }
         *
         * public string LastName
         * {
         * get { return _lastName; }
         * set { _lastName = value; RaisePropertyChanged(); }
         * }
         */
        #endregion


        public Item(BaseItemsViewModel vmItems)
        {
            _vmItems = vmItems;
            _schema  = vmItems.Schema;
            _values  = new ItemValues(vmItems);

            _values.PropertyChanged += (s, e) => PropertyChanged(this, e);
        }
示例#3
0
        public ItemValues(BaseItemsViewModel vmItems)
        {
            _schema = vmItems.Schema;

            foreach (var property in _schema.GetCustomType().GetProperties())
            {
                ItemAttribute newValue = new ItemAttribute(property.Name, null);
                _valuesDictionary.Add(property.Name, newValue);
                _valuesCollection.Add(newValue);
            }
        }
        protected Item CreateNewItem(Graphic graphic, List<Field> fields)
        {
            // make sure the schema is up to date
              if (_schema == null)
              {
            if (fields == null)
              return null;

            _schema = new ItemSchema();
            Field oidField = null;
            foreach (Field field in fields)
            {
              if (field.Type == Field.FieldType.OID)  // (field.Name.ToUpper() != "OBJECTID")
            oidField = field;
              else
            _schema.AddProperty(field);
            }

            // add the OID field at the end
            if (oidField != null)
              _schema.AddProperty(oidField);
              }

              // create a new item
              Item item = CreateItem();

              // set item attributes
              if (!UpdateItem(item, graphic))
            return null;

              return item;
        }
        public void SetFeatureLayer(FeatureLayerHelper featureLayerHelper)
        {
            if (featureLayerHelper == null || featureLayerHelper.FeatureLayer == null)
            return;

              if (_featureLayerHelper == null || _featureLayerHelper.FeatureLayer != featureLayerHelper.FeatureLayer)
              {
            // this will cause the schema to get recreated
            _schema = null;

            // clear the grouping
            _groupByColumnViewModels = null;
              }

              _featureLayerHelper = featureLayerHelper;
        }