コード例 #1
0
        public void UpdateControl(int activeEntryId = 0)
        {
            var databaseGroups = Model.DatabasesGroups.Find(new DatabaseGroup {
                DatabaseId = _databaseId
            });

            var controlsList = new List <DatabaseViewGroup>();

            foreach (var databaseGroup in databaseGroups)
            {
                var groupMeta = Model.DatabasesGroupsMeta.Get(databaseGroup.DatabaseGroupMetaId);
                if (!_activeGroupSet)
                {
                    _activeGroupSet = true;
                    SetActiveGroup(databaseGroup.Id);
                }

                var control = new DatabaseViewGroup(databaseGroup.Id)
                {
                    Dock         = DockStyle.Top,
                    lblGroupName = { Text = groupMeta.Name },
                    Selected     = databaseGroup.Id == _activeGroupId
                };
                control.Click += DatabaseGroup_Click;
                controlsList.Add(control);
            }

            controlsList = controlsList.OrderByDescending(control => control.lblGroupName.Text).ToList();

            if (_activeGroupSet)
            {
                RefreshEntries(activeEntryId);
                panelEntriesContainer.Visible = true;
                lblNewEntry.Visible           = true;
            }
            else
            {
                panelEntriesContainer.Visible = false;
                lblNewEntry.Visible           = false;
            }

            panelGroupsContainer.Controls.Clear();
            foreach (var control in controlsList)
            {
                panelGroupsContainer.Controls.Add(control);
            }
        }
コード例 #2
0
        public void UpdateControl(int activeEntryId = 0)
        {
            var databaseGroups = Model.DatabasesGroups.Find(new DatabaseGroup {DatabaseId = _databaseId});

            var controlsList = new List<DatabaseViewGroup>();
            foreach (var databaseGroup in databaseGroups)
            {
                var groupMeta = Model.DatabasesGroupsMeta.Get(databaseGroup.DatabaseGroupMetaId);
                if (!_activeGroupSet)
                {
                    _activeGroupSet = true;
                    SetActiveGroup(databaseGroup.Id);
                }

                var control = new DatabaseViewGroup(databaseGroup.Id)
                {
                    Dock = DockStyle.Top,
                    lblGroupName = {Text = groupMeta.Name},
                    Selected = databaseGroup.Id == _activeGroupId
                };
                control.Click += DatabaseGroup_Click;
                controlsList.Add(control);
            }

            controlsList = controlsList.OrderByDescending(control => control.lblGroupName.Text).ToList();

            if (_activeGroupSet)
            {
                RefreshEntries(activeEntryId);
                panelEntriesContainer.Visible = true;
                lblNewEntry.Visible = true;
            }
            else
            {
                panelEntriesContainer.Visible = false;
                lblNewEntry.Visible = false;
            }

            panelGroupsContainer.Controls.Clear();
            foreach (var control in controlsList)
                panelGroupsContainer.Controls.Add(control);
        }