Browse Source

XamlBinding:

- improved code completion
- added drag and drop functionality to EditGridColumnsAndRowsDialog

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@4508 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Siegfried Pammer 17 years ago
parent
commit
abf561acc0
  1. 17
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/CompletionDataHelper.cs
  2. 11
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/Extensions.cs
  3. 29
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Commands/CreateBusinessFormCommand.cs
  4. 10
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Commands/CreateBusinessFormFromClassCommand.cs
  5. 37
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Dialogs/EditGridColumnsAndRowsDialog.xaml
  6. 272
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Dialogs/EditGridColumnsAndRowsDialog.xaml.cs
  7. 8
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Dialogs/SelectSourceClassDialog.xaml
  8. 30
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Dialogs/SelectSourceClassDialog.xaml.cs
  9. 52
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Dialogs/SourceClassFormEditor.xaml
  10. 58
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Dialogs/SourceClassFormEditor.xaml.cs
  11. 6
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlBinding.csproj
  12. 35
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCodeCompletionBinding.cs
  13. 20
      src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlColorizer.cs
  14. 78
      src/AddIns/Misc/Profiler/Profiler.sln

17
src/AddIns/BackendBindings/XamlBinding/XamlBinding/CompletionDataHelper.cs

@ -505,7 +505,11 @@ namespace ICSharpCode.XamlBinding
{ {
var list = new XamlCompletionItemList(); var list = new XamlCompletionItemList();
string visibleValue = context.RawAttributeValue.Substring(0, context.ValueStartOffset + 1); string visibleValue = context.RawAttributeValue.Substring(0, context.ValueStartOffset + 1);
var markup = Utils.GetInnermostMarkupExtensionInfo(MarkupExtensionParser.Parse(visibleValue)); if (context.PressedKey == '=')
visibleValue += "=";
context.RawAttributeValue = visibleValue;
context.AttributeValue = MarkupExtensionParser.ParseValue(visibleValue);
var markup = Utils.GetInnermostMarkupExtensionInfo(context.AttributeValue.ExtensionValue);
var type = ResolveType(markup.ExtensionType, context) ?? ResolveType(markup.ExtensionType + "Extension", context); var type = ResolveType(markup.ExtensionType, context) ?? ResolveType(markup.ExtensionType + "Extension", context);
if (type == null) { if (type == null) {
@ -530,7 +534,7 @@ namespace ICSharpCode.XamlBinding
int lastStart = markup.NamedArguments.Max(i => i.Value.StartOffset); int lastStart = markup.NamedArguments.Max(i => i.Value.StartOffset);
var item = markup.NamedArguments.First(p => p.Value.StartOffset == lastStart); var item = markup.NamedArguments.First(p => p.Value.StartOffset == lastStart);
if (context.Editor.Document.GetCharAt(context.Editor.Caret.Offset - 1) == '=' || if (context.RawAttributeValue.EndsWith("=") ||
(item.Value.IsString && item.Value.StringValue.EndsWith(context.Editor.GetWordBeforeCaretExtended()))) { (item.Value.IsString && item.Value.StringValue.EndsWith(context.Editor.GetWordBeforeCaretExtended()))) {
MemberResolveResult mrr = XamlResolver.ResolveMember(item.Key, context) as MemberResolveResult; MemberResolveResult mrr = XamlResolver.ResolveMember(item.Key, context) as MemberResolveResult;
if (mrr != null && mrr.ResolvedMember != null && mrr.ResolvedMember.ReturnType != null) { if (mrr != null && mrr.ResolvedMember != null && mrr.ResolvedMember.ReturnType != null) {
@ -604,9 +608,16 @@ namespace ICSharpCode.XamlBinding
{ {
if (type == null || type.GetUnderlyingClass() == null) if (type == null || type.GetUnderlyingClass() == null)
yield break; yield break;
var c = type.GetUnderlyingClass(); var c = type.GetUnderlyingClass();
if (type is ConstructedReturnType && type.TypeArgumentCount > 0 && c.FullyQualifiedName == "System.Nullable") {
ConstructedReturnType rt = type as ConstructedReturnType;
c = rt.TypeArguments.First().GetUnderlyingClass();
if (c == null)
yield break;
}
switch (c.ClassType) { switch (c.ClassType) {
case ClassType.Class: case ClassType.Class:
switch (c.FullyQualifiedName) { switch (c.FullyQualifiedName) {

11
src/AddIns/BackendBindings/XamlBinding/XamlBinding/Extensions.cs

@ -5,12 +5,15 @@
// <version>$Revision$</version> // <version>$Revision$</version>
// </file> // </file>
using ICSharpCode.AvalonEdit.Document;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Xml; using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
using ICSharpCode.AvalonEdit.Document;
using ICSharpCode.NRefactory; using ICSharpCode.NRefactory;
using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom; using ICSharpCode.SharpDevelop.Dom;
@ -30,6 +33,12 @@ namespace ICSharpCode.XamlBinding
return element; return element;
} }
public static void AddRange(this UIElementCollection coll, IEnumerable<UIElement> items)
{
foreach (var item in items)
coll.Add(item);
}
public static string[] Split(this string thisValue, StringSplitOptions options, params char[] delimiters) public static string[] Split(this string thisValue, StringSplitOptions options, params char[] delimiters)
{ {
if (thisValue == null) if (thisValue == null)

29
src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Commands/CreateBusinessFormCommand.cs

@ -0,0 +1,29 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
// <version>$Revision$</version>
// </file>
using System;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
namespace ICSharpCode.XamlBinding.PowerToys.Commands
{
/// <summary>
/// Description of CreateBusinessFormCommand
/// </summary>
public class CreateBusinessFormCommand : AbstractMenuCommand
{
/// <summary>
/// Starts the command
/// </summary>
public override void Run()
{
// TODO: Add your code here !!!
}
}
}

10
src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Commands/CreateBusinessFormFromClassCommand.cs

@ -21,7 +21,15 @@ namespace ICSharpCode.XamlBinding.PowerToys.Commands
/// </summary> /// </summary>
public override void Run() public override void Run()
{ {
new SelectSourceClassDialog().ShowDialog(); SelectSourceClassDialog selectSourceClass = new SelectSourceClassDialog();
if (selectSourceClass.ShowDialog() ?? false) {
SourceClassFormEditor editor = new SourceClassFormEditor(selectSourceClass.SelectedClass);
if (editor.ShowDialog() ?? false) {
return;
}
}
} }
} }
} }

37
src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Dialogs/EditGridColumnsAndRowsDialog.xaml

@ -9,14 +9,39 @@
<Setter Property="Margin" Value="3" /> <Setter Property="Margin" Value="3" />
<Setter Property="Padding" Value="3" /> <Setter Property="Padding" Value="3" />
</Style> </Style>
<ControlTemplate x:Key="itemTemplate" TargetType="{x:Type Label}">
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="MouseEnter">
<BeginStoryboard>
<Storyboard>
<ColorAnimation
Storyboard.TargetName="BorderControl" Storyboard.TargetProperty="Background.Color"
From="Gray" To="DarkGray" Duration="0:0:0.1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="MouseLeave">
<BeginStoryboard>
<Storyboard>
<ColorAnimation
Storyboard.TargetName="BorderControl" Storyboard.TargetProperty="Background.Color"
From="DarkGray" To="Gray" Duration="0:0:0.1" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ControlTemplate.Triggers>
<Border x:Name="BorderControl" Background="Gray" CornerRadius="5" Margin="3" Padding="5">
<DockPanel>
<Button x:Name="btnDeleteItem" Content="r" Tag="{TemplateBinding Tag}" FontFamily="Webdings" FontSize="10" FontWeight="Bold" DockPanel.Dock="Right" Click="BtnDeleteItemClick" />
<TextBlock Text="{TemplateBinding Content}" />
</DockPanel>
</Border>
</ControlTemplate>
</Window.Resources> </Window.Resources>
<DockPanel> <DockPanel>
<StackPanel Orientation="Vertical" DockPanel.Dock="Bottom" HorizontalAlignment="Center"> <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Center">
<TextBlock x:Name="lblInstruction" Visibility="Collapsed" /> <Button x:Name="btnOK" Content="{sd:Localize Global.OKButtonText}" Click="BtnOKClick" Style="{StaticResource normal}" />
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> <Button x:Name="btnCancel" Content="{sd:Localize Global.CancelButtonText}" Click="BtnCancelClick" Style="{StaticResource normal}" />
<Button x:Name="btnOK" Content="{sd:Localize Global.OKButtonText}" Click="BtnOKClick" Style="{StaticResource normal}" />
<Button x:Name="btnCancel" Content="{sd:Localize Global.CancelButtonText}" Click="BtnCancelClick" Style="{StaticResource normal}" />
</StackPanel>
</StackPanel> </StackPanel>
<Grid x:Name="gridDisplay" /> <Grid x:Name="gridDisplay" />
</DockPanel> </DockPanel>

272
src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Dialogs/EditGridColumnsAndRowsDialog.xaml.cs

@ -37,8 +37,6 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
XElement rowDefitions; XElement rowDefitions;
XElement colDefitions; XElement colDefitions;
IList<XElement> additionalProperties; IList<XElement> additionalProperties;
int selectedCellX = -1, selectedCellY = -1;
bool? swap = null;
class UndoStep class UndoStep
{ {
@ -91,10 +89,13 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
this.redoStack = new Stack<UndoStep>(); this.redoStack = new Stack<UndoStep>();
this.undoStack = new Stack<UndoStep>(); this.undoStack = new Stack<UndoStep>();
CommandBindings.Add(new CommandBinding(ApplicationCommands.Undo, delegate { UndoItemClick(null, null); }));
CommandBindings.Add(new CommandBinding(ApplicationCommands.Redo, delegate { RedoItemClick(null, null); }));
RebuildGrid(); RebuildGrid();
} }
MenuItem CreateItem(string header, Action<TextBlock> clickAction, TextBlock senderItem) MenuItem CreateItem(string header, Action<StackPanel> clickAction, StackPanel senderItem)
{ {
MenuItem item = new MenuItem(); MenuItem item = new MenuItem();
@ -104,7 +105,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
return item; return item;
} }
void InsertAbove(TextBlock block) void InsertAbove(StackPanel block)
{ {
UpdateUndoRedoState(); UpdateUndoRedoState();
@ -142,7 +143,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
RebuildGrid(); RebuildGrid();
} }
void InsertBelow(TextBlock block) void InsertBelow(StackPanel block)
{ {
UpdateUndoRedoState(); UpdateUndoRedoState();
@ -180,7 +181,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
RebuildGrid(); RebuildGrid();
} }
void MoveUp(TextBlock block) void MoveUp(StackPanel block)
{ {
int row = (int)block.GetValue(Grid.RowProperty); int row = (int)block.GetValue(Grid.RowProperty);
if (row > 0) { if (row > 0) {
@ -241,7 +242,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
} }
} }
void MoveDown(TextBlock block) void MoveDown(StackPanel block)
{ {
int row = (int)block.GetValue(Grid.RowProperty); int row = (int)block.GetValue(Grid.RowProperty);
if (row < rowDefitions.Elements().Count() - 1) { if (row < rowDefitions.Elements().Count() - 1) {
@ -302,7 +303,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
} }
} }
void DeleteRow(TextBlock block) void DeleteRow(StackPanel block)
{ {
int row = (int)block.GetValue(Grid.RowProperty); int row = (int)block.GetValue(Grid.RowProperty);
UpdateUndoRedoState(); UpdateUndoRedoState();
@ -335,7 +336,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
RebuildGrid(); RebuildGrid();
} }
void InsertBefore(TextBlock block) void InsertBefore(StackPanel block)
{ {
int column = (int)block.GetValue(Grid.ColumnProperty); int column = (int)block.GetValue(Grid.ColumnProperty);
UpdateUndoRedoState(); UpdateUndoRedoState();
@ -372,7 +373,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
RebuildGrid(); RebuildGrid();
} }
void InsertAfter(TextBlock block) void InsertAfter(StackPanel block)
{ {
int column = (int)block.GetValue(Grid.ColumnProperty); int column = (int)block.GetValue(Grid.ColumnProperty);
UpdateUndoRedoState(); UpdateUndoRedoState();
@ -409,7 +410,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
RebuildGrid(); RebuildGrid();
} }
void MoveLeft(TextBlock block) void MoveLeft(StackPanel block)
{ {
int column = (int)block.GetValue(Grid.ColumnProperty); int column = (int)block.GetValue(Grid.ColumnProperty);
@ -471,7 +472,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
} }
} }
void MoveRight(TextBlock block) void MoveRight(StackPanel block)
{ {
int column = (int)block.GetValue(Grid.ColumnProperty); int column = (int)block.GetValue(Grid.ColumnProperty);
@ -533,7 +534,7 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
} }
} }
void DeleteColumn(TextBlock block) void DeleteColumn(StackPanel block)
{ {
int column = (int)block.GetValue(Grid.ColumnProperty); int column = (int)block.GetValue(Grid.ColumnProperty);
UpdateUndoRedoState(); UpdateUndoRedoState();
@ -566,50 +567,6 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
RebuildGrid(); RebuildGrid();
} }
void SwapContent(TextBlock block)
{
lblInstruction.Text = "Click on the cell you want to swap the selected cell with.";
lblInstruction.Visibility = Visibility.Visible;
this.selectedCellX = (int)block.GetValue(Grid.ColumnProperty);
this.selectedCellY = (int)block.GetValue(Grid.RowProperty);
swap = true;
}
void MoveContent(TextBlock block)
{
lblInstruction.Text = "Click on the cell you want to move the selected content to.";
lblInstruction.Visibility = Visibility.Visible;
this.selectedCellX = (int)block.GetValue(Grid.ColumnProperty);
this.selectedCellY = (int)block.GetValue(Grid.RowProperty);
swap = false;
}
void DeleteContent(TextBlock block)
{
int column = (int)block.GetValue(Grid.ColumnProperty);
int row = (int)block.GetValue(Grid.RowProperty);
UpdateUndoRedoState();
gridTree.Elements()
.Where(
element => {
var colAttrib = element.Attribute(XName.Get("Grid.Column")) ?? new XAttribute(XName.Get("Grid.Column"), 0);
var rowAttrib = element.Attribute(XName.Get("Grid.Row")) ?? new XAttribute(XName.Get("Grid.Row"), 0);
int colAttribValue = 0, rowAttribValue = 0;
if (int.TryParse(colAttrib.Value, out colAttribValue) && int.TryParse(rowAttrib.Value, out rowAttribValue))
return colAttribValue == column && rowAttribValue == row;
return false;
}
).ForEach(item => item.Remove());
RebuildGrid();
}
void BtnCancelClick(object sender, RoutedEventArgs e) void BtnCancelClick(object sender, RoutedEventArgs e)
{ {
this.DialogResult = false; this.DialogResult = false;
@ -620,32 +577,6 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
this.DialogResult = true; this.DialogResult = true;
} }
string BuildDescriptionForCell(int row, int col)
{
StringBuilder builder = new StringBuilder();
var controls = gridTree
.Elements()
.Where(
element => {
var rowAttrib = element.Attribute(XName.Get("Grid.Row")) ?? new XAttribute(XName.Get("Grid.Row"), 0);
var colAttrib = element.Attribute(XName.Get("Grid.Column")) ?? new XAttribute(XName.Get("Grid.Column"), 0);
return row.ToString() == rowAttrib.Value && col.ToString() == colAttrib.Value;
}
);
foreach (var control in controls) {
var nameAttrib = control.Attribute(XName.Get("Name", CompletionDataHelper.XamlNamespace)) ?? control.Attribute(XName.Get("Name"));
if (builder.Length > 0)
builder.Append(", ");
builder.Append(control.Name.LocalName);
if (nameAttrib != null)
builder.Append(" (" + nameAttrib.Value + ")");
}
return builder.ToString();
}
void RebuildGrid() void RebuildGrid()
{ {
this.gridDisplay.Children.Clear(); this.gridDisplay.Children.Clear();
@ -671,19 +602,23 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
this.gridDisplay.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) }); this.gridDisplay.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });
for (int j = 0; j < cols; j++) { for (int j = 0; j < cols; j++) {
TextBlock displayRect = new TextBlock() { StackPanel displayRect = new StackPanel() {
Margin = new Thickness(5), Margin = new Thickness(5),
Background = Brushes.CornflowerBlue, Background = Brushes.LightGray,
Text = BuildDescriptionForCell(i, j), Orientation = Orientation.Vertical
TextAlignment = TextAlignment.Center,
TextWrapping = TextWrapping.Wrap
}; };
displayRect.AllowDrop = true;
displayRect.Drop += new DragEventHandler(DisplayRectDrop);
displayRect.DragOver += new DragEventHandler(DisplayRectDragOver);
displayRect.Children.AddRange(BuildItemsForCell(i, j));
displayRect.SetValue(Grid.RowProperty, i); displayRect.SetValue(Grid.RowProperty, i);
displayRect.SetValue(Grid.ColumnProperty, j); displayRect.SetValue(Grid.ColumnProperty, j);
displayRect.ContextMenuOpening += new ContextMenuEventHandler(DisplayRectContextMenuOpening); displayRect.ContextMenuOpening += new ContextMenuEventHandler(DisplayRectContextMenuOpening);
displayRect.MouseLeftButtonDown += new MouseButtonEventHandler(DisplayRectMouseLeftButtonDown);
this.gridDisplay.Children.Add(displayRect); this.gridDisplay.Children.Add(displayRect);
} }
@ -691,70 +626,75 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
this.InvalidateVisual(); this.InvalidateVisual();
} }
void UpdateUndoRedoState() void DisplayRectDragOver(object sender, DragEventArgs e)
{ {
this.undoStack.Push(UndoStep.CreateStep(gridTree, rowDefitions, colDefitions, additionalProperties)); StackPanel target = sender as StackPanel;
this.redoStack.Clear();
// if (target != null) {
// foreach (UIElement element in target.Children) {
// element.
// }
// }
} }
void DisplayRectMouseLeftButtonDown(object sender, MouseButtonEventArgs e) void DisplayRectDrop(object sender, DragEventArgs e)
{ {
if (selectedCellX > -1 && selectedCellY > -1 && swap.HasValue) { XElement data = e.Data.GetData(typeof(XElement)) as XElement;
if (data != null) {
UpdateUndoRedoState(); UpdateUndoRedoState();
TextBlock block = sender as TextBlock; StackPanel target = sender as StackPanel;
int targetX = (int)block.GetValue(Grid.ColumnProperty); int x = (int)target.GetValue(Grid.ColumnProperty);
int targetY = (int)block.GetValue(Grid.RowProperty); int y = (int)target.GetValue(Grid.RowProperty);
var elements = gridTree.Elements()
.Where(
element => {
var colAttrib = element.Attribute(XName.Get("Grid.Column")) ?? new XAttribute(XName.Get("Grid.Column"), 0);
var rowAttrib = element.Attribute(XName.Get("Grid.Row")) ?? new XAttribute(XName.Get("Grid.Row"), 0);
int colAttribValue = 0, rowAttribValue = 0;
if (int.TryParse(colAttrib.Value, out colAttribValue) && int.TryParse(rowAttrib.Value, out rowAttribValue))
return colAttribValue == targetX && rowAttribValue == targetY;
return false;
}
).ToList();
var elements2 = gridTree.Elements()
.Where(
element => {
var colAttrib = element.Attribute(XName.Get("Grid.Column")) ?? new XAttribute(XName.Get("Grid.Column"), 0);
var rowAttrib = element.Attribute(XName.Get("Grid.Row")) ?? new XAttribute(XName.Get("Grid.Row"), 0);
int colAttribValue = 0, rowAttribValue = 0;
if (int.TryParse(colAttrib.Value, out colAttribValue) && int.TryParse(rowAttrib.Value, out rowAttribValue))
return colAttribValue == selectedCellX && rowAttribValue == selectedCellY;
return false;
}
).ToList();
if (swap == true) {
elements.ForEach(
element => {
element.SetAttributeValue(XName.Get("Grid.Column"), selectedCellX);
element.SetAttributeValue(XName.Get("Grid.Row"), selectedCellY);
}
);
}
elements2.ForEach( data.SetAttributeValue(XName.Get("Grid.Column"), x);
data.SetAttributeValue(XName.Get("Grid.Row"), y);
}
}
IEnumerable<UIElement> BuildItemsForCell(int row, int column)
{
var controls = gridTree
.Elements()
.Where(
element => { element => {
element.SetAttributeValue(XName.Get("Grid.Column"), targetX); var rowAttrib = element.Attribute(XName.Get("Grid.Row")) ?? new XAttribute(XName.Get("Grid.Row"), 0);
element.SetAttributeValue(XName.Get("Grid.Row"), targetY); var colAttrib = element.Attribute(XName.Get("Grid.Column")) ?? new XAttribute(XName.Get("Grid.Column"), 0);
return row.ToString() == rowAttrib.Value && column.ToString() == colAttrib.Value;
} }
); );
}
lblInstruction.Visibility = Visibility.Collapsed; foreach (var control in controls) {
selectedCellX = selectedCellY = -1; var nameAttrib = control.Attribute(XName.Get("Name", CompletionDataHelper.XamlNamespace)) ?? control.Attribute(XName.Get("Name"));
swap = null; StringBuilder builder = new StringBuilder(control.Name.LocalName);
if (nameAttrib != null)
RebuildGrid(); builder.Append(" (" + nameAttrib.Value + ")");
Label label = new Label() {
Content = builder.ToString(),
Template = this.Resources["itemTemplate"] as ControlTemplate,
AllowDrop = true,
Tag = control
};
label.MouseLeftButtonDown += new MouseButtonEventHandler(LabelMouseLeftButtonDown);
yield return label;
}
}
void LabelMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
DragDropEffects allowedEffects = DragDropEffects.Move;
if (DragDrop.DoDragDrop(sender as Label, (sender as Label).Tag, allowedEffects) != DragDropEffects.None)
RebuildGrid();
}
void UpdateUndoRedoState()
{
this.undoStack.Push(UndoStep.CreateStep(gridTree, rowDefitions, colDefitions, additionalProperties));
this.redoStack.Clear();
} }
public XElement GetConstructedTree() public XElement GetConstructedTree()
@ -778,6 +718,8 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
redoItem.IsEnabled = redoStack.Count > 0; redoItem.IsEnabled = redoStack.Count > 0;
redoItem.Click += new RoutedEventHandler(RedoItemClick); redoItem.Click += new RoutedEventHandler(RedoItemClick);
StackPanel block = sender as StackPanel;
ContextMenu menu = new ContextMenu() { ContextMenu menu = new ContextMenu() {
Items = { Items = {
undoItem, undoItem,
@ -786,33 +728,25 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
new MenuItem() { new MenuItem() {
Header = "Row", Header = "Row",
Items = { Items = {
CreateItem("Insert above", InsertAbove, sender as TextBlock), CreateItem("Insert above", InsertAbove, block),
CreateItem("Insert below", InsertBelow, sender as TextBlock), CreateItem("Insert below", InsertBelow, block),
new Separator(), new Separator(),
CreateItem("Move up", MoveUp, sender as TextBlock), CreateItem("Move up", MoveUp, block),
CreateItem("Move down", MoveDown, sender as TextBlock), CreateItem("Move down", MoveDown, block),
new Separator(), new Separator(),
CreateItem("Delete", DeleteRow, sender as TextBlock) CreateItem("Delete", DeleteRow, block)
} }
}, },
new MenuItem() { new MenuItem() {
Header = "Column", Header = "Column",
Items = { Items = {
CreateItem("Insert before", InsertBefore, sender as TextBlock), CreateItem("Insert before", InsertBefore, block),
CreateItem("Insert after", InsertAfter, sender as TextBlock), CreateItem("Insert after", InsertAfter, block),
new Separator(), new Separator(),
CreateItem("Move left", MoveLeft, sender as TextBlock), CreateItem("Move left", MoveLeft, block),
CreateItem("Move right", MoveRight, sender as TextBlock), CreateItem("Move right", MoveRight, block),
new Separator(), new Separator(),
CreateItem("Delete", DeleteColumn, sender as TextBlock) CreateItem("Delete", DeleteColumn, block)
}
},
new MenuItem() {
Header = "Cell",
Items = {
CreateItem("Swap content", SwapContent, sender as TextBlock),
CreateItem("Move content", MoveContent, sender as TextBlock),
CreateItem("Delete content", DeleteContent, sender as TextBlock)
} }
} }
} }
@ -823,12 +757,14 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
void RedoItemClick(object sender, RoutedEventArgs e) void RedoItemClick(object sender, RoutedEventArgs e)
{ {
HandleSteps(redoStack, undoStack); if (redoStack.Count > 0)
HandleSteps(redoStack, undoStack);
} }
void UndoItemClick(object sender, RoutedEventArgs e) void UndoItemClick(object sender, RoutedEventArgs e)
{ {
HandleSteps(undoStack, redoStack); if (undoStack.Count > 0)
HandleSteps(undoStack, redoStack);
} }
void HandleSteps(Stack<UndoStep> stack1, Stack<UndoStep> stack2) void HandleSteps(Stack<UndoStep> stack1, Stack<UndoStep> stack2)
@ -844,5 +780,17 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
RebuildGrid(); RebuildGrid();
} }
void BtnDeleteItemClick(object sender, RoutedEventArgs e)
{
Button source = sender as Button;
XElement item = source.Tag as XElement;
if (item != null) {
UpdateUndoRedoState();
item.Remove();
}
RebuildGrid();
}
} }
} }

