Ejemplo n.º 1
0
        public MainControl()
        {
            InitializeComponent();
            lvcSettings = ListViewColumnsSettings.LoadSettings();

            this.Enter += MainControl_Enter;
        }
        public EntityPropertiesControl(EntityMetadata emd, ListViewColumnsSettings lvcSettings)
        {
            InitializeComponent();

            this.emd = emd;
            this.lvcSettings = (ListViewColumnsSettings)lvcSettings.Clone();

            ListViewColumnHelper.AddColumnsHeader(attributeListView, typeof(AttributeMetadataInfo), ListViewColumnsSettings.AttributeFirstColumns, this.lvcSettings.AttributeSelectedAttributes, new string[] { });
            ListViewColumnHelper.AddColumnsHeader(OneToManyListView, typeof(OneToManyRelationshipMetadataInfo), ListViewColumnsSettings.RelFirstColumns, this.lvcSettings.OtmRelSelectedAttributes, new string[] { });
            ListViewColumnHelper.AddColumnsHeader(manyToOneListView, typeof(OneToManyRelationshipMetadataInfo), ListViewColumnsSettings.RelFirstColumns, this.lvcSettings.OtmRelSelectedAttributes, new string[] { });
            ListViewColumnHelper.AddColumnsHeader(manyToManyListView, typeof(ManyToManyRelationshipMetadataInfo), ListViewColumnsSettings.RelFirstColumns, this.lvcSettings.MtmRelSelectedAttributes, new string[] { });
            ListViewColumnHelper.AddColumnsHeader(privilegeListView, typeof(SecurityPrivilegeInfo), ListViewColumnsSettings.PrivFirstColumns, this.lvcSettings.PrivSelectedAttributes, new string[] { });

            attributesSplitContainer.Panel2Collapsed = true;
            manyToManySplitContainer.Panel2Collapsed = true;
            manyToOneSplitContainer.Panel2Collapsed = true;
            oneToManySplitContainer.Panel2Collapsed = true;
            privilegeSplitContainer.Panel2Collapsed = true;

            RefreshContent(emd);
        }
        public void RefreshColumns(ListViewColumnsSettings lvcUpdatedSettings)
        {
            if (lvcSettings.AttributeSelectedAttributes != lvcUpdatedSettings.AttributeSelectedAttributes)
            {
                lvcSettings.AttributeSelectedAttributes = (string[])lvcUpdatedSettings.AttributeSelectedAttributes.Clone();
                attributeListView.Columns.Clear();
                ListViewColumnHelper.AddColumnsHeader(attributeListView, typeof(AttributeMetadataInfo), ListViewColumnsSettings.AttributeFirstColumns, lvcSettings.AttributeSelectedAttributes, new string[] { });
                LoadAttributes(emd.Attributes);
            }

            if (lvcSettings.OtmRelSelectedAttributes != lvcUpdatedSettings.OtmRelSelectedAttributes)
            {
                lvcSettings.OtmRelSelectedAttributes = (string[])lvcUpdatedSettings.OtmRelSelectedAttributes.Clone();
                OneToManyListView.Columns.Clear();
                manyToOneListView.Columns.Clear();
                ListViewColumnHelper.AddColumnsHeader(OneToManyListView, typeof(OneToManyRelationshipMetadataInfo), ListViewColumnsSettings.RelFirstColumns, lvcSettings.OtmRelSelectedAttributes, new string[] { });
                ListViewColumnHelper.AddColumnsHeader(manyToOneListView, typeof(OneToManyRelationshipMetadataInfo), ListViewColumnsSettings.RelFirstColumns, lvcSettings.OtmRelSelectedAttributes, new string[] { });
                LoadOneToManyRelationships(emd.OneToManyRelationships);
                LoadManyToOneRelationships(emd.ManyToOneRelationships);
            }

            if (lvcSettings.MtmRelSelectedAttributes != lvcUpdatedSettings.MtmRelSelectedAttributes)
            {
                lvcSettings.MtmRelSelectedAttributes = (string[])lvcUpdatedSettings.MtmRelSelectedAttributes.Clone();
                manyToManyListView.Columns.Clear();
                ListViewColumnHelper.AddColumnsHeader(manyToManyListView, typeof(ManyToManyRelationshipMetadataInfo), ListViewColumnsSettings.RelFirstColumns, lvcSettings.MtmRelSelectedAttributes, new string[] { });
                LoadManyToManyRelationships(emd.ManyToManyRelationships);
            }

            if (lvcSettings.PrivSelectedAttributes != lvcUpdatedSettings.PrivSelectedAttributes)
            {
                lvcSettings.PrivSelectedAttributes = (string[]) lvcUpdatedSettings.PrivSelectedAttributes.Clone();
                privilegeListView.Columns.Clear();
                ListViewColumnHelper.AddColumnsHeader(privilegeListView, typeof (SecurityPrivilegeInfo), ListViewColumnsSettings.PrivFirstColumns, lvcSettings.PrivSelectedAttributes, new string[] {});
                LoadPrivileges(emd.Privileges);
            }

            lvcSettings = lvcUpdatedSettings;
        }
Ejemplo n.º 4
0
        private void epc_OnColumnSettingsUpdated(object sender, ColumnSettingsUpdatedEventArgs e)
        {
            lvcSettings = (ListViewColumnsSettings)e.Settings.Clone();
            lvcSettings.SaveSettings();

            foreach (TabPage page in mainTabControl.TabPages)
            {
                if (page.TabIndex == 0) continue;
                var ctrl = ((EntityPropertiesControl)page.Controls[0]);
                if (ctrl.Name != e.Control.Name)
                {
                    ctrl.RefreshColumns(lvcSettings);
                }
            }
        }