示例#1
0
 public void UpdateUi()
 {
     if (_inUpdateUi)
     {
         return;
     }
     try
     {
         _inUpdateUi = true;
         ListViewHelper.ReplaceItems(listViewLayouts, ViewLayoutList.Layouts.Select(MakeListViewItem).ToArray());
         Text = string.Format(Resources.ManageLayoutsForm_UpdateUi_Manage_layouts_for__0_, ViewLayoutList.ViewName);
         UpdateButtons();
     }
     finally
     {
         _inUpdateUi = false;
     }
 }
示例#2
0
        private void btnRemove_Click(object sender, EventArgs e)
        {
            var selectedIndexes = ListView.SelectedIndices.OfType <int>().ToArray();

            if (selectedIndexes.Length == 0)
            {
                return;
            }
            var newIndexes   = Enumerable.Range(0, ListView.Items.Count).Except(selectedIndexes);
            var newSelection = selectedIndexes.Max() + 1 - selectedIndexes.Length;

            OnColumnsMoved(newIndexes);
            newSelection = Math.Min(newSelection, ListView.Items.Count - 1);
            if (newSelection > 0)
            {
                ListViewHelper.SelectIndex(ListView, newSelection);
            }
        }
示例#3
0
 private void UpdateButtons()
 {
     btnUp.Enabled     = ListViewHelper.IsMoveUpEnabled(listView);
     btnDown.Enabled   = ListViewHelper.IsMoveDownEnabled(listView);
     btnRemove.Enabled = listView.SelectedIndices.Count > 0;
 }
示例#4
0
 public void ReplaceItems(IEnumerable <ListViewItem> items)
 {
     ListViewHelper.ReplaceItems(this, items.ToArray());
 }