8
src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Dialogs/SelectSourceClassDialog.xaml

@ -1,14 +1,16 @@
<Window x:Class="ICSharpCode.XamlBinding.PowerToys.Dialogs.SelectSourceClassDialog" <Window x:Class="ICSharpCode.XamlBinding.PowerToys.Dialogs.SelectSourceClassDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ICSharpCode.XamlBinding.PowerToys.Dialogs"
xmlns:sd="http://icsharpcode.net/sharpdevelop/core" xmlns:sd="http://icsharpcode.net/sharpdevelop/core"
Title="Select Source Class" Height="500" Width="700" Title="Select Source Class" Height="500" Width="700"
WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow"> WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow">
<Window.Resources> <Window.Resources>
<Style TargetType="{x:Type Button}"> <Style TargetType="{x:Type Button}">
<Setter Property="Margin" Value="3" /> <Setter Property="Margin" Value="3" />
<Setter Property="Padding" Value="3" /> <Setter Property="Padding" Value="3" />
</Style> </Style>
<local:SelectionConverter x:Key="selectionConverter" />
</Window.Resources> </Window.Resources>
<DockPanel> <DockPanel>
<TextBlock Margin="3" TextWrapping="Wrap" DockPanel.Dock="Top" Text="Select the source class for the new business form. If the desired class does not appear in the list, please ensure that all required references are added and rebuild your project. Abstract and static classes are excluded from the list." /> <TextBlock Margin="3" TextWrapping="Wrap" DockPanel.Dock="Top" Text="Select the source class for the new business form. If the desired class does not appear in the list, please ensure that all required references are added and rebuild your project. Abstract and static classes are excluded from the list." />
@ -16,7 +18,7 @@
<TextBlock Text="{Binding Items.Count, ElementName=lvClasses, StringFormat=Count: {0}}" /> <TextBlock Text="{Binding Items.Count, ElementName=lvClasses, StringFormat=Count: {0}}" />
</StatusBar> </StatusBar>
<StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Center"> <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Center">
<Button x:Name="btnOK" Content="{sd:Localize Global.OKButtonText}" Click="BtnOKClick" /> <Button x:Name="btnOK" Content="{sd:Localize Global.OKButtonText}" Click="BtnOKClick" IsEnabled="{Binding SelectedIndex, ElementName=lvClasses, Converter={StaticResource selectionConverter}}" />
<Button x:Name="btnCancel" Content="{sd:Localize Global.CancelButtonText}" Click="BtnCancelClick" /> <Button x:Name="btnCancel" Content="{sd:Localize Global.CancelButtonText}" Click="BtnCancelClick" />
</StackPanel> </StackPanel>
<TextBox Margin="3" DockPanel.Dock="Top" x:Name="txtFilter" TextChanged="TxtFilterTextChanged" /> <TextBox Margin="3" DockPanel.Dock="Top" x:Name="txtFilter" TextChanged="TxtFilterTextChanged" />

