コード例 #1
0
 private void dgAttributes_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (dgAttributes.SelectedIndices != null && dgAttributes.SelectedIndices.Count > 0)
     {
         var schemaObject = dgAttributes.Items[dgAttributes.SelectedIndices[0]].Tag as SchemaObjectMappingDto;
         var desc         = dgAttributes.Items[dgAttributes.SelectedIndices[0]].Text.Split('-')[0].Trim();
         var obj          = new ObjectId();
         var objectId     = obj.GetByDescription(desc);
         schemaObject.ObjectId = objectId.ToString();
         var datasource = GetAllObjectIds();
         var form       = new SchemaObjectMappingView(schemaObject, datasource);
         var result     = form.ShowDialog(this);
         if (form.HasChanges)
         {
             dgAttributes.Items.RemoveAt(dgAttributes.SelectedIndices[0]);
             var      dto = (SchemaObjectMappingDto)form.DataContext;
             ObjectId id;
             if (Enum.TryParse(dto.ObjectId, false, out id))
             {
                 var listItem = new ListViewItem(id.GetDescription() + " - " + dto.ObjectClass)
                 {
                     Tag = dto
                 };
                 dgAttributes.Items.Add(listItem);
             }
         }
     }
 }
コード例 #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var dataSource = GetUnMappedObjectIds();
            var form       = new SchemaObjectMappingView(null, dataSource);
            var result     = form.ShowDialog(this);

            if (form.HasChanges)
            {
                var      dto = (SchemaObjectMappingDto)form.DataContext;
                ObjectId id;
                if (Enum.TryParse(dto.ObjectId, false, out id))
                {
                    var listItem = new ListViewItem(id.GetDescription() + " - " + dto.ObjectClass)
                    {
                        Tag = dto
                    };
                    dgAttributes.Items.Add(listItem);
                }
            }
        }