Browse Source

Format changes

pull/315/head
tbulle 12 years ago
parent
commit
a3c162e9c0
  1. 39
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineNode.cs
  2. 38
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineNodeBase.cs

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

@ -52,8 +52,7 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView @@ -52,8 +52,7 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView
public static IOutlineNode Create(DesignItem designItem)
{
IOutlineNode node;
if (!outlineNodes.TryGetValue(designItem, out node))
{
if (!outlineNodes.TryGetValue(designItem, out node)) {
node = new OutlineNode(designItem);
outlineNodes[designItem] = node;
}
@ -69,17 +68,12 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView @@ -69,17 +68,12 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView
{
Children.Clear();
if (DesignItem.ContentPropertyName != null)
{
if (DesignItem.ContentPropertyName != null) {
var content = DesignItem.ContentProperty;
if (content.IsCollection)
{
if (content.IsCollection) {
UpdateChildrenCore(content.CollectionElements);
}
else
{
if (content.Value != null)
{
} else {
if (content.Value != null) {
UpdateChildrenCore(new[] { content.Value });
}
}
@ -88,26 +82,17 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView @@ -88,26 +82,17 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView
void UpdateChildrenCore(IEnumerable<DesignItem> items)
{
foreach (var item in items)
{
if (ModelTools.CanSelectComponent(item))
{
foreach (var item in items) {
if (ModelTools.CanSelectComponent(item)) {
var node = OutlineNode.Create(item);
Children.Add(node);
}
else
{
} else {
var content = item.ContentProperty;
if (content != null)
{
if (content.IsCollection)
{
if (content != null) {
if (content.IsCollection) {
UpdateChildrenCore(content.CollectionElements);
}
else
{
if (content.Value != null)
{
} else {
if (content.Value != null) {
UpdateChildrenCore(new[] { content.Value });
}
}

38
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/OutlineNodeBase.cs

@ -33,15 +33,13 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView @@ -33,15 +33,13 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView
var hidden = designItem.Properties.GetAttachedProperty(DesignTimeProperties.IsHiddenProperty).ValueOnInstance;
if (hidden != null && (bool)hidden)
{
if (hidden != null && (bool)hidden) {
_isDesignTimeVisible = false;
((FrameworkElement)DesignItem.Component).Visibility = Visibility.Hidden;
}
var locked = designItem.Properties.GetAttachedProperty(DesignTimeProperties.IsLockedProperty).ValueOnInstance;
if (locked != null && (bool)locked)
{
if (locked != null && (bool)locked) {
_isDesignTimeLocked = true;
}
@ -83,8 +81,7 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView @@ -83,8 +81,7 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView
}
set
{
if (isSelected != value)
{
if (isSelected != value) {
isSelected = value;
SelectionService.SetSelectedComponents(new[] { DesignItem },
value ? SelectionTypes.Add : SelectionTypes.Remove);
@ -150,8 +147,7 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView @@ -150,8 +147,7 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView
{
get
{
if (string.IsNullOrEmpty(DesignItem.Name))
{
if (string.IsNullOrEmpty(DesignItem.Name)) {
return DesignItem.ComponentType.Name;
}
return DesignItem.ComponentType.Name + " (" + DesignItem.Name + ")";
@ -165,8 +161,7 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView @@ -165,8 +161,7 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView
void DesignItem_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (e.PropertyName == DesignItem.ContentPropertyName)
{
if (e.PropertyName == DesignItem.ContentPropertyName) {
UpdateChildren();
}
}
@ -179,8 +174,7 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView @@ -179,8 +174,7 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView
if (placementBehavior == null)
return false;
var operation = PlacementOperation.Start(nodes.Select(node => node.DesignItem).ToArray(), DummyPlacementType);
if (operation != null)
{
if (operation != null) {
bool canEnter = placementBehavior.CanEnterContainer(operation, true);
operation.Abort();
return canEnter;
@ -192,14 +186,10 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView @@ -192,14 +186,10 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView
{
using (var moveTransaction = DesignItem.Context.OpenGroup("Item moved in outline view", nodes.Select(n => n.DesignItem).ToList()))
{
if (copy)
{
if (copy) {
nodes = nodes.Select(n => OutlineNode.Create(n.DesignItem.Clone())).ToList();
}
else
{
foreach (var node in nodes)
{
} else {
foreach (var node in nodes) {
node.DesignItem.Remove();
}
}
@ -207,15 +197,11 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView @@ -207,15 +197,11 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView
var index = after == null ? 0 : Children.IndexOf(after) + 1;
var content = DesignItem.ContentProperty;
if (content.IsCollection)
{
foreach (var node in nodes)
{
if (content.IsCollection) {
foreach (var node in nodes) {
content.CollectionElements.Insert(index++, node.DesignItem);
}
}
else
{
} else {
content.SetValue(nodes.First().DesignItem);
}
moveTransaction.Commit();

Loading…
Cancel
Save