30
src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Dialogs/SelectSourceClassDialog.xaml.cs

@ -33,6 +33,14 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
public string Name { get; set; } public string Name { get; set; }
} }
bool HasSelection {
get { return this.lvClasses.SelectedIndex != -1; }
}
public IClass SelectedClass {
get { return HasSelection ? ((ClassWrapper)this.lvClasses.SelectedItem).Class : null; }
}
public SelectSourceClassDialog() public SelectSourceClassDialog()
{ {
InitializeComponent(); InitializeComponent();
@ -64,7 +72,27 @@ namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
static bool Filter(string value, ClassWrapper item) static bool Filter(string value, ClassWrapper item)
{ {
return item.Name.Contains(value); return item.Name.IndexOf(value, StringComparison.OrdinalIgnoreCase) > -1;
}
}
public class SelectionConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is int) {
return ((int)value) != -1;
}
return false;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value is bool)
return ((bool)value) ? 0 : -1;
return -1;
} }
} }
} }

52
src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Dialogs/SourceClassFormEditor.xaml

@ -0,0 +1,52 @@
<Window x:Class="ICSharpCode.XamlBinding.PowerToys.Dialogs.SourceClassFormEditor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Create Business Form for Class: " WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow">
<Window.Resources>
<Style TargetType="{x:Type ListBox}">
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
<TextBlock Margin="3">
<Bold>Select Object To Create:</Bold>
</TextBlock>
<ComboBox x:Name="cmbType" Margin="3">
<ComboBox.Items>
<ComboBoxItem Content="Business Form" IsSelected="True" />
</ComboBox.Items>
</ComboBox>
<TextBlock Text="Column Groups:" Margin="3" />
<TextBox x:Name="txtColumnGroupCount" Margin="3" Width="50" TextChanged="TxtColumnGroupCountTextChanged" />
<TextBlock Text="Form Title:" Margin="3" />
<TextBox x:Name="txtFormTitle" Margin="3" Width="150" />
<CheckBox Content="Wrap In Border" Margin="3" />
<CheckBox Content="Include Button Row" Margin="3" />
</StackPanel>
<DockPanel Grid.Column="0" Grid.Row="1">
<Label DockPanel.Dock="Top" Content="Class Properties" Margin="5" />
<ListBox x:Name="lsClassProperties" />
</DockPanel>
<GridSplitter Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left" Width="5" />
<Grid x:Name="displayGrid" Grid.Column="1" Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
</Grid>
</Grid>
</Window>

