예제 #1
0
        IExplorerTreeItem PickResource(IPerformanceCountersByResource counter)
        {
            if (counter != null && counter.ResourceId != Guid.Empty)
            {
                _resourcePicker.SelectResource(counter.ResourceId);
            }
            var hasResult = _resourcePicker.ShowDialog(_environment);

            return(hasResult ? _resourcePicker.SelectedResource : null);
        }
        IExplorerTreeItem PickResource(WindowsGroupPermission permission)
        {
            if (permission != null && permission.ResourceID != Guid.Empty)
            {
                var foundResourceModel = _environment.ResourceRepository?.FindSingle(model => model.ID == permission.ResourceID);
                if (foundResourceModel != null)
                {
                    _resourcePicker.SelectResource(foundResourceModel.ID);
                }
            }
            var hasResult = _resourcePicker.ShowDialog(_environment);

            if (_environment.ResourceRepository != null)
            {
                return(hasResult ? _resourcePicker.SelectedResource : null);
            }
            throw new Exception(@"Server does not exist");
        }