Ejemplo n.º 1
0
        /// <summary>
        /// copy a relationship
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btCopyRel_Click(object sender, RoutedEventArgs e)
        {
            //get the selected item
            if (lbRelations.SelectedItem == null)
            {
                return;
            }
            IRelationshipMetadata copy = lbRelations.SelectedItem as IRelationshipMetadata;

            //create the new item
            IRelationshipMetadata rel = new RelationshipMetadata(Catalog.CatalogMetadata);

            BermudaConfigUtil.CopyRelationship(copy, rel);

            //open the window
            RelationshipConfig window = new RelationshipConfig(rel, "");
            var ret = window.ShowDialog();

            if (!ret.HasValue || ret == false)
            {
                return;
            }

            //add to list
            Relationships.Add(rel);
            Catalog.CatalogMetadata.Relationships.Add(rel.RelationshipName, rel);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// double click on relationship for edit
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void lbRealtions_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            var item = sender as ListBoxItem;

            if (item == null || !item.IsSelected)
            {
                return;
            }
            IRelationshipMetadata sel          = item.Content as IRelationshipMetadata;
            IRelationshipMetadata relationship = new RelationshipMetadata(Catalog.CatalogMetadata);

            BermudaConfigUtil.CopyRelationship(sel, relationship);
            RelationshipConfig window = new RelationshipConfig(relationship, relationship.RelationshipName);
            var ret = window.ShowDialog();

            if (!ret.HasValue || ret.Value == false)
            {
                return;
            }
            BermudaConfigUtil.CopyRelationship(relationship, sel);
            lbRelations.Items.Refresh();
        }