58
src/AddIns/BackendBindings/XamlBinding/XamlBinding/PowerToys/Dialogs/SourceClassFormEditor.xaml.cs

@ -0,0 +1,58 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Siegfried Pammer" email="sie_pam@gmx.at"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.SharpDevelop.Dom;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
namespace ICSharpCode.XamlBinding.PowerToys.Dialogs
{
/// <summary>
/// Interaction logic for SourceClassFormEditor.xaml
/// </summary>
public partial class SourceClassFormEditor : Window
{
IClass selectedClass;
public SourceClassFormEditor(IClass selectedClass)
{
InitializeComponent();
this.selectedClass = selectedClass;
this.Title += selectedClass.Name;
this.lsClassProperties.ItemsSource = selectedClass.Properties.Select(item => new { Property = item, Name = item.Name, IsSelected = false });
}
void TxtColumnGroupCountTextChanged(object sender, TextChangedEventArgs e)
{
int columnCount;
if (int.TryParse(txtColumnGroupCount.Text, out columnCount)) {
for (int i = displayGrid.ColumnDefinitions.Count; i < columnCount; i++) {
displayGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) });
displayGrid.Children.Add(CreateGridSplitter(i));
}
}
}
GridSplitter CreateGridSplitter(int column)
{
GridSplitter splitter = new GridSplitter() { Width = 5, HorizontalAlignment = HorizontalAlignment.Left };
splitter.SetValue(Grid.ColumnProperty, column);
return splitter;
}
}
}

