2 writes to SelectionService
System.Windows.Forms.Design (2)
System\Windows\Forms\Design\CommandSet.cs (2)
200
SelectionService
= site.GetService<ISelectionService>();
362
SelectionService
= null;
61 references to SelectionService
System.Windows.Forms.Design (61)
System\Windows\Forms\Design\CommandSet.cs (50)
201
Debug.Assert(
SelectionService
is not null, "CommandSet relies on the selection service, which is unavailable.");
202
SelectionService
?.SelectionChanged += OnSelectionChanged;
361
SelectionService
?.SelectionChanged -= OnSelectionChanged;
474
ICollection selectedComponents =
SelectionService
!.GetSelectedComponents();
709
if (
SelectionService
?.PrimarySelection is IComponent pri)
728
if (
SelectionService
?.PrimarySelection is IComponent comp && TryGetService(out IDesignerHost? host) &&
777
DesignerTransaction trans =
SelectionService
.SelectionCount > 1
778
? host.CreateTransaction(string.Format(SR.DragDropMoveComponents,
SelectionService
.SelectionCount))
801
List<IComponent> selComps = [..
SelectionService
.GetSelectedComponents().Cast<IComponent>()];
909
foreach (IComponent component in
SelectionService
.GetSelectedComponents())
928
if (component ==
SelectionService
.PrimarySelection)
966
if (
SelectionService
is null)
977
ICollection comps =
SelectionService
.GetSelectedComponents();
1114
if (
SelectionService
is null)
1124
ICollection selectedComponents =
SelectionService
.GetSelectedComponents();
1234
if (
SelectionService
is null)
1245
ICollection selectedComponents =
SelectionService
.GetSelectedComponents();
1384
if (
SelectionService
is null)
1429
if (
SelectionService
is null)
1472
SelectionService
.SetSelectedComponents(Array.Empty<object>(), SelectionTypes.Replace);
1552
SelectionService
.SetSelectedComponents(new object[] { commonParent }, SelectionTypes.Replace);
1554
else if (
SelectionService
.PrimarySelection is null)
1556
SelectionService
.SetSelectedComponents(new object[] { host.RootComponent }, SelectionTypes.Replace);
1577
if (site is null ||
SelectionService
is null || !TryGetService(out IDesignerHost? host))
1589
ICollection comps =
SelectionService
.GetSelectedComponents();
1600
SelectionService
.SetSelectedComponents(Array.Empty<object>(), SelectionTypes.Replace);
1762
if (commonParent is not null &&
SelectionService
.PrimarySelection is null)
1797
SelectionService
.SetSelectedComponents(new object[] { commonParent }, SelectionTypes.Replace);
1801
SelectionService
.SetSelectedComponents(new object[] { host.RootComponent }, SelectionTypes.Replace);
1806
if (
SelectionService
.PrimarySelection is null)
1808
SelectionService
.SetSelectedComponents(new object[] { host.RootComponent }, SelectionTypes.Replace);
1908
IComponent? selectedComponent = (IComponent?)
SelectionService
?.PrimarySelection;
2157
SelectionService
?.SetSelectedComponents(selectComps.ToArray(), SelectionTypes.Replace);
2190
if (site is null ||
SelectionService
is null || !TryGetService(out IDesignerHost? host))
2192
Debug.Assert(
SelectionService
is not null, "We need the SelectionService, but we can't find it!");
2223
SelectionService
.SetSelectedComponents(selComps, SelectionTypes.Replace);
2273
if (
SelectionService
is null)
2283
ICollection sel =
SelectionService
.GetSelectedComponents();
2289
object? selPrimary =
SelectionService
.PrimarySelection;
2371
if (
SelectionService
is null)
2384
ICollection sel =
SelectionService
.GetSelectedComponents();
2449
object? obj =
SelectionService
!.PrimarySelection;
2509
if (
SelectionService
is null)
2525
ICollection sel =
SelectionService
.GetSelectedComponents();
2581
object? primary =
SelectionService
.PrimarySelection;
2883
if (
SelectionService
is null)
2892
selCount =
SelectionService
.SelectionCount;
2902
if (baseComponent is not null &&
SelectionService
.GetComponentSelected(baseComponent))
2908
primarySelection =
SelectionService
.PrimarySelection as IComponent;
2914
ICollection selection =
SelectionService
.GetSelectedComponents();
System\Windows\Forms\Design\ControlCommandSet.cs (11)
295
ICollection sel =
SelectionService
.GetSelectedComponents();
513
ISelectionService selSvc =
SelectionService
;
935
ISelectionService selSvc =
SelectionService
;
963
Debug.Assert(
SelectionService
is not null, "Need SelectionService for sizing command");
965
if (
SelectionService
is null)
986
ICollection sel =
SelectionService
.GetSelectedComponents();
1299
Debug.Assert(
SelectionService
is not null, "Need SelectionService for sizing command");
1301
if (
SelectionService
is null)
1308
ICollection selectedComponents =
SelectionService
.GetSelectedComponents();
1361
ISelectionService selSvc =
SelectionService
;
1429
ISelectionService selSvc =
SelectionService
;