コード例 #1
0
        private void tsbColumns_Click(object sender, EventArgs e)
        {
            switch (((ToolStripButton)sender).Name)
            {
            case "tsbAttributeColumns":
            {
                var dialog = new ColumnSelector(typeof(AttributeMetadataInfo),
                                                ListViewColumnsSettings.AttributeFirstColumns,
                                                new string[] { },
                                                lvcSettings.AttributeSelectedAttributes);

                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    lvcSettings.AttributeSelectedAttributes = dialog.UpdatedCurrentAttributes;
                    attributeListView.Columns.Clear();
                    attributeListView.Items.Clear();

                    ListViewColumnHelper.AddColumnsHeader(attributeListView,
                                                          typeof(AttributeMetadataInfo),
                                                          ListViewColumnsSettings.AttributeFirstColumns,
                                                          lvcSettings.AttributeSelectedAttributes,
                                                          new string[] { });

                    LoadAttributes(emd.Attributes);
                }
            }
            break;

            case "tsbOneToManyColumns":
            {
                var dialog = new ColumnSelector(typeof(OneToManyRelationshipMetadataInfo),
                                                ListViewColumnsSettings.RelFirstColumns,
                                                new string[] { },
                                                lvcSettings.OtmRelSelectedAttributes);

                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    lvcSettings.OtmRelSelectedAttributes = dialog.UpdatedCurrentAttributes;
                    OneToManyListView.Columns.Clear();
                    OneToManyListView.Items.Clear();

                    ListViewColumnHelper.AddColumnsHeader(OneToManyListView,
                                                          typeof(OneToManyRelationshipMetadataInfo),
                                                          ListViewColumnsSettings.RelFirstColumns,
                                                          lvcSettings.OtmRelSelectedAttributes,
                                                          new string[] { });

                    LoadOneToManyRelationships(emd.OneToManyRelationships);
                }
            }
            break;

            case "tsbManyToOneColumns":
            {
                var dialog = new ColumnSelector(typeof(OneToManyRelationshipMetadataInfo),
                                                ListViewColumnsSettings.RelFirstColumns,
                                                new string[] { },
                                                lvcSettings.OtmRelSelectedAttributes);

                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    lvcSettings.OtmRelSelectedAttributes = dialog.UpdatedCurrentAttributes;
                    manyToOneListView.Columns.Clear();
                    manyToOneListView.Items.Clear();

                    ListViewColumnHelper.AddColumnsHeader(manyToOneListView,
                                                          typeof(OneToManyRelationshipMetadataInfo),
                                                          ListViewColumnsSettings.RelFirstColumns,
                                                          lvcSettings.OtmRelSelectedAttributes,
                                                          new string[] { });

                    LoadManyToOneRelationships(emd.ManyToOneRelationships);
                }
            }
            break;

            case "tsbManyToManyColumns":
            {
                var dialog = new ColumnSelector(typeof(ManyToManyRelationshipMetadataInfo),
                                                ListViewColumnsSettings.RelFirstColumns,
                                                new string[] { },
                                                lvcSettings.MtmRelSelectedAttributes);

                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    lvcSettings.MtmRelSelectedAttributes = dialog.UpdatedCurrentAttributes;
                    manyToManyListView.Columns.Clear();
                    manyToManyListView.Items.Clear();

                    ListViewColumnHelper.AddColumnsHeader(manyToManyListView,
                                                          typeof(ManyToManyRelationshipMetadataInfo),
                                                          ListViewColumnsSettings.RelFirstColumns,
                                                          lvcSettings.MtmRelSelectedAttributes,
                                                          new string[] { });

                    LoadManyToManyRelationships(emd.ManyToManyRelationships);
                }
            }
            break;

            case "tsbPrivilegeColumns":
            {
                var dialog = new ColumnSelector(typeof(SecurityPrivilegeInfo),
                                                ListViewColumnsSettings.PrivFirstColumns,
                                                new string[] { },
                                                lvcSettings.PrivSelectedAttributes);

                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    lvcSettings.PrivSelectedAttributes = dialog.UpdatedCurrentAttributes;
                    privilegeListView.Columns.Clear();
                    privilegeListView.Items.Clear();

                    ListViewColumnHelper.AddColumnsHeader(privilegeListView,
                                                          typeof(SecurityPrivilegeInfo),
                                                          ListViewColumnsSettings.PrivFirstColumns,
                                                          lvcSettings.PrivSelectedAttributes,
                                                          new string[] { });

                    LoadPrivileges(emd.Privileges);
                }
            }
            break;

            case "tsbKeyColumns":
            {
                var dialog = new ColumnSelector(typeof(KeyMetadataInfo),
                                                ListViewColumnsSettings.KeyFirstColumns,
                                                new string[] { },
                                                lvcSettings.KeySelectedAttributes);

                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    lvcSettings.KeySelectedAttributes = dialog.UpdatedCurrentAttributes;
                    keyListView.Columns.Clear();
                    keyListView.Items.Clear();

                    ListViewColumnHelper.AddColumnsHeader(keyListView,
                                                          typeof(KeyMetadataInfo),
                                                          ListViewColumnsSettings.KeyFirstColumns,
                                                          lvcSettings.KeySelectedAttributes,
                                                          new string[] { });

                    LoadKeys(emd.Keys);
                }
            }
            break;

            default:
            {
                MessageBox.Show(this, "Unexpected source for hiding panels");
            }
            break;
            }

            RaiseOnColumnSettingsUpdated(new ColumnSettingsUpdatedEventArgs {
                Settings = lvcSettings, Control = this
            });
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Joefrank/ReportingWork
 public void LoadColumnSelector(List <string> selectedItems)
 {
     _columnSelector = new ColumnSelector(this, selectedItems);
     _tableSelector.Hide();
     Controls.Add(_columnSelector);
 }