6
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlBinding.csproj

@ -80,6 +80,7 @@
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="Options\XamlBindingOptions.cs" /> <Compile Include="Options\XamlBindingOptions.cs" />
<Compile Include="PowerToys\Commands\CreateBusinessFormCommand.cs" />
<Compile Include="PowerToys\Commands\CreateBusinessFormFromClassCommand.cs" /> <Compile Include="PowerToys\Commands\CreateBusinessFormFromClassCommand.cs" />
<Compile Include="PowerToys\Commands\EditGridColumnsAndRowsCommand.cs" /> <Compile Include="PowerToys\Commands\EditGridColumnsAndRowsCommand.cs" />
<Compile Include="PowerToys\Commands\ExtractPropertiesAsStyleCommand.cs" /> <Compile Include="PowerToys\Commands\ExtractPropertiesAsStyleCommand.cs" />
@ -99,6 +100,10 @@
<DependentUpon>SelectSourceClassDialog.xaml</DependentUpon> <DependentUpon>SelectSourceClassDialog.xaml</DependentUpon>
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Include="PowerToys\Dialogs\SourceClassFormEditor.xaml.cs">
<DependentUpon>SourceClassFormEditor.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="PowerToys\XamlMenuCommand.cs" /> <Compile Include="PowerToys\XamlMenuCommand.cs" />
<Compile Include="QualifiedNameWithLocation.cs" /> <Compile Include="QualifiedNameWithLocation.cs" />
<Compile Include="Utils.cs"> <Compile Include="Utils.cs">
@ -176,5 +181,6 @@
<Page Include="PowerToys\Dialogs\EditGridColumnsAndRowsDialog.xaml" /> <Page Include="PowerToys\Dialogs\EditGridColumnsAndRowsDialog.xaml" />
<Page Include="PowerToys\Dialogs\ExtractPropertiesAsStyleDialog.xaml" /> <Page Include="PowerToys\Dialogs\ExtractPropertiesAsStyleDialog.xaml" />
<Page Include="PowerToys\Dialogs\SelectSourceClassDialog.xaml" /> <Page Include="PowerToys\Dialogs\SelectSourceClassDialog.xaml" />
<Page Include="PowerToys\Dialogs\SourceClassFormEditor.xaml" />
</ItemGroup> </ItemGroup>
</Project> </Project>

