/// <summary> /// Sets the dialog to the mode for selecting a single resource. /// </summary> public override void SelectResource(string[] resTypes, IResourceList baseList, IResource selection) { _listView.AddIconColumn(); ResourceListView2Column col = _listView.AddColumn(ResourceProps.DisplayName); col.Width = 20; col.AutoSize = true; _listView.MultiSelect = false; _dataProvider = new ResourceListDataProvider(baseList); _listView.DataProvider = _dataProvider; bool haveSelection = false; if (selection != null) { haveSelection = _listView.Selection.AddIfPresent(selection); } if (!haveSelection) { _listView.Selection.MoveDown(); } }
/** * Sets the dialog to the mode for selecting multiple resources. */ public override void SelectResources(string[] resTypes, IResourceList baseList, IResourceList selection) { _chkColumn = _listView.AddCheckBoxColumn(); _chkColumn.HandleAllClicks = true; _listView.AddIconColumn(); ResourceListView2Column col = _listView.AddColumn(ResourceProps.DisplayName); col.Width = 20; col.AutoSize = true; _dataProvider = new ResourceListDataProvider(baseList); _listView.DataProvider = _dataProvider; if (selection != null) { foreach (IResource res in selection) { _chkColumn.SetItemCheckState(res, CheckBoxState.Checked); } if (selection.Count > 0) { _listView.Selection.AddIfPresent(selection [0]); } } }
/** * Shows the specified list of correspondents in the pane. */ private void ShowCorrespondents(IResourceList correspondents) { if (_correspondents != null) { _correspondents.Dispose(); } _correspondents = correspondents; _dataProvider = new ResourceListDataProvider(_correspondents); _dataProvider.SetInitialSort(new SortSettings(ResourceProps.DisplayName, true)); _listContacts.DataProvider = _dataProvider; if (_initialSelection != null && _initialSelection.Count > 0) { _listContacts.Selection.AddIfPresent(_initialSelection [0]); } else { EnsureHasSelection(); } if (_selectorMode) { UpdateCheckedResources(); } }