Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit a3c162e

Browse files
author
tbulle
committed
Format changes
1 parent b67af16 commit a3c162e

4 files changed

Lines changed: 283 additions & 312 deletions

File tree

src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/Outline.xaml.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ public Outline()
2525
}
2626

2727
public static readonly DependencyProperty RootProperty =
28-
DependencyProperty.Register("Root", typeof(IOutlineNode), typeof(Outline));
28+
DependencyProperty.Register("Root", typeof(IOutlineNode), typeof(Outline));
2929

30-
public IOutlineNode Root
31-
{
32-
get { return (IOutlineNode)GetValue(RootProperty); }
30+
public IOutlineNode Root
31+
{
32+
get { return (IOutlineNode)GetValue(RootProperty); }
3333
set { SetValue(RootProperty, value); }
3434
}
3535

src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineNode.cs

Lines changed: 74 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -20,100 +20,85 @@
2020
namespace ICSharpCode.WpfDesign.Designer.OutlineView
2121
{
2222
public interface IOutlineNode
23-
{
24-
ISelectionService SelectionService { get; }
25-
bool IsExpanded { get; set; }
26-
DesignItem DesignItem { get; set; }
27-
bool IsSelected { get; set; }
28-
bool IsDesignTimeVisible { get; set; }
29-
bool IsDesignTimeLocked { get; }
30-
string Name { get; }
31-
bool CanInsert(IEnumerable<IOutlineNode> nodes, IOutlineNode after, bool copy);
32-
void Insert(IEnumerable<IOutlineNode> nodes, IOutlineNode after, bool copy);
33-
}
34-
23+
{
24+
ISelectionService SelectionService { get; }
25+
bool IsExpanded { get; set; }
26+
DesignItem DesignItem { get; set; }
27+
bool IsSelected { get; set; }
28+
bool IsDesignTimeVisible { get; set; }
29+
bool IsDesignTimeLocked { get; }
30+
string Name { get; }
31+
bool CanInsert(IEnumerable<IOutlineNode> nodes, IOutlineNode after, bool copy);
32+
void Insert(IEnumerable<IOutlineNode> nodes, IOutlineNode after, bool copy);
33+
}
34+
3535

36-
public class OutlineNode: OutlineNodeBase
37-
{
38-
//TODO: Reset with DesignContext
39-
static Dictionary<DesignItem, IOutlineNode> outlineNodes = new Dictionary<DesignItem, IOutlineNode>();
36+
public class OutlineNode: OutlineNodeBase
37+
{
38+
//TODO: Reset with DesignContext
39+
static Dictionary<DesignItem, IOutlineNode> outlineNodes = new Dictionary<DesignItem, IOutlineNode>();
4040

41-
protected OutlineNode(DesignItem designitem): base(designitem)
42-
{
43-
UpdateChildren();
44-
SelectionService.SelectionChanged += new EventHandler<DesignItemCollectionEventArgs>(Selection_SelectionChanged);
45-
}
41+
protected OutlineNode(DesignItem designitem): base(designitem)
42+
{
43+
UpdateChildren();
44+
SelectionService.SelectionChanged += new EventHandler<DesignItemCollectionEventArgs>(Selection_SelectionChanged);
45+
}
4646

47-
static OutlineNode()
48-
{
49-
DummyPlacementType = PlacementType.Register("DummyPlacement");
50-
}
47+
static OutlineNode()
48+
{
49+
DummyPlacementType = PlacementType.Register("DummyPlacement");
50+
}
5151

52-
public static IOutlineNode Create(DesignItem designItem)
53-
{
54-
IOutlineNode node;
55-
if (!outlineNodes.TryGetValue(designItem, out node))
56-
{
57-
node = new OutlineNode(designItem);
58-
outlineNodes[designItem] = node;
59-
}
60-
return node;
61-
}
52+
public static IOutlineNode Create(DesignItem designItem)
53+
{
54+
IOutlineNode node;
55+
if (!outlineNodes.TryGetValue(designItem, out node)) {
56+
node = new OutlineNode(designItem);
57+
outlineNodes[designItem] = node;
58+
}
59+
return node;
60+
}
6261

63-
void Selection_SelectionChanged(object sender, DesignItemCollectionEventArgs e)
64-
{
65-
IsSelected = DesignItem.Services.Selection.IsComponentSelected(DesignItem);
66-
}
62+
void Selection_SelectionChanged(object sender, DesignItemCollectionEventArgs e)
63+
{
64+
IsSelected = DesignItem.Services.Selection.IsComponentSelected(DesignItem);
65+
}
6766

68-
protected override void UpdateChildren()
69-
{
70-
Children.Clear();
67+
protected override void UpdateChildren()
68+
{
69+
Children.Clear();
7170

72-
if (DesignItem.ContentPropertyName != null)
73-
{
74-
var content = DesignItem.ContentProperty;
75-
if (content.IsCollection)
76-
{
77-
UpdateChildrenCore(content.CollectionElements);
78-
}
79-
else
80-
{
81-
if (content.Value != null)
82-
{
83-
UpdateChildrenCore(new[] { content.Value });
84-
}
85-
}
86-
}
87-
}
71+
if (DesignItem.ContentPropertyName != null) {
72+
var content = DesignItem.ContentProperty;
73+
if (content.IsCollection) {
74+
UpdateChildrenCore(content.CollectionElements);
75+
} else {
76+
if (content.Value != null) {
77+
UpdateChildrenCore(new[] { content.Value });
78+
}
79+
}
80+
}
81+
}
8882

89-
void UpdateChildrenCore(IEnumerable<DesignItem> items)
90-
{
91-
foreach (var item in items)
92-
{
93-
if (ModelTools.CanSelectComponent(item))
94-
{
95-
var node = OutlineNode.Create(item);
96-
Children.Add(node);
97-
}
98-
else
99-
{
100-
var content = item.ContentProperty;
101-
if (content != null)
102-
{
103-
if (content.IsCollection)
104-
{
105-
UpdateChildrenCore(content.CollectionElements);
106-
}
107-
else
108-
{
109-
if (content.Value != null)
110-
{
111-
UpdateChildrenCore(new[] { content.Value });
112-
}
113-
}
114-
}
115-
}
116-
}
117-
}
118-
}
119-
}
83+
void UpdateChildrenCore(IEnumerable<DesignItem> items)
84+
{
85+
foreach (var item in items) {
86+
if (ModelTools.CanSelectComponent(item)) {
87+
var node = OutlineNode.Create(item);
88+
Children.Add(node);
89+
} else {
90+
var content = item.ContentProperty;
91+
if (content != null) {
92+
if (content.IsCollection) {
93+
UpdateChildrenCore(content.CollectionElements);
94+
} else {
95+
if (content.Value != null) {
96+
UpdateChildrenCore(new[] { content.Value });
97+
}
98+
}
99+
}
100+
}
101+
}
102+
}
103+
}
104+
}

0 commit comments

Comments
 (0)