/*
         * // 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(ItemSchema schema)
        {
            _schema = schema;
            _values = new ItemValues(_schema);

            _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(ItemSchema schema)
    {
      _schema = schema;
      _values = new ItemValues(_schema);

      _values.PropertyChanged += (s, e) => PropertyChanged(this, e);
    }
Beispiel #3
0
        public ItemValues(ItemSchema schema)
        {
            _schema = schema;

            foreach (var property in _schema.GetCustomType().GetProperties())
            {
                _customPropertyValues.Add(property.Name, null);
            }
        }
    protected Item CreateNewItem(Graphic graphic)
    {
      // make sure the schema is up to date
      if (_schema == null)
      {
        if (_featureLayer == null)
          return null;

        _schema = new ItemSchema();
        Field oidField = null;
        foreach (Field field in _featureLayer.LayerInfo.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 = new Item(_schema);

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

      return item;
    }
    public void SetDataSource(OD.DataSource dataSource)
    {
      if (_dataSource != dataSource)
      {
        // this will cause the schema to get recreated
        _schema = null;

        // clear the grouping
        _groupByColumnViewModels = null;

        _dataSource = dataSource;
        _map = GetMap();
        _featureLayer = FindFeatureLayer(_dataSource);
      }
    }