35
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlCodeCompletionBinding.cs

@ -48,17 +48,25 @@ namespace ICSharpCode.XamlBinding
return CodeCompletionKeyPressResult.Completed; return CodeCompletionKeyPressResult.Completed;
case '>': case '>':
return CodeCompletionKeyPressResult.None; return CodeCompletionKeyPressResult.None;
case '\'':
case '"': case '"':
if (!XmlParser.IsInsideAttributeValue(editor.Document.Text, editor.Caret.Offset)) { if (!XmlParser.IsInsideAttributeValue(editor.Document.Text, editor.Caret.Offset)) {
// count all " or ' chars before the next > char
int search = editor.Caret.Offset + 1; int search = editor.Caret.Offset + 1;
while (search < editor.Document.TextLength - 1 && char.IsWhiteSpace(editor.Document.GetCharAt(search))) int endMarkerCount = 1;
char curCh = editor.Document.GetCharAt(search);
while (search < editor.Document.TextLength - 1 && curCh != '>') {
if (curCh == ch)
endMarkerCount++;
search++; search++;
curCh = editor.Document.GetCharAt(search);
if (editor.Document.GetCharAt(search) != '"') { }
editor.Document.Insert(editor.Caret.Offset, "\"\""); // if the count is odd we need to add an additional " or ' char
if (endMarkerCount % 2 != 0) {
editor.Document.Insert(editor.Caret.Offset, ch.ToString());
editor.Caret.Offset--; editor.Caret.Offset--;
this.CtrlSpace(editor); this.CtrlSpace(editor);
return CodeCompletionKeyPressResult.EatKey; return CodeCompletionKeyPressResult.Completed;
} }
} }
break; break;
@ -66,11 +74,11 @@ namespace ICSharpCode.XamlBinding
if (context.AttributeName != null if (context.AttributeName != null
&& XmlParser.IsInsideAttributeValue(editor.Document.Text, editor.Caret.Offset) && XmlParser.IsInsideAttributeValue(editor.Document.Text, editor.Caret.Offset)
&& !(context.RawAttributeValue.StartsWith("{}") && context.RawAttributeValue.Length != 2)) { && !(context.RawAttributeValue.StartsWith("{}") && context.RawAttributeValue.Length != 2)) {
editor.Document.Insert(editor.Caret.Offset, "{}"); editor.Document.Insert(editor.Caret.Offset, "}");
editor.Caret.Offset--; editor.Caret.Offset--;
DoMarkupExtensionCompletion(CompletionDataHelper.ResolveCompletionContext(editor, '{')); DoMarkupExtensionCompletion(CompletionDataHelper.ResolveCompletionContext(editor, '{'));
return CodeCompletionKeyPressResult.EatKey; return CodeCompletionKeyPressResult.Completed;
} }
break; break;
case '.': case '.':
@ -85,7 +93,7 @@ namespace ICSharpCode.XamlBinding
break; break;
case ':': case ':':
if (context.ActiveElement != null && XmlParser.GetQualifiedAttributeNameAtIndex(editor.Document.Text, editor.Caret.Offset) == null) { if (context.ActiveElement != null && XmlParser.GetQualifiedAttributeNameAtIndex(editor.Document.Text, editor.Caret.Offset) == null) {
if (!context.AttributeName.Name.StartsWith("xmlns")) { if (context.AttributeName != null && !context.AttributeName.Name.StartsWith("xmlns")) {
list = CompletionDataHelper.CreateListForContext(context); list = CompletionDataHelper.CreateListForContext(context);
list.PreselectionLength = editor.GetWordBeforeCaretExtended().Length; list.PreselectionLength = editor.GetWordBeforeCaretExtended().Length;
editor.ShowCompletionWindow(list); editor.ShowCompletionWindow(list);
@ -99,6 +107,9 @@ namespace ICSharpCode.XamlBinding
if (!XmlParser.IsInsideAttributeValue(editor.Document.Text, editor.Caret.Offset)) { if (!XmlParser.IsInsideAttributeValue(editor.Document.Text, editor.Caret.Offset)) {
int searchOffset = editor.Caret.Offset; int searchOffset = editor.Caret.Offset;
if (editor.SelectionLength != 0)
editor.Document.Remove(editor.SelectionStart, editor.SelectionLength);
while (searchOffset < editor.Document.TextLength - 1) { while (searchOffset < editor.Document.TextLength - 1) {
searchOffset++; searchOffset++;
if (!char.IsWhiteSpace(editor.Document.GetCharAt(searchOffset))) if (!char.IsWhiteSpace(editor.Document.GetCharAt(searchOffset)))
@ -116,11 +127,8 @@ namespace ICSharpCode.XamlBinding
this.CtrlSpace(editor); this.CtrlSpace(editor);
return CodeCompletionKeyPressResult.EatKey; return CodeCompletionKeyPressResult.EatKey;
} else { } else {
editor.Document.Insert(editor.Caret.Offset, "=");
context = CompletionDataHelper.ResolveCompletionContext(editor, '=');
DoMarkupExtensionCompletion(context); DoMarkupExtensionCompletion(context);
return CodeCompletionKeyPressResult.EatKey; return CodeCompletionKeyPressResult.Completed;
} }
default: default:
if (context.Description != XamlContextDescription.None && !char.IsWhiteSpace(ch)) { if (context.Description != XamlContextDescription.None && !char.IsWhiteSpace(ch)) {
@ -322,7 +330,8 @@ namespace ICSharpCode.XamlBinding
if (!XamlBindingOptions.UseExtensionCompletion) if (!XamlBindingOptions.UseExtensionCompletion)
return false; return false;
XamlCompletionItemList completionList = CompletionDataHelper.CreateMarkupExtensionCompletion(context) as XamlCompletionItemList; XamlCompletionItemList completionList = CompletionDataHelper.CreateMarkupExtensionCompletion(context) as XamlCompletionItemList;
completionList.PreselectionLength = context.Editor.GetWordBeforeCaretExtended().Length; if (context.PressedKey != '.' && context.PressedKey != '=' && completionList.PreselectionLength == 0)
completionList.PreselectionLength = context.Editor.GetWordBeforeCaretExtended().Length;
context.Editor.ShowCompletionWindow(completionList); context.Editor.ShowCompletionWindow(completionList);
var insightList = CompletionDataHelper.CreateMarkupExtensionInsight(context); var insightList = CompletionDataHelper.CreateMarkupExtensionInsight(context);
context.Editor.ShowInsightWindow(insightList); context.Editor.ShowInsightWindow(insightList);

20
src/AddIns/BackendBindings/XamlBinding/XamlBinding/XamlColorizer.cs

@ -57,7 +57,9 @@ namespace ICSharpCode.XamlBinding
// output // output
public IList<Highlight> GetResults() public IList<Highlight> GetResults()
{ {
return results; lock (this) {
return results;
}
} }
Tasks.Task task; Tasks.Task task;
@ -77,8 +79,7 @@ namespace ICSharpCode.XamlBinding
public void Invalidate(string fileContent, string fileName, DocumentLine currentLine, TextView textView) public void Invalidate(string fileContent, string fileName, DocumentLine currentLine, TextView textView)
{ {
task.Cancel(); task.CancelAndWait();
this.Invalid = false;
this.FileContent = fileContent; this.FileContent = fileContent;
this.FileName = fileName; this.FileName = fileName;
@ -148,12 +149,12 @@ namespace ICSharpCode.XamlBinding
} }
if (context.Description != XamlContextDescription.InComment && !string.IsNullOrEmpty(attribute)) { if (context.Description != XamlContextDescription.InComment && !string.IsNullOrEmpty(attribute)) {
int startIndex = LineText.Substring(0, Math.Min(index, LineText.Length)).LastIndexOf(attribute); int startIndex = LineText.Substring(0, Math.Min(index, LineText.Length)).LastIndexOf(attribute);
if (startIndex >= 0) { if (startIndex >= 0) {
if (propertyNameIndex > -1) if (propertyNameIndex > -1)
infos.Add(new HighlightingInfo(attribute.Trim('/'), startIndex + propertyNameIndex + 1, startIndex + attribute.TrimEnd('/').Length, Offset, context)); infos.Add(new HighlightingInfo(attribute.Trim('/'), startIndex + propertyNameIndex + 1, startIndex + attribute.TrimEnd('/').Length, Offset, context));
else else
infos.Add(new HighlightingInfo(attribute, startIndex, startIndex + attribute.Length, Offset, context)); infos.Add(new HighlightingInfo(attribute, startIndex, startIndex + attribute.Length, Offset, context));
} }
} }
} }
} while (index > -1); } while (index > -1);
@ -214,6 +215,7 @@ namespace ICSharpCode.XamlBinding
} else { } else {
HighlightTask task = highlightCache[line]; HighlightTask task = highlightCache[line];
if (task.CompletedSuccessfully) { if (task.CompletedSuccessfully) {
task.Invalid = false;
foreach (var result in task.GetResults()) { foreach (var result in task.GetResults()) {
ColorizeMember(result.Info, line, result.Member); ColorizeMember(result.Info, line, result.Member);
} }

78
src/AddIns/Misc/Profiler/Profiler.sln

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 10.00 Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2008 # Visual Studio 10
# SharpDevelop 3.1.0.4082 # SharpDevelop 4.0.0.4504
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5147BA25-8362-481D-8CF9-450096595B7A}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{5147BA25-8362-481D-8CF9-450096595B7A}"
ProjectSection(SolutionItems) = preProject ProjectSection(SolutionItems) = preProject
TODO.txt = TODO.txt TODO.txt = TODO.txt
@ -13,12 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Frontend", "Frontend", "{E0
ProjectSection(SolutionItems) = postProject ProjectSection(SolutionItems) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Controls", "Frontend\Controls\Controls.csproj", "{BDA49550-5ED1-4C6B-B648-657B2CACD8E0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddIn", "Frontend\AddIn\AddIn.csproj", "{D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BenchmarkRunner", "Frontend\BenchmarkRunner\BenchmarkRunner.csproj", "{DBEF953E-F7BC-4D54-8A27-B758EC875C49}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gui", "Frontend\Gui\Gui.csproj", "{FF09FBA1-86DA-4D8D-B549-A4FC70FC5AE9}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gui", "Frontend\Gui\Gui.csproj", "{FF09FBA1-86DA-4D8D-B549-A4FC70FC5AE9}"
ProjectSection(ProjectDependencies) = postProject ProjectSection(ProjectDependencies) = postProject
{D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B} = {D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B} {D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B} = {D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B}
@ -27,19 +21,25 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Gui", "Frontend\Gui\Gui.csp
{778BA9AE-EE77-444F-A0C9-D795BB977C1A} = {778BA9AE-EE77-444F-A0C9-D795BB977C1A} {778BA9AE-EE77-444F-A0C9-D795BB977C1A} = {778BA9AE-EE77-444F-A0C9-D795BB977C1A}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BenchmarkRunner", "Frontend\BenchmarkRunner\BenchmarkRunner.csproj", "{DBEF953E-F7BC-4D54-8A27-B758EC875C49}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddIn", "Frontend\AddIn\AddIn.csproj", "{D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Controls", "Frontend\Controls\Controls.csproj", "{BDA49550-5ED1-4C6B-B648-657B2CACD8E0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{791AE00B-AD96-410A-AAA8-957DDD83C57A}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{791AE00B-AD96-410A-AAA8-957DDD83C57A}"
ProjectSection(SolutionItems) = postProject ProjectSection(SolutionItems) = postProject
EndProjectSection EndProjectSection
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnicodeTest", "Tests\UnicodeTest\UnicodeTest.csproj", "{D336926C-6180-4F62-B88D-E366B240127B}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmark", "Tests\Benchmark\Benchmark.csproj", "{F09B6132-5DF9-4E63-BA23-EE82D75CD5B9}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Profiler.Tests", "Tests\Profiler.Tests\Profiler.Tests.csproj", "{068F9531-5D29-49E0-980E-59982A3A0469}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "Tests\HelloWorld\HelloWorld.csproj", "{778BA9AE-EE77-444F-A0C9-D795BB977C1A}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PauseTest", "Tests\PauseTest\PauseTest.csproj", "{650AEAA0-0678-4A75-A1CC-F46DC4E44D2A}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PauseTest", "Tests\PauseTest\PauseTest.csproj", "{650AEAA0-0678-4A75-A1CC-F46DC4E44D2A}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloWorld", "Tests\HelloWorld\HelloWorld.csproj", "{778BA9AE-EE77-444F-A0C9-D795BB977C1A}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Profiler.Tests", "Tests\Profiler.Tests\Profiler.Tests.csproj", "{068F9531-5D29-49E0-980E-59982A3A0469}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Benchmark", "Tests\Benchmark\Benchmark.csproj", "{F09B6132-5DF9-4E63-BA23-EE82D75CD5B9}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnicodeTest", "Tests\UnicodeTest\UnicodeTest.csproj", "{D336926C-6180-4F62-B88D-E366B240127B}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Hook", "Hook\Hook.vcproj", "{68D5EE3B-0C35-4DF1-BD29-6606851A02C1}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Hook", "Hook\Hook.vcproj", "{68D5EE3B-0C35-4DF1-BD29-6606851A02C1}"
EndProject EndProject
@ -62,6 +62,8 @@ Global
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
Release|Win32 = Release|Win32 Release|Win32 = Release|Win32
Release|x64 = Release|x64 Release|x64 = Release|x64
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FF09FBA1-86DA-4D8D-B549-A4FC70FC5AE9}.Debug|Win32.ActiveCfg = Debug|Any CPU {FF09FBA1-86DA-4D8D-B549-A4FC70FC5AE9}.Debug|Win32.ActiveCfg = Debug|Any CPU
@ -168,19 +170,55 @@ Global
{D336926C-6180-4F62-B88D-E366B240127B}.Release|Win32.ActiveCfg = Release|Win32 {D336926C-6180-4F62-B88D-E366B240127B}.Release|Win32.ActiveCfg = Release|Win32
{D336926C-6180-4F62-B88D-E366B240127B}.Release|x64.Build.0 = Release|x64 {D336926C-6180-4F62-B88D-E366B240127B}.Release|x64.Build.0 = Release|x64
{D336926C-6180-4F62-B88D-E366B240127B}.Release|x64.ActiveCfg = Release|x64 {D336926C-6180-4F62-B88D-E366B240127B}.Release|x64.ActiveCfg = Release|x64
{FE88FE17-D9FB-4FCC-9A35-6BFFB6B26CC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FE88FE17-D9FB-4FCC-9A35-6BFFB6B26CC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FE88FE17-D9FB-4FCC-9A35-6BFFB6B26CC6}.Release|Any CPU.Build.0 = Release|Any CPU
{FE88FE17-D9FB-4FCC-9A35-6BFFB6B26CC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2EACD124-3D84-4F4D-8C82-D3E396A5DA21}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2EACD124-3D84-4F4D-8C82-D3E396A5DA21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2EACD124-3D84-4F4D-8C82-D3E396A5DA21}.Release|Any CPU.Build.0 = Release|Any CPU
{2EACD124-3D84-4F4D-8C82-D3E396A5DA21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72FFB35A-C9E2-4A31-B4FA-E3E3E28DED5F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72FFB35A-C9E2-4A31-B4FA-E3E3E28DED5F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72FFB35A-C9E2-4A31-B4FA-E3E3E28DED5F}.Release|Any CPU.Build.0 = Release|Any CPU
{72FFB35A-C9E2-4A31-B4FA-E3E3E28DED5F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{68D5EE3B-0C35-4DF1-BD29-6606851A02C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{68D5EE3B-0C35-4DF1-BD29-6606851A02C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{68D5EE3B-0C35-4DF1-BD29-6606851A02C1}.Release|Any CPU.Build.0 = Release|Any CPU
{68D5EE3B-0C35-4DF1-BD29-6606851A02C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{650AEAA0-0678-4A75-A1CC-F46DC4E44D2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{650AEAA0-0678-4A75-A1CC-F46DC4E44D2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{650AEAA0-0678-4A75-A1CC-F46DC4E44D2A}.Release|Any CPU.Build.0 = Release|Any CPU
{650AEAA0-0678-4A75-A1CC-F46DC4E44D2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BDA49550-5ED1-4C6B-B648-657B2CACD8E0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BDA49550-5ED1-4C6B-B648-657B2CACD8E0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BDA49550-5ED1-4C6B-B648-657B2CACD8E0}.Release|Any CPU.Build.0 = Release|Any CPU
{BDA49550-5ED1-4C6B-B648-657B2CACD8E0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B}.Release|Any CPU.Build.0 = Release|Any CPU
{D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DBEF953E-F7BC-4D54-8A27-B758EC875C49}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DBEF953E-F7BC-4D54-8A27-B758EC875C49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DBEF953E-F7BC-4D54-8A27-B758EC875C49}.Release|Any CPU.Build.0 = Release|Any CPU
{DBEF953E-F7BC-4D54-8A27-B758EC875C49}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FF09FBA1-86DA-4D8D-B549-A4FC70FC5AE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FF09FBA1-86DA-4D8D-B549-A4FC70FC5AE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FF09FBA1-86DA-4D8D-B549-A4FC70FC5AE9}.Release|Any CPU.Build.0 = Release|Any CPU
{FF09FBA1-86DA-4D8D-B549-A4FC70FC5AE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
EndGlobalSection EndGlobalSection
GlobalSection(NestedProjects) = preSolution GlobalSection(NestedProjects) = preSolution
{FF09FBA1-86DA-4D8D-B549-A4FC70FC5AE9} = {E06867E9-6942-4DB6-89F5-DE0BF56C44DE}
{DBEF953E-F7BC-4D54-8A27-B758EC875C49} = {E06867E9-6942-4DB6-89F5-DE0BF56C44DE}
{D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B} = {E06867E9-6942-4DB6-89F5-DE0BF56C44DE}
{BDA49550-5ED1-4C6B-B648-657B2CACD8E0} = {E06867E9-6942-4DB6-89F5-DE0BF56C44DE} {BDA49550-5ED1-4C6B-B648-657B2CACD8E0} = {E06867E9-6942-4DB6-89F5-DE0BF56C44DE}
{F09B6132-5DF9-4E63-BA23-EE82D75CD5B9} = {791AE00B-AD96-410A-AAA8-957DDD83C57A} {D294A12D-4B38-4F25-9AA6-3D4A6CE26E7B} = {E06867E9-6942-4DB6-89F5-DE0BF56C44DE}
{778BA9AE-EE77-444F-A0C9-D795BB977C1A} = {791AE00B-AD96-410A-AAA8-957DDD83C57A} {DBEF953E-F7BC-4D54-8A27-B758EC875C49} = {E06867E9-6942-4DB6-89F5-DE0BF56C44DE}
{650AEAA0-0678-4A75-A1CC-F46DC4E44D2A} = {791AE00B-AD96-410A-AAA8-957DDD83C57A} {FF09FBA1-86DA-4D8D-B549-A4FC70FC5AE9} = {E06867E9-6942-4DB6-89F5-DE0BF56C44DE}
{068F9531-5D29-49E0-980E-59982A3A0469} = {791AE00B-AD96-410A-AAA8-957DDD83C57A}
{D336926C-6180-4F62-B88D-E366B240127B} = {791AE00B-AD96-410A-AAA8-957DDD83C57A} {D336926C-6180-4F62-B88D-E366B240127B} = {791AE00B-AD96-410A-AAA8-957DDD83C57A}
{068F9531-5D29-49E0-980E-59982A3A0469} = {791AE00B-AD96-410A-AAA8-957DDD83C57A}
{650AEAA0-0678-4A75-A1CC-F46DC4E44D2A} = {791AE00B-AD96-410A-AAA8-957DDD83C57A}
{778BA9AE-EE77-444F-A0C9-D795BB977C1A} = {791AE00B-AD96-410A-AAA8-957DDD83C57A}
{F09B6132-5DF9-4E63-BA23-EE82D75CD5B9} = {791AE00B-AD96-410A-AAA8-957DDD83C57A}
EndGlobalSection EndGlobalSection
EndGlobal EndGlobal

Loading…
Cancel
Save