51 changed files with 4112 additions and 3166 deletions
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
*.cs text diff=csharp |
||||
*.sln text eol=crlf |
||||
*.csproj text eol=crlf |
||||
File diff suppressed because it is too large
Load Diff
@ -1,82 +1,82 @@
@@ -1,82 +1,82 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Runtime.InteropServices; |
||||
|
||||
using Debugger.Interop.CorDebug; |
||||
|
||||
namespace Debugger |
||||
{ |
||||
public class Breakpoint: DebuggerObject |
||||
{ |
||||
bool enabled; |
||||
List<ICorDebugFunctionBreakpoint> corBreakpoints = new List<ICorDebugFunctionBreakpoint>(); |
||||
|
||||
[Tests.Ignore] |
||||
public string FileName { get; private set; } |
||||
public int Line { get; set; } |
||||
public int Column { get; set; } |
||||
public byte[] Checksum { get; private set; } |
||||
|
||||
public bool IsEnabled { |
||||
get { return enabled; } |
||||
set { |
||||
enabled = value; |
||||
foreach(ICorDebugFunctionBreakpoint corBreakpoint in corBreakpoints) { |
||||
try { |
||||
corBreakpoint.Activate(enabled ? 1 : 0); |
||||
} catch(COMException e) { |
||||
// Sometimes happens, but we had not repro yet.
|
||||
// 0x80131301: Process was terminated.
|
||||
if ((uint)e.ErrorCode == 0x80131301) |
||||
continue; |
||||
throw; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
public bool IsSet { |
||||
get { return corBreakpoints.Count > 0; } |
||||
} |
||||
|
||||
internal Breakpoint() |
||||
{ |
||||
} |
||||
|
||||
internal Breakpoint(string fileName, int line, int column, bool enabled) |
||||
{ |
||||
this.FileName = fileName; |
||||
this.Line = line; |
||||
this.Column = column; |
||||
this.enabled = enabled; |
||||
} |
||||
|
||||
internal bool IsOwnerOf(ICorDebugBreakpoint breakpoint) |
||||
{ |
||||
foreach(ICorDebugFunctionBreakpoint corFunBreakpoint in corBreakpoints) { |
||||
if (((ICorDebugBreakpoint)corFunBreakpoint).Equals(breakpoint)) return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
internal void NotifyDebuggerTerminated() |
||||
{ |
||||
corBreakpoints.Clear(); |
||||
} |
||||
|
||||
public void SetBreakpoint(Module module) |
||||
{ |
||||
foreach(var symbolSource in module.Process.Debugger.SymbolSources) { |
||||
foreach (var seq in symbolSource.GetSequencePoints(module, this.FileName, this.Line, this.Column)) { |
||||
ICorDebugFunction corFunction = module.CorModule.GetFunctionFromToken(seq.MethodDefToken); |
||||
ICorDebugFunctionBreakpoint corBreakpoint = corFunction.GetILCode().CreateBreakpoint((uint)seq.ILOffset); |
||||
corBreakpoint.Activate(enabled ? 1 : 0); |
||||
corBreakpoints.Add(corBreakpoint); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Runtime.InteropServices; |
||||
|
||||
using Debugger.Interop.CorDebug; |
||||
|
||||
namespace Debugger |
||||
{ |
||||
public class Breakpoint: DebuggerObject |
||||
{ |
||||
bool enabled; |
||||
List<ICorDebugFunctionBreakpoint> corBreakpoints = new List<ICorDebugFunctionBreakpoint>(); |
||||
|
||||
[Tests.Ignore] |
||||
public string FileName { get; private set; } |
||||
public int Line { get; set; } |
||||
public int Column { get; set; } |
||||
public byte[] Checksum { get; private set; } |
||||
|
||||
public bool IsEnabled { |
||||
get { return enabled; } |
||||
set { |
||||
enabled = value; |
||||
foreach(ICorDebugFunctionBreakpoint corBreakpoint in corBreakpoints) { |
||||
try { |
||||
corBreakpoint.Activate(enabled ? 1 : 0); |
||||
} catch(COMException e) { |
||||
// Sometimes happens, but we had not repro yet.
|
||||
// 0x80131301: Process was terminated.
|
||||
if ((uint)e.ErrorCode == 0x80131301) |
||||
continue; |
||||
throw; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
public bool IsSet { |
||||
get { return corBreakpoints.Count > 0; } |
||||
} |
||||
|
||||
internal Breakpoint() |
||||
{ |
||||
} |
||||
|
||||
internal Breakpoint(string fileName, int line, int column, bool enabled) |
||||
{ |
||||
this.FileName = fileName; |
||||
this.Line = line; |
||||
this.Column = column; |
||||
this.enabled = enabled; |
||||
} |
||||
|
||||
internal bool IsOwnerOf(ICorDebugBreakpoint breakpoint) |
||||
{ |
||||
foreach(ICorDebugFunctionBreakpoint corFunBreakpoint in corBreakpoints) { |
||||
if (((ICorDebugBreakpoint)corFunBreakpoint).Equals(breakpoint)) return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
internal void NotifyDebuggerTerminated() |
||||
{ |
||||
corBreakpoints.Clear(); |
||||
} |
||||
|
||||
public void SetBreakpoint(Module module) |
||||
{ |
||||
foreach(var symbolSource in module.Process.Debugger.SymbolSources) { |
||||
foreach (var seq in symbolSource.GetSequencePoints(module, this.FileName, this.Line, this.Column)) { |
||||
ICorDebugFunction corFunction = module.CorModule.GetFunctionFromToken(seq.MethodDefToken); |
||||
ICorDebugFunctionBreakpoint corBreakpoint = corFunction.GetILCode().CreateBreakpoint((uint)seq.ILOffset); |
||||
corBreakpoint.Activate(enabled ? 1 : 0); |
||||
corBreakpoints.Add(corBreakpoint); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,280 +1,280 @@
@@ -1,280 +1,280 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{0162E499-42D0-409B-AA25-EED21F75336B}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>ICSharpCode.AvalonEdit.AddIn</RootNamespace> |
||||
<AssemblyName>ICSharpCode.AvalonEdit.AddIn</AssemblyName> |
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> |
||||
<SourceAnalysisOverrideSettingsFile>C:\Users\Daniel\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile> |
||||
<OutputPath>..\..\..\..\AddIns\DisplayBindings\AvalonEdit\</OutputPath> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<WarningLevel>4</WarningLevel> |
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||
<RunCodeAnalysis>False</RunCodeAnalysis> |
||||
<CodeAnalysisRules>-Microsoft.Design#CA1014;-Microsoft.Design#CA2210</CodeAnalysisRules> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<Optimize>False</Optimize> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<Optimize>True</Optimize> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
<ItemGroup> |
||||
<Reference Include="Microsoft.CSharp" /> |
||||
<Reference Include="PresentationCore"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="PresentationFramework"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="PresentationFramework.Aero"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="ReachFramework"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Drawing" /> |
||||
<Reference Include="System.Printing"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Runtime.Serialization"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Windows.Forms" /> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="System.Xaml" /> |
||||
<Reference Include="System.Xml.Linq"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="WindowsBase"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="WindowsFormsIntegration"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="Src\ChangeMarkerMargin\ChangeMarkerMargin.cs" /> |
||||
<Compile Include="Src\ChangeMarkerMargin\DefaultChangeWatcher.cs" /> |
||||
<Compile Include="Src\ChangeMarkerMargin\DiffControl.xaml.cs"> |
||||
<DependentUpon>DiffControl.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\ChangeMarkerMargin\DocumentSequence.cs" /> |
||||
<Compile Include="Src\ChangeMarkerMargin\IChangeWatcher.cs" /> |
||||
<Compile Include="Src\ChangeMarkerMargin\LineChangeInfo.cs" /> |
||||
<Compile Include="Src\ContextActions\ContextActionOptionPanelDoozer.cs" /> |
||||
<Compile Include="Src\ContextActions\ContextActionOptions.xaml.cs"> |
||||
<DependentUpon>ContextActionOptions.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\ContextActions\ContextActionsBulbControl.xaml.cs"> |
||||
<DependentUpon>ContextActionsBulbControl.xaml</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="Src\ContextActions\ContextActionsBulbPopup.cs" /> |
||||
<Compile Include="Src\ContextActions\ContextActionsBulbViewModel.cs" /> |
||||
<Compile Include="Src\ContextActions\ContextActionsControl.xaml.cs"> |
||||
<DependentUpon>ContextActionsControl.xaml</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="Src\ContextActions\ContextActionsHeaderedControl.xaml.cs"> |
||||
<DependentUpon>ContextActionsHeaderedControl.xaml</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="Src\ContextActions\ContextActionsPopup.cs" /> |
||||
<Compile Include="Src\ContextActions\ContextActionsRenderer.cs" /> |
||||
<Compile Include="Src\ContextActions\EditorActionsProvider.cs" /> |
||||
<Compile Include="Src\ContextActions\FindBaseClasses.cs" /> |
||||
<Compile Include="Src\ContextActions\FindDerivedClassesOrOverrides.cs" /> |
||||
<Compile Include="Src\ContextActions\GoToEntityAction.cs" /> |
||||
<Compile Include="Src\EnhancedScrollBar.cs" /> |
||||
<Compile Include="Src\HiddenDefinitionRenderer.cs" /> |
||||
<Compile Include="Src\SyntaxHighlighting\CustomizingHighlighter.cs" /> |
||||
<Compile Include="Src\SyntaxHighlighting\FixedHighlighter.cs" /> |
||||
<Compile Include="Src\SyntaxHighlighting\MultiHighlighter.cs" /> |
||||
<Compile Include="Src\Snippets\CodeSnippetComparer.cs" /> |
||||
<Compile Include="Src\SyntaxHighlighting\SyntaxModeDoozer.cs" /> |
||||
<Compile Include="Src\TextMarkerToolTipProvider.cs" /> |
||||
<Compile Include="Src\Utils.cs" /> |
||||
<Compile Include="Src\XmlDoc\DocumentationUIBuilder.cs" /> |
||||
<Compile Include="Src\XmlDoc\XmlDocTooltipProvider.cs" /> |
||||
<None Include="AvalonEdit.AddIn.addin"> |
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||
</None> |
||||
<Compile Include="..\..\..\Main\GlobalAssemblyInfo.cs"> |
||||
<Link>Configuration\GlobalAssemblyInfo.cs</Link> |
||||
</Compile> |
||||
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||
<Compile Include="Src\AvalonEditDisplayBinding.cs" /> |
||||
<Compile Include="Src\AvalonEditEditorUIService.cs" /> |
||||
<Compile Include="Src\AvalonEditorControlService.cs" /> |
||||
<Compile Include="Src\AvalonEditViewContent.cs" /> |
||||
<Compile Include="Src\BracketHighlightRenderer.cs" /> |
||||
<Compile Include="Src\CaretReferencesRenderer.cs" /> |
||||
<Compile Include="Src\ChooseEncodingDialog.xaml.cs"> |
||||
<DependentUpon>ChooseEncodingDialog.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\CodeCompletionEditorAdapter.cs" /> |
||||
<Compile Include="Src\CodeEditor.cs" /> |
||||
<Compile Include="Src\CodeEditorAdapter.cs" /> |
||||
<Compile Include="Src\CodeEditorView.cs" /> |
||||
<Compile Include="Src\ExpressionHighlightRenderer.cs" /> |
||||
<Compile Include="Src\CaretHighlightAdorner.cs" /> |
||||
<Compile Include="Src\NewLineConsistencyCheck.cs" /> |
||||
<Compile Include="Src\SearchPanelLocalization.cs" /> |
||||
<Compile Include="Src\SharpDevelopTextEditor.cs" /> |
||||
<Compile Include="Src\Commands\FoldingCommands.cs" /> |
||||
<Compile Include="Src\Commands\SaveFileWithEncoding.cs" /> |
||||
<Compile Include="Src\Commands\SortOptionsDialog.xaml.cs"> |
||||
<DependentUpon>SortOptionsDialog.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\Commands\SortSelectionCommand.cs" /> |
||||
<Compile Include="Src\Commands\SurroundWithCommand.cs" /> |
||||
<Compile Include="Src\CustomCommands.cs" /> |
||||
<Compile Include="Src\CustomizedHighlightingColor.cs" /> |
||||
<Compile Include="Src\DocumentPrinter.cs" /> |
||||
<Compile Include="Src\InlineUIElementGenerator.cs" /> |
||||
<Compile Include="Src\IconBarManager.cs" /> |
||||
<Compile Include="Src\IconBarMargin.cs" /> |
||||
<Compile Include="Src\Options\BehaviorOptions.xaml.cs"> |
||||
<DependentUpon>BehaviorOptions.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\Options\Converters.cs" /> |
||||
<Compile Include="Src\Options\CustomizedHighlightingItem.cs" /> |
||||
<Compile Include="Src\Options\GeneralEditorOptions.xaml.cs"> |
||||
<DependentUpon>GeneralEditorOptions.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\Options\CodeEditorOptions.cs" /> |
||||
<Compile Include="Src\Options\HighlightingOptions.xaml.cs"> |
||||
<DependentUpon>HighlightingOptions.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\Options\IHighlightingItem.cs" /> |
||||
<Compile Include="Src\Options\NamedColorHighlightingItem.cs" /> |
||||
<Compile Include="Src\Options\SimpleHighlightingItem.cs" /> |
||||
<Compile Include="Src\Options\TextViewOptions.xaml.cs"> |
||||
<DependentUpon>TextViewOptions.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\PrintPreviewViewContent.cs" /> |
||||
<Compile Include="Src\Snippets\AnchorSnippetElementProvider.cs" /> |
||||
<Compile Include="Src\Snippets\CodeSnippet.cs" /> |
||||
<Compile Include="Src\Snippets\CodeSnippetCompletionWindow.cs" /> |
||||
<Compile Include="Src\Snippets\CodeSnippetGroup.cs" /> |
||||
<Compile Include="Src\Snippets\DefaultSnippetElementProvider.cs" /> |
||||
<Compile Include="Src\Snippets\SnippetCompletionItem.cs" /> |
||||
<Compile Include="Src\Snippets\SnippetManager.cs" /> |
||||
<Compile Include="Src\Snippets\SnippetOptionPanel.cs"> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\ParserFoldingStrategy.cs" /> |
||||
<Compile Include="Src\QuickClassBrowser.cs"> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\SharpDevelopCompletionWindow.cs" /> |
||||
<Compile Include="Src\SharpDevelopInsightWindow.cs"> |
||||
</Compile> |
||||
<Compile Include="Src\StringToVisibilityConverter.cs" /> |
||||
<Compile Include="Src\TextMarkerService.cs" /> |
||||
<EmbeddedResource Include="Resources\IncrementalSearchCursor.cur" /> |
||||
<EmbeddedResource Include="Resources\ReverseIncrementalSearchCursor.cur" /> |
||||
<Resource Include="Src\ContextActions\bulb.png" /> |
||||
<None Include="Src\ContextActions\license.txt" /> |
||||
<Resource Include="Src\ContextActions\pencil.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Page Include="Src\ChangeMarkerMargin\DiffControl.xaml" /> |
||||
<Page Include="Src\ContextActions\ContextActionOptions.xaml" /> |
||||
<Page Include="Src\ContextActions\ContextActionsBulbControl.xaml" /> |
||||
<Page Include="Src\ContextActions\ContextActionsControl.xaml" /> |
||||
<Page Include="Src\ContextActions\ContextActionsHeaderedControl.xaml" /> |
||||
<Page Include="Src\SharpDevelopCompletionWindow.xaml"> |
||||
<DependentUpon>SharpDevelopCompletionWindow.cs</DependentUpon> |
||||
</Page> |
||||
<Page Include="themes\generic.xaml" /> |
||||
<ProjectReference Include="..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj"> |
||||
<Project>{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}</Project> |
||||
<Name>ICSharpCode.AvalonEdit</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\Libraries\NRefactory\ICSharpCode.NRefactory.Xml\ICSharpCode.NRefactory.Xml.csproj"> |
||||
<Project>{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}</Project> |
||||
<Name>ICSharpCode.NRefactory.Xml</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\Libraries\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj"> |
||||
<Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project> |
||||
<Name>ICSharpCode.NRefactory</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
||||
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> |
||||
<Name>ICSharpCode.SharpDevelop</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\Main\Core\Project\ICSharpCode.Core.csproj"> |
||||
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> |
||||
<Name>ICSharpCode.Core</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj"> |
||||
<Project>{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}</Project> |
||||
<Name>ICSharpCode.Core.Presentation</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj"> |
||||
<Project>{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}</Project> |
||||
<Name>ICSharpCode.Core.WinForms</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<Page Include="Src\ChooseEncodingDialog.xaml" /> |
||||
<Page Include="Src\Commands\SortOptionsDialog.xaml" /> |
||||
<Page Include="Src\Options\BehaviorOptions.xaml" /> |
||||
<Page Include="Src\Options\GeneralEditorOptions.xaml" /> |
||||
<Page Include="Src\Options\HighlightingOptions.xaml" /> |
||||
<Page Include="Src\Options\TextViewOptions.xaml" /> |
||||
<Page Include="Src\Snippets\SnippetOptionPanel.xaml"> |
||||
<DependentUpon>SnippetOptionPanel.cs</DependentUpon> |
||||
</Page> |
||||
<Page Include="Src\QuickClassBrowser.xaml"> |
||||
<DependentUpon>QuickClassBrowser.cs</DependentUpon> |
||||
</Page> |
||||
<ProjectReference Include="..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj"> |
||||
<Project>{8035765F-D51F-4A0C-A746-2FD100E19419}</Project> |
||||
<Name>ICSharpCode.SharpDevelop.Widgets</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Folder Include="Src\ContextActions" /> |
||||
<Folder Include="Src\ChangeMarkerMargin" /> |
||||
<Folder Include="Src\SyntaxHighlighting" /> |
||||
<Folder Include="Src\XmlDoc" /> |
||||
</ItemGroup> |
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||
<PropertyGroup> |
||||
<ProjectGuid>{0162E499-42D0-409B-AA25-EED21F75336B}</ProjectGuid> |
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> |
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> |
||||
<OutputType>Library</OutputType> |
||||
<RootNamespace>ICSharpCode.AvalonEdit.AddIn</RootNamespace> |
||||
<AssemblyName>ICSharpCode.AvalonEdit.AddIn</AssemblyName> |
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion> |
||||
<SourceAnalysisOverrideSettingsFile>C:\Users\Daniel\AppData\Roaming\ICSharpCode/SharpDevelop3.0\Settings.SourceAnalysis</SourceAnalysisOverrideSettingsFile> |
||||
<OutputPath>..\..\..\..\AddIns\DisplayBindings\AvalonEdit\</OutputPath> |
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> |
||||
<NoStdLib>False</NoStdLib> |
||||
<WarningLevel>4</WarningLevel> |
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> |
||||
<RunCodeAnalysis>False</RunCodeAnalysis> |
||||
<CodeAnalysisRules>-Microsoft.Design#CA1014;-Microsoft.Design#CA2210</CodeAnalysisRules> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> |
||||
<DebugSymbols>true</DebugSymbols> |
||||
<DebugType>Full</DebugType> |
||||
<Optimize>False</Optimize> |
||||
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow> |
||||
<DefineConstants>DEBUG;TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> |
||||
<DebugSymbols>False</DebugSymbols> |
||||
<DebugType>None</DebugType> |
||||
<Optimize>True</Optimize> |
||||
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow> |
||||
<DefineConstants>TRACE</DefineConstants> |
||||
</PropertyGroup> |
||||
<PropertyGroup Condition=" '$(Platform)' == 'AnyCPU' "> |
||||
<RegisterForComInterop>False</RegisterForComInterop> |
||||
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies> |
||||
<BaseAddress>4194304</BaseAddress> |
||||
<PlatformTarget>AnyCPU</PlatformTarget> |
||||
<FileAlignment>4096</FileAlignment> |
||||
</PropertyGroup> |
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> |
||||
<ItemGroup> |
||||
<Reference Include="Microsoft.CSharp" /> |
||||
<Reference Include="PresentationCore"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="PresentationFramework"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="PresentationFramework.Aero"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="ReachFramework"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System" /> |
||||
<Reference Include="System.Core"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Drawing" /> |
||||
<Reference Include="System.Printing"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Runtime.Serialization"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="System.Windows.Forms" /> |
||||
<Reference Include="System.Xml" /> |
||||
<Reference Include="System.Xaml" /> |
||||
<Reference Include="System.Xml.Linq"> |
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="WindowsBase"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
<Reference Include="WindowsFormsIntegration"> |
||||
<RequiredTargetFramework>3.0</RequiredTargetFramework> |
||||
</Reference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Compile Include="Src\ChangeMarkerMargin\ChangeMarkerMargin.cs" /> |
||||
<Compile Include="Src\ChangeMarkerMargin\DefaultChangeWatcher.cs" /> |
||||
<Compile Include="Src\ChangeMarkerMargin\DiffControl.xaml.cs"> |
||||
<DependentUpon>DiffControl.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\ChangeMarkerMargin\DocumentSequence.cs" /> |
||||
<Compile Include="Src\ChangeMarkerMargin\IChangeWatcher.cs" /> |
||||
<Compile Include="Src\ChangeMarkerMargin\LineChangeInfo.cs" /> |
||||
<Compile Include="Src\ContextActions\ContextActionOptionPanelDoozer.cs" /> |
||||
<Compile Include="Src\ContextActions\ContextActionOptions.xaml.cs"> |
||||
<DependentUpon>ContextActionOptions.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\ContextActions\ContextActionsBulbControl.xaml.cs"> |
||||
<DependentUpon>ContextActionsBulbControl.xaml</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="Src\ContextActions\ContextActionsBulbPopup.cs" /> |
||||
<Compile Include="Src\ContextActions\ContextActionsBulbViewModel.cs" /> |
||||
<Compile Include="Src\ContextActions\ContextActionsControl.xaml.cs"> |
||||
<DependentUpon>ContextActionsControl.xaml</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="Src\ContextActions\ContextActionsHeaderedControl.xaml.cs"> |
||||
<DependentUpon>ContextActionsHeaderedControl.xaml</DependentUpon> |
||||
</Compile> |
||||
<Compile Include="Src\ContextActions\ContextActionsPopup.cs" /> |
||||
<Compile Include="Src\ContextActions\ContextActionsRenderer.cs" /> |
||||
<Compile Include="Src\ContextActions\EditorActionsProvider.cs" /> |
||||
<Compile Include="Src\ContextActions\FindBaseClasses.cs" /> |
||||
<Compile Include="Src\ContextActions\FindDerivedClassesOrOverrides.cs" /> |
||||
<Compile Include="Src\ContextActions\GoToEntityAction.cs" /> |
||||
<Compile Include="Src\EnhancedScrollBar.cs" /> |
||||
<Compile Include="Src\HiddenDefinitionRenderer.cs" /> |
||||
<Compile Include="Src\SyntaxHighlighting\CustomizingHighlighter.cs" /> |
||||
<Compile Include="Src\SyntaxHighlighting\FixedHighlighter.cs" /> |
||||
<Compile Include="Src\SyntaxHighlighting\MultiHighlighter.cs" /> |
||||
<Compile Include="Src\Snippets\CodeSnippetComparer.cs" /> |
||||
<Compile Include="Src\SyntaxHighlighting\SyntaxModeDoozer.cs" /> |
||||
<Compile Include="Src\TextMarkerToolTipProvider.cs" /> |
||||
<Compile Include="Src\Utils.cs" /> |
||||
<Compile Include="Src\XmlDoc\DocumentationUIBuilder.cs" /> |
||||
<Compile Include="Src\XmlDoc\XmlDocTooltipProvider.cs" /> |
||||
<None Include="AvalonEdit.AddIn.addin"> |
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> |
||||
</None> |
||||
<Compile Include="..\..\..\Main\GlobalAssemblyInfo.cs"> |
||||
<Link>Configuration\GlobalAssemblyInfo.cs</Link> |
||||
</Compile> |
||||
<Compile Include="Configuration\AssemblyInfo.cs" /> |
||||
<Compile Include="Src\AvalonEditDisplayBinding.cs" /> |
||||
<Compile Include="Src\AvalonEditEditorUIService.cs" /> |
||||
<Compile Include="Src\AvalonEditorControlService.cs" /> |
||||
<Compile Include="Src\AvalonEditViewContent.cs" /> |
||||
<Compile Include="Src\BracketHighlightRenderer.cs" /> |
||||
<Compile Include="Src\CaretReferencesRenderer.cs" /> |
||||
<Compile Include="Src\ChooseEncodingDialog.xaml.cs"> |
||||
<DependentUpon>ChooseEncodingDialog.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\CodeCompletionEditorAdapter.cs" /> |
||||
<Compile Include="Src\CodeEditor.cs" /> |
||||
<Compile Include="Src\CodeEditorAdapter.cs" /> |
||||
<Compile Include="Src\CodeEditorView.cs" /> |
||||
<Compile Include="Src\ExpressionHighlightRenderer.cs" /> |
||||
<Compile Include="Src\CaretHighlightAdorner.cs" /> |
||||
<Compile Include="Src\NewLineConsistencyCheck.cs" /> |
||||
<Compile Include="Src\SearchPanelLocalization.cs" /> |
||||
<Compile Include="Src\SharpDevelopTextEditor.cs" /> |
||||
<Compile Include="Src\Commands\FoldingCommands.cs" /> |
||||
<Compile Include="Src\Commands\SaveFileWithEncoding.cs" /> |
||||
<Compile Include="Src\Commands\SortOptionsDialog.xaml.cs"> |
||||
<DependentUpon>SortOptionsDialog.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\Commands\SortSelectionCommand.cs" /> |
||||
<Compile Include="Src\Commands\SurroundWithCommand.cs" /> |
||||
<Compile Include="Src\CustomCommands.cs" /> |
||||
<Compile Include="Src\CustomizedHighlightingColor.cs" /> |
||||
<Compile Include="Src\DocumentPrinter.cs" /> |
||||
<Compile Include="Src\InlineUIElementGenerator.cs" /> |
||||
<Compile Include="Src\IconBarManager.cs" /> |
||||
<Compile Include="Src\IconBarMargin.cs" /> |
||||
<Compile Include="Src\Options\BehaviorOptions.xaml.cs"> |
||||
<DependentUpon>BehaviorOptions.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\Options\Converters.cs" /> |
||||
<Compile Include="Src\Options\CustomizedHighlightingItem.cs" /> |
||||
<Compile Include="Src\Options\GeneralEditorOptions.xaml.cs"> |
||||
<DependentUpon>GeneralEditorOptions.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\Options\CodeEditorOptions.cs" /> |
||||
<Compile Include="Src\Options\HighlightingOptions.xaml.cs"> |
||||
<DependentUpon>HighlightingOptions.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\Options\IHighlightingItem.cs" /> |
||||
<Compile Include="Src\Options\NamedColorHighlightingItem.cs" /> |
||||
<Compile Include="Src\Options\SimpleHighlightingItem.cs" /> |
||||
<Compile Include="Src\Options\TextViewOptions.xaml.cs"> |
||||
<DependentUpon>TextViewOptions.xaml</DependentUpon> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\PrintPreviewViewContent.cs" /> |
||||
<Compile Include="Src\Snippets\AnchorSnippetElementProvider.cs" /> |
||||
<Compile Include="Src\Snippets\CodeSnippet.cs" /> |
||||
<Compile Include="Src\Snippets\CodeSnippetCompletionWindow.cs" /> |
||||
<Compile Include="Src\Snippets\CodeSnippetGroup.cs" /> |
||||
<Compile Include="Src\Snippets\DefaultSnippetElementProvider.cs" /> |
||||
<Compile Include="Src\Snippets\SnippetCompletionItem.cs" /> |
||||
<Compile Include="Src\Snippets\SnippetManager.cs" /> |
||||
<Compile Include="Src\Snippets\SnippetOptionPanel.cs"> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\ParserFoldingStrategy.cs" /> |
||||
<Compile Include="Src\QuickClassBrowser.cs"> |
||||
<SubType>Code</SubType> |
||||
</Compile> |
||||
<Compile Include="Src\SharpDevelopCompletionWindow.cs" /> |
||||
<Compile Include="Src\SharpDevelopInsightWindow.cs"> |
||||
</Compile> |
||||
<Compile Include="Src\StringToVisibilityConverter.cs" /> |
||||
<Compile Include="Src\TextMarkerService.cs" /> |
||||
<EmbeddedResource Include="Resources\IncrementalSearchCursor.cur" /> |
||||
<EmbeddedResource Include="Resources\ReverseIncrementalSearchCursor.cur" /> |
||||
<Resource Include="Src\ContextActions\bulb.png" /> |
||||
<None Include="Src\ContextActions\license.txt" /> |
||||
<Resource Include="Src\ContextActions\pencil.png" /> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Page Include="Src\ChangeMarkerMargin\DiffControl.xaml" /> |
||||
<Page Include="Src\ContextActions\ContextActionOptions.xaml" /> |
||||
<Page Include="Src\ContextActions\ContextActionsBulbControl.xaml" /> |
||||
<Page Include="Src\ContextActions\ContextActionsControl.xaml" /> |
||||
<Page Include="Src\ContextActions\ContextActionsHeaderedControl.xaml" /> |
||||
<Page Include="Src\SharpDevelopCompletionWindow.xaml"> |
||||
<DependentUpon>SharpDevelopCompletionWindow.cs</DependentUpon> |
||||
</Page> |
||||
<Page Include="themes\generic.xaml" /> |
||||
<ProjectReference Include="..\..\..\Libraries\AvalonEdit\ICSharpCode.AvalonEdit\ICSharpCode.AvalonEdit.csproj"> |
||||
<Project>{6C55B776-26D4-4DB3-A6AB-87E783B2F3D1}</Project> |
||||
<Name>ICSharpCode.AvalonEdit</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\Libraries\NRefactory\ICSharpCode.NRefactory.Xml\ICSharpCode.NRefactory.Xml.csproj"> |
||||
<Project>{DC393B66-92ED-4CAD-AB25-CFEF23F3D7C6}</Project> |
||||
<Name>ICSharpCode.NRefactory.Xml</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\Libraries\NRefactory\ICSharpCode.NRefactory\ICSharpCode.NRefactory.csproj"> |
||||
<Project>{3B2A5653-EC97-4001-BB9B-D90F1AF2C371}</Project> |
||||
<Name>ICSharpCode.NRefactory</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj"> |
||||
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project> |
||||
<Name>ICSharpCode.SharpDevelop</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\Main\Core\Project\ICSharpCode.Core.csproj"> |
||||
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project> |
||||
<Name>ICSharpCode.Core</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\Main\ICSharpCode.Core.Presentation\ICSharpCode.Core.Presentation.csproj"> |
||||
<Project>{7E4A7172-7FF5-48D0-B719-7CD959DD1AC9}</Project> |
||||
<Name>ICSharpCode.Core.Presentation</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<ProjectReference Include="..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj"> |
||||
<Project>{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}</Project> |
||||
<Name>ICSharpCode.Core.WinForms</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
<Page Include="Src\ChooseEncodingDialog.xaml" /> |
||||
<Page Include="Src\Commands\SortOptionsDialog.xaml" /> |
||||
<Page Include="Src\Options\BehaviorOptions.xaml" /> |
||||
<Page Include="Src\Options\GeneralEditorOptions.xaml" /> |
||||
<Page Include="Src\Options\HighlightingOptions.xaml" /> |
||||
<Page Include="Src\Options\TextViewOptions.xaml" /> |
||||
<Page Include="Src\Snippets\SnippetOptionPanel.xaml"> |
||||
<DependentUpon>SnippetOptionPanel.cs</DependentUpon> |
||||
</Page> |
||||
<Page Include="Src\QuickClassBrowser.xaml"> |
||||
<DependentUpon>QuickClassBrowser.cs</DependentUpon> |
||||
</Page> |
||||
<ProjectReference Include="..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj"> |
||||
<Project>{8035765F-D51F-4A0C-A746-2FD100E19419}</Project> |
||||
<Name>ICSharpCode.SharpDevelop.Widgets</Name> |
||||
<Private>False</Private> |
||||
</ProjectReference> |
||||
</ItemGroup> |
||||
<ItemGroup> |
||||
<Folder Include="Src\ContextActions" /> |
||||
<Folder Include="Src\ChangeMarkerMargin" /> |
||||
<Folder Include="Src\SyntaxHighlighting" /> |
||||
<Folder Include="Src\XmlDoc" /> |
||||
</ItemGroup> |
||||
</Project> |
||||
@ -1,53 +1,53 @@
@@ -1,53 +1,53 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Workbench; |
||||
using ICSharpCode.WpfDesign.Designer.ThumbnailView; |
||||
|
||||
namespace ICSharpCode.WpfDesign.AddIn |
||||
{ |
||||
public class ThumbnailViewPad : AbstractPadContent |
||||
{ |
||||
ContentPresenter contentControl = new ContentPresenter(); |
||||
|
||||
ThumbnailView thumbnailView = new ThumbnailView(); |
||||
|
||||
TextBlock notAvailableTextBlock = new TextBlock { |
||||
Text = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Gui.OutlinePad.NotAvailable}"), |
||||
TextWrapping = TextWrapping.Wrap |
||||
}; |
||||
|
||||
public ThumbnailViewPad() |
||||
{ |
||||
SD.Workbench.ActiveViewContentChanged += WorkbenchActiveViewContentChanged; |
||||
WorkbenchActiveViewContentChanged(null, null); |
||||
} |
||||
|
||||
void WorkbenchActiveViewContentChanged(object sender, EventArgs e) |
||||
{ |
||||
WpfViewContent wpfView = SD.Workbench.ActiveViewContent as WpfViewContent; |
||||
if (wpfView != null) |
||||
{ |
||||
thumbnailView.DesignSurface = wpfView.DesignSurface; |
||||
SD.WinForms.SetContent(contentControl, thumbnailView); |
||||
} else { |
||||
SD.WinForms.SetContent(contentControl, notAvailableTextBlock); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// The <see cref="System.Windows.Forms.Control"/> representing the pad
|
||||
/// </summary>
|
||||
public override object Control { |
||||
get { |
||||
return contentControl; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
|
||||
using ICSharpCode.Core; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Workbench; |
||||
using ICSharpCode.WpfDesign.Designer.ThumbnailView; |
||||
|
||||
namespace ICSharpCode.WpfDesign.AddIn |
||||
{ |
||||
public class ThumbnailViewPad : AbstractPadContent |
||||
{ |
||||
ContentPresenter contentControl = new ContentPresenter(); |
||||
|
||||
ThumbnailView thumbnailView = new ThumbnailView(); |
||||
|
||||
TextBlock notAvailableTextBlock = new TextBlock { |
||||
Text = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Gui.OutlinePad.NotAvailable}"), |
||||
TextWrapping = TextWrapping.Wrap |
||||
}; |
||||
|
||||
public ThumbnailViewPad() |
||||
{ |
||||
SD.Workbench.ActiveViewContentChanged += WorkbenchActiveViewContentChanged; |
||||
WorkbenchActiveViewContentChanged(null, null); |
||||
} |
||||
|
||||
void WorkbenchActiveViewContentChanged(object sender, EventArgs e) |
||||
{ |
||||
WpfViewContent wpfView = SD.Workbench.ActiveViewContent as WpfViewContent; |
||||
if (wpfView != null) |
||||
{ |
||||
thumbnailView.DesignSurface = wpfView.DesignSurface; |
||||
SD.WinForms.SetContent(contentControl, thumbnailView); |
||||
} else { |
||||
SD.WinForms.SetContent(contentControl, notAvailableTextBlock); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// The <see cref="System.Windows.Forms.Control"/> representing the pad
|
||||
/// </summary>
|
||||
public override object Control { |
||||
get { |
||||
return contentControl; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
@ -1,328 +1,328 @@
@@ -1,328 +1,328 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.ComponentModel; |
||||
using System.Collections.ObjectModel; |
||||
using System.Threading; |
||||
using System.Globalization; |
||||
using ICSharpCode.WpfDesign.PropertyGrid; |
||||
using System.Windows.Threading; |
||||
using System.Diagnostics; |
||||
using System.Windows.Media; |
||||
using System.Windows; |
||||
|
||||
namespace ICSharpCode.WpfDesign.Designer.PropertyGrid |
||||
{ |
||||
public class PropertyGrid : INotifyPropertyChanged |
||||
{ |
||||
public PropertyGrid() |
||||
{ |
||||
Categories = new CategoriesCollection(); |
||||
Categories.Add(specialCategory); |
||||
Categories.Add(popularCategory); |
||||
Categories.Add(otherCategory); |
||||
Categories.Add(attachedCategory); |
||||
|
||||
Events = new PropertyNodeCollection(); |
||||
} |
||||
|
||||
Category specialCategory = new Category("Special"); |
||||
Category popularCategory = new Category("Popular"); |
||||
Category otherCategory = new Category("Other"); |
||||
Category attachedCategory = new Category("Attached"); |
||||
|
||||
Dictionary<MemberDescriptor, PropertyNode> nodeFromDescriptor = new Dictionary<MemberDescriptor, PropertyNode>(); |
||||
|
||||
public CategoriesCollection Categories { get; private set; } |
||||
public PropertyNodeCollection Events { get; private set; } |
||||
|
||||
private PropertyGridGroupMode _groupMode; |
||||
|
||||
public PropertyGridGroupMode GroupMode |
||||
{ |
||||
get { return _groupMode; } |
||||
set |
||||
{ |
||||
if (_groupMode != value) |
||||
{ |
||||
_groupMode = value; |
||||
|
||||
RaisePropertyChanged("GroupMode"); |
||||
|
||||
Reload(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
PropertyGridTab currentTab; |
||||
|
||||
public PropertyGridTab CurrentTab { |
||||
get { |
||||
return currentTab; |
||||
} |
||||
set { |
||||
currentTab = value; |
||||
RaisePropertyChanged("CurrentTab"); |
||||
RaisePropertyChanged("NameBackground"); |
||||
} |
||||
} |
||||
|
||||
string filter; |
||||
|
||||
public string Filter { |
||||
get { |
||||
return filter; |
||||
} |
||||
set { |
||||
filter = value; |
||||
Reload(); |
||||
RaisePropertyChanged("Filter"); |
||||
} |
||||
} |
||||
|
||||
DesignItem singleItem; |
||||
|
||||
public DesignItem SingleItem { |
||||
get { |
||||
return singleItem; |
||||
} |
||||
private set { |
||||
if (singleItem != null) { |
||||
singleItem.NameChanged -= singleItem_NameChanged; |
||||
} |
||||
singleItem = value; |
||||
if (singleItem != null) { |
||||
singleItem.NameChanged += singleItem_NameChanged; |
||||
} |
||||
RaisePropertyChanged("SingleItem"); |
||||
RaisePropertyChanged("Name"); |
||||
RaisePropertyChanged("IsNameEnabled"); |
||||
IsNameCorrect = true; |
||||
} |
||||
} |
||||
|
||||
void singleItem_NameChanged(object sender, EventArgs e) |
||||
{ |
||||
RaisePropertyChanged("Name"); |
||||
} |
||||
|
||||
public string OldName { |
||||
get; private set; |
||||
} |
||||
|
||||
public string Name { |
||||
get { |
||||
if (SingleItem != null) { |
||||
return SingleItem.Name; |
||||
} |
||||
return null; |
||||
} |
||||
set { |
||||
if (SingleItem != null) { |
||||
try { |
||||
if (string.IsNullOrEmpty(value)) { |
||||
OldName = null; |
||||
SingleItem.Name = null; |
||||
} else { |
||||
OldName = SingleItem.Name; |
||||
SingleItem.Name = value; |
||||
} |
||||
IsNameCorrect = true; |
||||
} catch { |
||||
IsNameCorrect = false; |
||||
} |
||||
RaisePropertyChanged("Name"); |
||||
} |
||||
} |
||||
} |
||||
|
||||
bool isNameCorrect = true; |
||||
|
||||
public bool IsNameCorrect { |
||||
get { |
||||
return isNameCorrect; |
||||
} |
||||
set { |
||||
isNameCorrect = value; |
||||
RaisePropertyChanged("IsNameCorrect"); |
||||
} |
||||
} |
||||
|
||||
public bool IsNameEnabled { |
||||
get { |
||||
return SingleItem != null; |
||||
} |
||||
} |
||||
|
||||
IEnumerable<DesignItem> selectedItems; |
||||
|
||||
public IEnumerable<DesignItem> SelectedItems { |
||||
get { |
||||
return selectedItems; |
||||
} |
||||
set { |
||||
selectedItems = value; |
||||
RaisePropertyChanged("SelectedItems"); |
||||
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new Action( |
||||
delegate { |
||||
Reload(); |
||||
})); |
||||
} |
||||
} |
||||
|
||||
public void ClearFilter() |
||||
{ |
||||
Filter = null; |
||||
} |
||||
|
||||
void Reload() |
||||
{ |
||||
Clear(); |
||||
|
||||
if (SelectedItems == null || SelectedItems.Count() == 0) return; |
||||
if (SelectedItems.Count() == 1) SingleItem = SelectedItems.First(); |
||||
|
||||
foreach (var md in GetDescriptors()) { |
||||
if (PassesFilter(md.Name)) |
||||
AddNode(md); |
||||
} |
||||
} |
||||
|
||||
void Clear() |
||||
{ |
||||
foreach (var c in Categories) { |
||||
c.IsVisible = false; |
||||
foreach (var p in c.Properties) { |
||||
p.IsVisible = false; |
||||
} |
||||
} |
||||
|
||||
foreach (var e in Events) { |
||||
e.IsVisible = false; |
||||
} |
||||
|
||||
SingleItem = null; |
||||
} |
||||
|
||||
List<MemberDescriptor> GetDescriptors() |
||||
{ |
||||
List<MemberDescriptor> list = new List<MemberDescriptor>(); |
||||
|
||||
if (SelectedItems.Count() == 1) { |
||||
foreach (MemberDescriptor d in TypeHelper.GetAvailableProperties(SingleItem.Component)) { |
||||
list.Add(d); |
||||
} |
||||
foreach (MemberDescriptor d in TypeHelper.GetAvailableEvents(SingleItem.ComponentType)) { |
||||
list.Add(d); |
||||
} |
||||
} else { |
||||
foreach (MemberDescriptor d in TypeHelper.GetCommonAvailableProperties(SelectedItems.Select(t => t.Component))) { |
||||
list.Add(d); |
||||
} |
||||
} |
||||
|
||||
return list; |
||||
} |
||||
|
||||
bool PassesFilter(string name) |
||||
{ |
||||
if (string.IsNullOrEmpty(Filter)) return true; |
||||
for (int i = 0; i < name.Length; i++) { |
||||
if (i == 0 || char.IsUpper(name[i])) { |
||||
if (string.Compare(name, i, Filter, 0, Filter.Length, true) == 0) { |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
void AddNode(MemberDescriptor md) |
||||
{ |
||||
var designProperties = SelectedItems.Select(item => item.Properties.GetProperty(md)).ToArray(); |
||||
if (!Metadata.IsBrowsable(designProperties[0])) return; |
||||
|
||||
PropertyNode node; |
||||
if (nodeFromDescriptor.TryGetValue(md, out node)) { |
||||
node.Load(designProperties); |
||||
} else { |
||||
node = new PropertyNode(); |
||||
node.Load(designProperties); |
||||
if (node.IsEvent) { |
||||
Events.AddSorted(node); |
||||
} else { |
||||
var cat = PickCategory(node); |
||||
cat.Properties.AddSorted(node); |
||||
node.Category = cat; |
||||
} |
||||
nodeFromDescriptor[md] = node; |
||||
} |
||||
node.IsVisible = true; |
||||
if (node.Category != null) |
||||
node.Category.IsVisible = true; |
||||
} |
||||
|
||||
Category PickCategory(PropertyNode node) |
||||
{ |
||||
if (Metadata.IsPopularProperty(node.FirstProperty)) return popularCategory; |
||||
if (node.FirstProperty.IsAttachedDependencyProperty()) return attachedCategory; |
||||
var typeName = node.FirstProperty.DeclaringType.FullName; |
||||
if (typeName.StartsWith("System.Windows.") || typeName.StartsWith("ICSharpCode.WpfDesign.Designer.Controls.")) |
||||
return otherCategory; |
||||
return specialCategory; |
||||
} |
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
void RaisePropertyChanged(string name) |
||||
{ |
||||
if (PropertyChanged != null) { |
||||
PropertyChanged(this, new PropertyChangedEventArgs(name)); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
//class CategoryNameComparer : IComparer<string>
|
||||
//{
|
||||
// public static CategoryNameComparer Instance = new CategoryNameComparer();
|
||||
|
||||
// public int Compare(string x, string y)
|
||||
// {
|
||||
// int i1 = Array.IndexOf(Metadata.CategoryOrder, x);
|
||||
// if (i1 == -1) i1 = int.MaxValue;
|
||||
// int i2 = Array.IndexOf(Metadata.CategoryOrder, y);
|
||||
// if (i2 == -1) i2 = int.MaxValue;
|
||||
// if (i1 == i2) return x.CompareTo(y);
|
||||
// return i1.CompareTo(i2);
|
||||
// }
|
||||
//}
|
||||
} |
||||
|
||||
public class CategoriesCollection : SortedObservableCollection<Category, string> |
||||
{ |
||||
public CategoriesCollection() |
||||
: base(n => n.Name) |
||||
{ |
||||
} |
||||
} |
||||
|
||||
public enum PropertyGridGroupMode |
||||
{ |
||||
GroupByPopularCategorys, |
||||
GroupByCategorys, |
||||
Ungrouped, |
||||
} |
||||
|
||||
public enum PropertyGridTab |
||||
{ |
||||
Properties, |
||||
Events |
||||
} |
||||
} |
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.ComponentModel; |
||||
using System.Collections.ObjectModel; |
||||
using System.Threading; |
||||
using System.Globalization; |
||||
using ICSharpCode.WpfDesign.PropertyGrid; |
||||
using System.Windows.Threading; |
||||
using System.Diagnostics; |
||||
using System.Windows.Media; |
||||
using System.Windows; |
||||
|
||||
namespace ICSharpCode.WpfDesign.Designer.PropertyGrid |
||||
{ |
||||
public class PropertyGrid : INotifyPropertyChanged |
||||
{ |
||||
public PropertyGrid() |
||||
{ |
||||
Categories = new CategoriesCollection(); |
||||
Categories.Add(specialCategory); |
||||
Categories.Add(popularCategory); |
||||
Categories.Add(otherCategory); |
||||
Categories.Add(attachedCategory); |
||||
|
||||
Events = new PropertyNodeCollection(); |
||||
} |
||||
|
||||
Category specialCategory = new Category("Special"); |
||||
Category popularCategory = new Category("Popular"); |
||||
Category otherCategory = new Category("Other"); |
||||
Category attachedCategory = new Category("Attached"); |
||||
|
||||
Dictionary<MemberDescriptor, PropertyNode> nodeFromDescriptor = new Dictionary<MemberDescriptor, PropertyNode>(); |
||||
|
||||
public CategoriesCollection Categories { get; private set; } |
||||
public PropertyNodeCollection Events { get; private set; } |
||||
|
||||
private PropertyGridGroupMode _groupMode; |
||||
|
||||
public PropertyGridGroupMode GroupMode |
||||
{ |
||||
get { return _groupMode; } |
||||
set |
||||
{ |
||||
if (_groupMode != value) |
||||
{ |
||||
_groupMode = value; |
||||
|
||||
RaisePropertyChanged("GroupMode"); |
||||
|
||||
Reload(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
PropertyGridTab currentTab; |
||||
|
||||
public PropertyGridTab CurrentTab { |
||||
get { |
||||
return currentTab; |
||||
} |
||||
set { |
||||
currentTab = value; |
||||
RaisePropertyChanged("CurrentTab"); |
||||
RaisePropertyChanged("NameBackground"); |
||||
} |
||||
} |
||||
|
||||
string filter; |
||||
|
||||
public string Filter { |
||||
get { |
||||
return filter; |
||||
} |
||||
set { |
||||
filter = value; |
||||
Reload(); |
||||
RaisePropertyChanged("Filter"); |
||||
} |
||||
} |
||||
|
||||
DesignItem singleItem; |
||||
|
||||
public DesignItem SingleItem { |
||||
get { |
||||
return singleItem; |
||||
} |
||||
private set { |
||||
if (singleItem != null) { |
||||
singleItem.NameChanged -= singleItem_NameChanged; |
||||
} |
||||
singleItem = value; |
||||
if (singleItem != null) { |
||||
singleItem.NameChanged += singleItem_NameChanged; |
||||
} |
||||
RaisePropertyChanged("SingleItem"); |
||||
RaisePropertyChanged("Name"); |
||||
RaisePropertyChanged("IsNameEnabled"); |
||||
IsNameCorrect = true; |
||||
} |
||||
} |
||||
|
||||
void singleItem_NameChanged(object sender, EventArgs e) |
||||
{ |
||||
RaisePropertyChanged("Name"); |
||||
} |
||||
|
||||
public string OldName { |
||||
get; private set; |
||||
} |
||||
|
||||
public string Name { |
||||
get { |
||||
if (SingleItem != null) { |
||||
return SingleItem.Name; |
||||
} |
||||
return null; |
||||
} |
||||
set { |
||||
if (SingleItem != null) { |
||||
try { |
||||
if (string.IsNullOrEmpty(value)) { |
||||
OldName = null; |
||||
SingleItem.Name = null; |
||||
} else { |
||||
OldName = SingleItem.Name; |
||||
SingleItem.Name = value; |
||||
} |
||||
IsNameCorrect = true; |
||||
} catch { |
||||
IsNameCorrect = false; |
||||
} |
||||
RaisePropertyChanged("Name"); |
||||
} |
||||
} |
||||
} |
||||
|
||||
bool isNameCorrect = true; |
||||
|
||||
public bool IsNameCorrect { |
||||
get { |
||||
return isNameCorrect; |
||||
} |
||||
set { |
||||
isNameCorrect = value; |
||||
RaisePropertyChanged("IsNameCorrect"); |
||||
} |
||||
} |
||||
|
||||
public bool IsNameEnabled { |
||||
get { |
||||
return SingleItem != null; |
||||
} |
||||
} |
||||
|
||||
IEnumerable<DesignItem> selectedItems; |
||||
|
||||
public IEnumerable<DesignItem> SelectedItems { |
||||
get { |
||||
return selectedItems; |
||||
} |
||||
set { |
||||
selectedItems = value; |
||||
RaisePropertyChanged("SelectedItems"); |
||||
Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background, new Action( |
||||
delegate { |
||||
Reload(); |
||||
})); |
||||
} |
||||
} |
||||
|
||||
public void ClearFilter() |
||||
{ |
||||
Filter = null; |
||||
} |
||||
|
||||
void Reload() |
||||
{ |
||||
Clear(); |
||||
|
||||
if (SelectedItems == null || SelectedItems.Count() == 0) return; |
||||
if (SelectedItems.Count() == 1) SingleItem = SelectedItems.First(); |
||||
|
||||
foreach (var md in GetDescriptors()) { |
||||
if (PassesFilter(md.Name)) |
||||
AddNode(md); |
||||
} |
||||
} |
||||
|
||||
void Clear() |
||||
{ |
||||
foreach (var c in Categories) { |
||||
c.IsVisible = false; |
||||
foreach (var p in c.Properties) { |
||||
p.IsVisible = false; |
||||
} |
||||
} |
||||
|
||||
foreach (var e in Events) { |
||||
e.IsVisible = false; |
||||
} |
||||
|
||||
SingleItem = null; |
||||
} |
||||
|
||||
List<MemberDescriptor> GetDescriptors() |
||||
{ |
||||
List<MemberDescriptor> list = new List<MemberDescriptor>(); |
||||
|
||||
if (SelectedItems.Count() == 1) { |
||||
foreach (MemberDescriptor d in TypeHelper.GetAvailableProperties(SingleItem.Component)) { |
||||
list.Add(d); |
||||
} |
||||
foreach (MemberDescriptor d in TypeHelper.GetAvailableEvents(SingleItem.ComponentType)) { |
||||
list.Add(d); |
||||
} |
||||
} else { |
||||
foreach (MemberDescriptor d in TypeHelper.GetCommonAvailableProperties(SelectedItems.Select(t => t.Component))) { |
||||
list.Add(d); |
||||
} |
||||
} |
||||
|
||||
return list; |
||||
} |
||||
|
||||
bool PassesFilter(string name) |
||||
{ |
||||
if (string.IsNullOrEmpty(Filter)) return true; |
||||
for (int i = 0; i < name.Length; i++) { |
||||
if (i == 0 || char.IsUpper(name[i])) { |
||||
if (string.Compare(name, i, Filter, 0, Filter.Length, true) == 0) { |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
void AddNode(MemberDescriptor md) |
||||
{ |
||||
var designProperties = SelectedItems.Select(item => item.Properties.GetProperty(md)).ToArray(); |
||||
if (!Metadata.IsBrowsable(designProperties[0])) return; |
||||
|
||||
PropertyNode node; |
||||
if (nodeFromDescriptor.TryGetValue(md, out node)) { |
||||
node.Load(designProperties); |
||||
} else { |
||||
node = new PropertyNode(); |
||||
node.Load(designProperties); |
||||
if (node.IsEvent) { |
||||
Events.AddSorted(node); |
||||
} else { |
||||
var cat = PickCategory(node); |
||||
cat.Properties.AddSorted(node); |
||||
node.Category = cat; |
||||
} |
||||
nodeFromDescriptor[md] = node; |
||||
} |
||||
node.IsVisible = true; |
||||
if (node.Category != null) |
||||
node.Category.IsVisible = true; |
||||
} |
||||
|
||||
Category PickCategory(PropertyNode node) |
||||
{ |
||||
if (Metadata.IsPopularProperty(node.FirstProperty)) return popularCategory; |
||||
if (node.FirstProperty.IsAttachedDependencyProperty()) return attachedCategory; |
||||
var typeName = node.FirstProperty.DeclaringType.FullName; |
||||
if (typeName.StartsWith("System.Windows.") || typeName.StartsWith("ICSharpCode.WpfDesign.Designer.Controls.")) |
||||
return otherCategory; |
||||
return specialCategory; |
||||
} |
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
void RaisePropertyChanged(string name) |
||||
{ |
||||
if (PropertyChanged != null) { |
||||
PropertyChanged(this, new PropertyChangedEventArgs(name)); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
|
||||
//class CategoryNameComparer : IComparer<string>
|
||||
//{
|
||||
// public static CategoryNameComparer Instance = new CategoryNameComparer();
|
||||
|
||||
// public int Compare(string x, string y)
|
||||
// {
|
||||
// int i1 = Array.IndexOf(Metadata.CategoryOrder, x);
|
||||
// if (i1 == -1) i1 = int.MaxValue;
|
||||
// int i2 = Array.IndexOf(Metadata.CategoryOrder, y);
|
||||
// if (i2 == -1) i2 = int.MaxValue;
|
||||
// if (i1 == i2) return x.CompareTo(y);
|
||||
// return i1.CompareTo(i2);
|
||||
// }
|
||||
//}
|
||||
} |
||||
|
||||
public class CategoriesCollection : SortedObservableCollection<Category, string> |
||||
{ |
||||
public CategoriesCollection() |
||||
: base(n => n.Name) |
||||
{ |
||||
} |
||||
} |
||||
|
||||
public enum PropertyGridGroupMode |
||||
{ |
||||
GroupByPopularCategorys, |
||||
GroupByCategorys, |
||||
Ungrouped, |
||||
} |
||||
|
||||
public enum PropertyGridTab |
||||
{ |
||||
Properties, |
||||
Events |
||||
} |
||||
} |
||||
|
||||
@ -1,79 +1,79 @@
@@ -1,79 +1,79 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
using System; |
||||
using System.Diagnostics; |
||||
using System.Windows; |
||||
using System.Windows.Markup; |
||||
|
||||
namespace ICSharpCode.WpfDesign.XamlDom |
||||
{ |
||||
/// <summary>
|
||||
/// Static methods to help with <see cref="System.Windows.Markup.INameScope"/> operations on Xaml elements.
|
||||
/// </summary>
|
||||
public static class NameScopeHelper |
||||
{ |
||||
/// <summary>
|
||||
/// Finds the XAML namescope for the specified object and uses it to unregister the old name and then register the new name.
|
||||
/// </summary>
|
||||
/// <param name="namedObject">The object where the name was changed.</param>
|
||||
/// <param name="oldName">The old name.</param>
|
||||
/// <param name="newName">The new name.</param>
|
||||
internal static void NameChanged(XamlObject namedObject, string oldName, string newName) |
||||
{ |
||||
var obj = namedObject; |
||||
while (obj != null) { |
||||
var nameScope = GetNameScopeFromObject(obj.Instance); |
||||
if (nameScope != null) { |
||||
if (oldName != null) { |
||||
try { |
||||
nameScope.UnregisterName(oldName); |
||||
} catch (Exception x) { |
||||
Debug.WriteLine(x.Message); |
||||
} |
||||
} |
||||
if (newName != null) { |
||||
nameScope.RegisterName(newName, namedObject.Instance); |
||||
|
||||
try{ |
||||
var prp = namedObject.ElementType.GetProperty(namedObject.RuntimeNameProperty); |
||||
if (prp != null) |
||||
prp.SetValue(namedObject.Instance, newName, null); |
||||
} catch (Exception x) { |
||||
Debug.WriteLine(x.Message); |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
obj = obj.ParentObject; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the XAML namescope for the specified object.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to get the XAML namescope for.</param>
|
||||
/// <returns>A XAML namescope, as an <see cref="INameScope"/> instance.</returns>
|
||||
public static INameScope GetNameScopeFromObject(object obj) |
||||
{ |
||||
var nameScope = obj as INameScope; |
||||
if (nameScope == null) { |
||||
var depObj = obj as DependencyObject; |
||||
if (depObj != null) |
||||
nameScope = NameScope.GetNameScope(depObj); |
||||
} |
||||
|
||||
return nameScope; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Clears the <see cref="NameScope.NameScopeProperty"/> if the object is a <see cref="DependencyObject"/>.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to clear the <see cref="NameScope.NameScopeProperty"/> on.</param>
|
||||
public static void ClearNameScopeProperty(object obj) |
||||
{ |
||||
var depObj = obj as DependencyObject; |
||||
if (depObj != null) |
||||
depObj.ClearValue(NameScope.NameScopeProperty); |
||||
} |
||||
} |
||||
} |
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
using System; |
||||
using System.Diagnostics; |
||||
using System.Windows; |
||||
using System.Windows.Markup; |
||||
|
||||
namespace ICSharpCode.WpfDesign.XamlDom |
||||
{ |
||||
/// <summary>
|
||||
/// Static methods to help with <see cref="System.Windows.Markup.INameScope"/> operations on Xaml elements.
|
||||
/// </summary>
|
||||
public static class NameScopeHelper |
||||
{ |
||||
/// <summary>
|
||||
/// Finds the XAML namescope for the specified object and uses it to unregister the old name and then register the new name.
|
||||
/// </summary>
|
||||
/// <param name="namedObject">The object where the name was changed.</param>
|
||||
/// <param name="oldName">The old name.</param>
|
||||
/// <param name="newName">The new name.</param>
|
||||
internal static void NameChanged(XamlObject namedObject, string oldName, string newName) |
||||
{ |
||||
var obj = namedObject; |
||||
while (obj != null) { |
||||
var nameScope = GetNameScopeFromObject(obj.Instance); |
||||
if (nameScope != null) { |
||||
if (oldName != null) { |
||||
try { |
||||
nameScope.UnregisterName(oldName); |
||||
} catch (Exception x) { |
||||
Debug.WriteLine(x.Message); |
||||
} |
||||
} |
||||
if (newName != null) { |
||||
nameScope.RegisterName(newName, namedObject.Instance); |
||||
|
||||
try{ |
||||
var prp = namedObject.ElementType.GetProperty(namedObject.RuntimeNameProperty); |
||||
if (prp != null) |
||||
prp.SetValue(namedObject.Instance, newName, null); |
||||
} catch (Exception x) { |
||||
Debug.WriteLine(x.Message); |
||||
} |
||||
} |
||||
break; |
||||
} |
||||
obj = obj.ParentObject; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the XAML namescope for the specified object.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to get the XAML namescope for.</param>
|
||||
/// <returns>A XAML namescope, as an <see cref="INameScope"/> instance.</returns>
|
||||
public static INameScope GetNameScopeFromObject(object obj) |
||||
{ |
||||
var nameScope = obj as INameScope; |
||||
if (nameScope == null) { |
||||
var depObj = obj as DependencyObject; |
||||
if (depObj != null) |
||||
nameScope = NameScope.GetNameScope(depObj); |
||||
} |
||||
|
||||
return nameScope; |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Clears the <see cref="NameScope.NameScopeProperty"/> if the object is a <see cref="DependencyObject"/>.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to clear the <see cref="NameScope.NameScopeProperty"/> on.</param>
|
||||
public static void ClearNameScopeProperty(object obj) |
||||
{ |
||||
var depObj = obj as DependencyObject; |
||||
if (depObj != null) |
||||
depObj.ClearValue(NameScope.NameScopeProperty); |
||||
} |
||||
} |
||||
} |
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,420 +1,420 @@
@@ -1,420 +1,420 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.ComponentModel; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Collections.ObjectModel; |
||||
using System.Windows.Data; |
||||
using System.Windows.Media; |
||||
using System.Windows.Markup; |
||||
|
||||
namespace ICSharpCode.WpfDesign.PropertyGrid |
||||
{ |
||||
/// <summary>
|
||||
/// View-Model class for the property grid.
|
||||
/// </summary>
|
||||
public class PropertyNode : INotifyPropertyChanged |
||||
{ |
||||
static object Unset = new object(); |
||||
|
||||
/// <summary>
|
||||
/// Gets the properties that are presented by this node.
|
||||
/// This might be multiple properties if multiple controls are selected.
|
||||
/// </summary>
|
||||
public ReadOnlyCollection<DesignItemProperty> Properties { get; private set; } |
||||
|
||||
bool raiseEvents = true; |
||||
bool hasStringConverter; |
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the property.
|
||||
/// </summary>
|
||||
public string Name |
||||
{ |
||||
get |
||||
{ |
||||
var dp = FirstProperty.DependencyProperty; |
||||
if (dp != null) |
||||
{ |
||||
var dpd = DependencyPropertyDescriptor.FromProperty(dp, FirstProperty.DesignItem.ComponentType); |
||||
if (dpd.IsAttached) |
||||
{ |
||||
// Will return the attached property name in the form of <DeclaringType>.<PropertyName>
|
||||
return dpd.Name; |
||||
} |
||||
} |
||||
|
||||
return FirstProperty.Name; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets if this property node represents an event.
|
||||
/// </summary>
|
||||
public bool IsEvent { get { return FirstProperty.IsEvent; } } |
||||
|
||||
/// <summary>
|
||||
/// Gets the design context associated with this set of properties.
|
||||
/// </summary>
|
||||
public DesignContext Context { get { return FirstProperty.DesignItem.Context; } } |
||||
|
||||
/// <summary>
|
||||
/// Gets the service container associated with this set of properties.
|
||||
/// </summary>
|
||||
public ServiceContainer Services { get { return FirstProperty.DesignItem.Services; } } |
||||
|
||||
/// <summary>
|
||||
/// Gets the editor control that edits this property.
|
||||
/// </summary>
|
||||
public FrameworkElement Editor { get; private set; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the first property (equivalent to Properties[0])
|
||||
/// </summary>
|
||||
public DesignItemProperty FirstProperty { get { return Properties[0]; } } |
||||
|
||||
/// <summary>
|
||||
/// For nested property nodes, gets the parent node.
|
||||
/// </summary>
|
||||
public PropertyNode Parent { get; private set; } |
||||
|
||||
/// <summary>
|
||||
/// For nested property nodes, gets the level of this node.
|
||||
/// </summary>
|
||||
public int Level { get; private set; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the category of this node.
|
||||
/// </summary>
|
||||
public Category Category { get; set; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the list of child nodes.
|
||||
/// </summary>
|
||||
public ObservableCollection<PropertyNode> Children { get; private set; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the list of advanced child nodes (not visible by default).
|
||||
/// </summary>
|
||||
public ObservableCollection<PropertyNode> MoreChildren { get; private set; } |
||||
|
||||
bool isExpanded; |
||||
|
||||
/// <summary>
|
||||
/// Gets whether this property node is currently expanded.
|
||||
/// </summary>
|
||||
public bool IsExpanded { |
||||
get { |
||||
return isExpanded; |
||||
} |
||||
set { |
||||
isExpanded = value; |
||||
UpdateChildren(); |
||||
RaisePropertyChanged("IsExpanded"); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets whether this property node has children.
|
||||
/// </summary>
|
||||
public bool HasChildren { |
||||
get { return Children.Count > 0 || MoreChildren.Count > 0; } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the description object using the IPropertyDescriptionService.
|
||||
/// </summary>
|
||||
public object Description { |
||||
get { |
||||
IPropertyDescriptionService s = Services.GetService<IPropertyDescriptionService>(); |
||||
if (s != null) { |
||||
return s.GetDescription(FirstProperty); |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets/Sets the value of this property.
|
||||
/// </summary>
|
||||
public object Value { |
||||
get { |
||||
if (IsAmbiguous) return null; |
||||
var result = FirstProperty.ValueOnInstance; |
||||
if (result == DependencyProperty.UnsetValue) return null; |
||||
return result; |
||||
} |
||||
set { |
||||
SetValueCore(value); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets/Sets the value of this property in string form
|
||||
/// </summary>
|
||||
public string ValueString { |
||||
get { |
||||
if (ValueItem == null || ValueItem.Component is MarkupExtension) { |
||||
if (Value == null) return null; |
||||
if (hasStringConverter) { |
||||
return FirstProperty.TypeConverter.ConvertToInvariantString(Value); |
||||
} |
||||
return "(" + Value.GetType().Name + ")"; |
||||
} |
||||
return "(" + ValueItem.ComponentType.Name + ")"; |
||||
} |
||||
set { |
||||
// make sure we only catch specific exceptions
|
||||
// and/or show the error message to the user
|
||||
//try {
|
||||
Value = FirstProperty.TypeConverter.ConvertFromInvariantString(value); |
||||
//} catch {
|
||||
// OnValueOnInstanceChanged();
|
||||
//}
|
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets whether the property node is enabled for editing.
|
||||
/// </summary>
|
||||
public bool IsEnabled { |
||||
get { |
||||
return ValueItem == null && hasStringConverter; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets whether this property was set locally.
|
||||
/// </summary>
|
||||
public bool IsSet { |
||||
get { |
||||
foreach (var p in Properties) { |
||||
if (p.IsSet) return true; |
||||
} |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the color of the name.
|
||||
/// Depends on the type of the value (binding/resource/etc.)
|
||||
/// </summary>
|
||||
public Brush NameForeground { |
||||
get { |
||||
if (ValueItem != null) { |
||||
object component = ValueItem.Component; |
||||
if (component is BindingBase) |
||||
return Brushes.DarkGoldenrod; |
||||
if (component is StaticResourceExtension || component is DynamicResourceExtension) |
||||
return Brushes.DarkGreen; |
||||
} |
||||
return SystemColors.WindowTextBrush; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Returns the DesignItem that owns the property (= the DesignItem that is currently selected).
|
||||
/// Returns null if multiple DesignItems are selected.
|
||||
/// </summary>
|
||||
public DesignItem ValueItem { |
||||
get { |
||||
if (Properties.Count == 1) { |
||||
return FirstProperty.Value; |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets whether the property value is ambiguous (multiple controls having different values are selected).
|
||||
/// </summary>
|
||||
public bool IsAmbiguous { |
||||
get { |
||||
foreach (var p in Properties) { |
||||
if (!object.Equals(p.ValueOnInstance, FirstProperty.ValueOnInstance)) { |
||||
return true; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
bool isVisible; |
||||
|
||||
/// <summary>
|
||||
/// Gets/Sets whether the property is visible.
|
||||
/// </summary>
|
||||
public bool IsVisible { |
||||
get { |
||||
return isVisible; |
||||
} |
||||
set { |
||||
isVisible = value; |
||||
RaisePropertyChanged("IsVisible"); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets whether resetting the property is possible.
|
||||
/// </summary>
|
||||
public bool CanReset { |
||||
get { return IsSet; } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Resets the property.
|
||||
/// </summary>
|
||||
public void Reset() |
||||
{ |
||||
SetValueCore(Unset); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Replaces the value of this node with a new binding.
|
||||
/// </summary>
|
||||
public void CreateBinding() |
||||
{ |
||||
Value = new Binding(); |
||||
IsExpanded = true; |
||||
} |
||||
|
||||
void SetValueCore(object value) |
||||
{ |
||||
raiseEvents = false; |
||||
if (value == Unset) { |
||||
foreach (var p in Properties) { |
||||
p.Reset(); |
||||
} |
||||
} else { |
||||
foreach (var p in Properties) { |
||||
p.SetValue(value); |
||||
} |
||||
} |
||||
raiseEvents = true; |
||||
OnValueChanged(); |
||||
} |
||||
|
||||
void OnValueChanged() |
||||
{ |
||||
RaisePropertyChanged("IsSet"); |
||||
RaisePropertyChanged("Value"); |
||||
RaisePropertyChanged("ValueString"); |
||||
RaisePropertyChanged("IsAmbiguous"); |
||||
RaisePropertyChanged("FontWeight"); |
||||
RaisePropertyChanged("IsEnabled"); |
||||
RaisePropertyChanged("NameForeground"); |
||||
|
||||
UpdateChildren(); |
||||
} |
||||
|
||||
void OnValueOnInstanceChanged() |
||||
{ |
||||
RaisePropertyChanged("Value"); |
||||
RaisePropertyChanged("ValueString"); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Creates a new PropertyNode instance.
|
||||
/// </summary>
|
||||
public PropertyNode() |
||||
{ |
||||
Children = new ObservableCollection<PropertyNode>(); |
||||
MoreChildren = new ObservableCollection<PropertyNode>(); |
||||
} |
||||
|
||||
PropertyNode(DesignItemProperty[] properties, PropertyNode parent) : this() |
||||
{ |
||||
this.Parent = parent; |
||||
this.Level = parent == null ? 0 : parent.Level + 1; |
||||
Load(properties); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Initializes this property node with the specified properties.
|
||||
/// </summary>
|
||||
public void Load(DesignItemProperty[] properties) |
||||
{ |
||||
if (this.Properties != null) { |
||||
// detach events from old properties
|
||||
foreach (var property in this.Properties) { |
||||
property.ValueChanged -= new EventHandler(property_ValueChanged); |
||||
property.ValueOnInstanceChanged -= new EventHandler(property_ValueOnInstanceChanged); |
||||
} |
||||
} |
||||
|
||||
this.Properties = new ReadOnlyCollection<DesignItemProperty>(properties); |
||||
|
||||
if (Editor == null) |
||||
Editor = EditorManager.CreateEditor(FirstProperty); |
||||
|
||||
foreach (var property in properties) { |
||||
property.ValueChanged += new EventHandler(property_ValueChanged); |
||||
property.ValueOnInstanceChanged += new EventHandler(property_ValueOnInstanceChanged); |
||||
} |
||||
|
||||
hasStringConverter = |
||||
FirstProperty.TypeConverter.CanConvertFrom(typeof(string)) && |
||||
FirstProperty.TypeConverter.CanConvertTo(typeof(string)); |
||||
|
||||
OnValueChanged(); |
||||
} |
||||
|
||||
void property_ValueOnInstanceChanged(object sender, EventArgs e) |
||||
{ |
||||
if (raiseEvents) OnValueOnInstanceChanged(); |
||||
} |
||||
|
||||
void property_ValueChanged(object sender, EventArgs e) |
||||
{ |
||||
if (raiseEvents) OnValueChanged(); |
||||
} |
||||
|
||||
void UpdateChildren() |
||||
{ |
||||
Children.Clear(); |
||||
MoreChildren.Clear(); |
||||
|
||||
if (Parent == null || Parent.IsExpanded) { |
||||
if (ValueItem != null) { |
||||
var list = TypeHelper.GetAvailableProperties(ValueItem.Component) |
||||
.OrderBy(d => d.Name) |
||||
.Select(d => new PropertyNode(new[] { ValueItem.Properties.GetProperty(d) }, this)); |
||||
|
||||
foreach (var node in list) { |
||||
if (Metadata.IsBrowsable(node.FirstProperty)) { |
||||
node.IsVisible = true; |
||||
if (Metadata.IsPopularProperty(node.FirstProperty)) { |
||||
Children.Add(node); |
||||
} else { |
||||
MoreChildren.Add(node); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
RaisePropertyChanged("HasChildren"); |
||||
} |
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a property has changed. Used to support WPF data binding.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
void RaisePropertyChanged(string name) |
||||
{ |
||||
if (PropertyChanged != null) { |
||||
PropertyChanged(this, new PropertyChangedEventArgs(name)); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
using System.Text; |
||||
using System.ComponentModel; |
||||
using System.Windows; |
||||
using System.Windows.Controls; |
||||
using System.Collections.ObjectModel; |
||||
using System.Windows.Data; |
||||
using System.Windows.Media; |
||||
using System.Windows.Markup; |
||||
|
||||
namespace ICSharpCode.WpfDesign.PropertyGrid |
||||
{ |
||||
/// <summary>
|
||||
/// View-Model class for the property grid.
|
||||
/// </summary>
|
||||
public class PropertyNode : INotifyPropertyChanged |
||||
{ |
||||
static object Unset = new object(); |
||||
|
||||
/// <summary>
|
||||
/// Gets the properties that are presented by this node.
|
||||
/// This might be multiple properties if multiple controls are selected.
|
||||
/// </summary>
|
||||
public ReadOnlyCollection<DesignItemProperty> Properties { get; private set; } |
||||
|
||||
bool raiseEvents = true; |
||||
bool hasStringConverter; |
||||
|
||||
/// <summary>
|
||||
/// Gets the name of the property.
|
||||
/// </summary>
|
||||
public string Name |
||||
{ |
||||
get |
||||
{ |
||||
var dp = FirstProperty.DependencyProperty; |
||||
if (dp != null) |
||||
{ |
||||
var dpd = DependencyPropertyDescriptor.FromProperty(dp, FirstProperty.DesignItem.ComponentType); |
||||
if (dpd.IsAttached) |
||||
{ |
||||
// Will return the attached property name in the form of <DeclaringType>.<PropertyName>
|
||||
return dpd.Name; |
||||
} |
||||
} |
||||
|
||||
return FirstProperty.Name; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets if this property node represents an event.
|
||||
/// </summary>
|
||||
public bool IsEvent { get { return FirstProperty.IsEvent; } } |
||||
|
||||
/// <summary>
|
||||
/// Gets the design context associated with this set of properties.
|
||||
/// </summary>
|
||||
public DesignContext Context { get { return FirstProperty.DesignItem.Context; } } |
||||
|
||||
/// <summary>
|
||||
/// Gets the service container associated with this set of properties.
|
||||
/// </summary>
|
||||
public ServiceContainer Services { get { return FirstProperty.DesignItem.Services; } } |
||||
|
||||
/// <summary>
|
||||
/// Gets the editor control that edits this property.
|
||||
/// </summary>
|
||||
public FrameworkElement Editor { get; private set; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the first property (equivalent to Properties[0])
|
||||
/// </summary>
|
||||
public DesignItemProperty FirstProperty { get { return Properties[0]; } } |
||||
|
||||
/// <summary>
|
||||
/// For nested property nodes, gets the parent node.
|
||||
/// </summary>
|
||||
public PropertyNode Parent { get; private set; } |
||||
|
||||
/// <summary>
|
||||
/// For nested property nodes, gets the level of this node.
|
||||
/// </summary>
|
||||
public int Level { get; private set; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the category of this node.
|
||||
/// </summary>
|
||||
public Category Category { get; set; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the list of child nodes.
|
||||
/// </summary>
|
||||
public ObservableCollection<PropertyNode> Children { get; private set; } |
||||
|
||||
/// <summary>
|
||||
/// Gets the list of advanced child nodes (not visible by default).
|
||||
/// </summary>
|
||||
public ObservableCollection<PropertyNode> MoreChildren { get; private set; } |
||||
|
||||
bool isExpanded; |
||||
|
||||
/// <summary>
|
||||
/// Gets whether this property node is currently expanded.
|
||||
/// </summary>
|
||||
public bool IsExpanded { |
||||
get { |
||||
return isExpanded; |
||||
} |
||||
set { |
||||
isExpanded = value; |
||||
UpdateChildren(); |
||||
RaisePropertyChanged("IsExpanded"); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets whether this property node has children.
|
||||
/// </summary>
|
||||
public bool HasChildren { |
||||
get { return Children.Count > 0 || MoreChildren.Count > 0; } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the description object using the IPropertyDescriptionService.
|
||||
/// </summary>
|
||||
public object Description { |
||||
get { |
||||
IPropertyDescriptionService s = Services.GetService<IPropertyDescriptionService>(); |
||||
if (s != null) { |
||||
return s.GetDescription(FirstProperty); |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets/Sets the value of this property.
|
||||
/// </summary>
|
||||
public object Value { |
||||
get { |
||||
if (IsAmbiguous) return null; |
||||
var result = FirstProperty.ValueOnInstance; |
||||
if (result == DependencyProperty.UnsetValue) return null; |
||||
return result; |
||||
} |
||||
set { |
||||
SetValueCore(value); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets/Sets the value of this property in string form
|
||||
/// </summary>
|
||||
public string ValueString { |
||||
get { |
||||
if (ValueItem == null || ValueItem.Component is MarkupExtension) { |
||||
if (Value == null) return null; |
||||
if (hasStringConverter) { |
||||
return FirstProperty.TypeConverter.ConvertToInvariantString(Value); |
||||
} |
||||
return "(" + Value.GetType().Name + ")"; |
||||
} |
||||
return "(" + ValueItem.ComponentType.Name + ")"; |
||||
} |
||||
set { |
||||
// make sure we only catch specific exceptions
|
||||
// and/or show the error message to the user
|
||||
//try {
|
||||
Value = FirstProperty.TypeConverter.ConvertFromInvariantString(value); |
||||
//} catch {
|
||||
// OnValueOnInstanceChanged();
|
||||
//}
|
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets whether the property node is enabled for editing.
|
||||
/// </summary>
|
||||
public bool IsEnabled { |
||||
get { |
||||
return ValueItem == null && hasStringConverter; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets whether this property was set locally.
|
||||
/// </summary>
|
||||
public bool IsSet { |
||||
get { |
||||
foreach (var p in Properties) { |
||||
if (p.IsSet) return true; |
||||
} |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets the color of the name.
|
||||
/// Depends on the type of the value (binding/resource/etc.)
|
||||
/// </summary>
|
||||
public Brush NameForeground { |
||||
get { |
||||
if (ValueItem != null) { |
||||
object component = ValueItem.Component; |
||||
if (component is BindingBase) |
||||
return Brushes.DarkGoldenrod; |
||||
if (component is StaticResourceExtension || component is DynamicResourceExtension) |
||||
return Brushes.DarkGreen; |
||||
} |
||||
return SystemColors.WindowTextBrush; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Returns the DesignItem that owns the property (= the DesignItem that is currently selected).
|
||||
/// Returns null if multiple DesignItems are selected.
|
||||
/// </summary>
|
||||
public DesignItem ValueItem { |
||||
get { |
||||
if (Properties.Count == 1) { |
||||
return FirstProperty.Value; |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets whether the property value is ambiguous (multiple controls having different values are selected).
|
||||
/// </summary>
|
||||
public bool IsAmbiguous { |
||||
get { |
||||
foreach (var p in Properties) { |
||||
if (!object.Equals(p.ValueOnInstance, FirstProperty.ValueOnInstance)) { |
||||
return true; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
} |
||||
|
||||
bool isVisible; |
||||
|
||||
/// <summary>
|
||||
/// Gets/Sets whether the property is visible.
|
||||
/// </summary>
|
||||
public bool IsVisible { |
||||
get { |
||||
return isVisible; |
||||
} |
||||
set { |
||||
isVisible = value; |
||||
RaisePropertyChanged("IsVisible"); |
||||
} |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Gets whether resetting the property is possible.
|
||||
/// </summary>
|
||||
public bool CanReset { |
||||
get { return IsSet; } |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Resets the property.
|
||||
/// </summary>
|
||||
public void Reset() |
||||
{ |
||||
SetValueCore(Unset); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Replaces the value of this node with a new binding.
|
||||
/// </summary>
|
||||
public void CreateBinding() |
||||
{ |
||||
Value = new Binding(); |
||||
IsExpanded = true; |
||||
} |
||||
|
||||
void SetValueCore(object value) |
||||
{ |
||||
raiseEvents = false; |
||||
if (value == Unset) { |
||||
foreach (var p in Properties) { |
||||
p.Reset(); |
||||
} |
||||
} else { |
||||
foreach (var p in Properties) { |
||||
p.SetValue(value); |
||||
} |
||||
} |
||||
raiseEvents = true; |
||||
OnValueChanged(); |
||||
} |
||||
|
||||
void OnValueChanged() |
||||
{ |
||||
RaisePropertyChanged("IsSet"); |
||||
RaisePropertyChanged("Value"); |
||||
RaisePropertyChanged("ValueString"); |
||||
RaisePropertyChanged("IsAmbiguous"); |
||||
RaisePropertyChanged("FontWeight"); |
||||
RaisePropertyChanged("IsEnabled"); |
||||
RaisePropertyChanged("NameForeground"); |
||||
|
||||
UpdateChildren(); |
||||
} |
||||
|
||||
void OnValueOnInstanceChanged() |
||||
{ |
||||
RaisePropertyChanged("Value"); |
||||
RaisePropertyChanged("ValueString"); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Creates a new PropertyNode instance.
|
||||
/// </summary>
|
||||
public PropertyNode() |
||||
{ |
||||
Children = new ObservableCollection<PropertyNode>(); |
||||
MoreChildren = new ObservableCollection<PropertyNode>(); |
||||
} |
||||
|
||||
PropertyNode(DesignItemProperty[] properties, PropertyNode parent) : this() |
||||
{ |
||||
this.Parent = parent; |
||||
this.Level = parent == null ? 0 : parent.Level + 1; |
||||
Load(properties); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Initializes this property node with the specified properties.
|
||||
/// </summary>
|
||||
public void Load(DesignItemProperty[] properties) |
||||
{ |
||||
if (this.Properties != null) { |
||||
// detach events from old properties
|
||||
foreach (var property in this.Properties) { |
||||
property.ValueChanged -= new EventHandler(property_ValueChanged); |
||||
property.ValueOnInstanceChanged -= new EventHandler(property_ValueOnInstanceChanged); |
||||
} |
||||
} |
||||
|
||||
this.Properties = new ReadOnlyCollection<DesignItemProperty>(properties); |
||||
|
||||
if (Editor == null) |
||||
Editor = EditorManager.CreateEditor(FirstProperty); |
||||
|
||||
foreach (var property in properties) { |
||||
property.ValueChanged += new EventHandler(property_ValueChanged); |
||||
property.ValueOnInstanceChanged += new EventHandler(property_ValueOnInstanceChanged); |
||||
} |
||||
|
||||
hasStringConverter = |
||||
FirstProperty.TypeConverter.CanConvertFrom(typeof(string)) && |
||||
FirstProperty.TypeConverter.CanConvertTo(typeof(string)); |
||||
|
||||
OnValueChanged(); |
||||
} |
||||
|
||||
void property_ValueOnInstanceChanged(object sender, EventArgs e) |
||||
{ |
||||
if (raiseEvents) OnValueOnInstanceChanged(); |
||||
} |
||||
|
||||
void property_ValueChanged(object sender, EventArgs e) |
||||
{ |
||||
if (raiseEvents) OnValueChanged(); |
||||
} |
||||
|
||||
void UpdateChildren() |
||||
{ |
||||
Children.Clear(); |
||||
MoreChildren.Clear(); |
||||
|
||||
if (Parent == null || Parent.IsExpanded) { |
||||
if (ValueItem != null) { |
||||
var list = TypeHelper.GetAvailableProperties(ValueItem.Component) |
||||
.OrderBy(d => d.Name) |
||||
.Select(d => new PropertyNode(new[] { ValueItem.Properties.GetProperty(d) }, this)); |
||||
|
||||
foreach (var node in list) { |
||||
if (Metadata.IsBrowsable(node.FirstProperty)) { |
||||
node.IsVisible = true; |
||||
if (Metadata.IsPopularProperty(node.FirstProperty)) { |
||||
Children.Add(node); |
||||
} else { |
||||
MoreChildren.Add(node); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
RaisePropertyChanged("HasChildren"); |
||||
} |
||||
|
||||
#region INotifyPropertyChanged Members
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when a property has changed. Used to support WPF data binding.
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged; |
||||
|
||||
void RaisePropertyChanged(string name) |
||||
{ |
||||
if (PropertyChanged != null) { |
||||
PropertyChanged(this, new PropertyChangedEventArgs(name)); |
||||
} |
||||
} |
||||
|
||||
#endregion
|
||||
} |
||||
} |
||||
|
||||
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using NuGet; |
||||
|
||||
namespace ICSharpCode.PackageManagement |
||||
{ |
||||
public class RemovedPackageReferenceMonitor : IDisposable |
||||
{ |
||||
ISharpDevelopProjectManager projectManager; |
||||
List<IPackage> packagesRemoved = new List<IPackage>(); |
||||
|
||||
public RemovedPackageReferenceMonitor(ISharpDevelopProjectManager projectManager) |
||||
{ |
||||
this.projectManager = projectManager; |
||||
projectManager.PackageReferenceRemoved += PackageReferenceRemoved; |
||||
} |
||||
|
||||
void PackageReferenceRemoved(object sender, PackageOperationEventArgs e) |
||||
{ |
||||
packagesRemoved.Add(e.Package); |
||||
} |
||||
|
||||
public void Dispose() |
||||
{ |
||||
projectManager.PackageReferenceRemoved -= PackageReferenceRemoved; |
||||
} |
||||
|
||||
public List<IPackage> PackagesRemoved { |
||||
get { return packagesRemoved; } |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,55 @@
@@ -0,0 +1,55 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
|
||||
namespace ICSharpCode.PackageManagement.Scripting |
||||
{ |
||||
public class MSBuildProjectPropertiesMergeResult |
||||
{ |
||||
List<string> propertiesAdded = new List<string>(); |
||||
List<string> propertiesUpdated = new List<string>(); |
||||
|
||||
public IEnumerable<string> PropertiesAdded { |
||||
get { return propertiesAdded; } |
||||
} |
||||
|
||||
public IEnumerable<string> PropertiesUpdated { |
||||
get { return propertiesUpdated; } |
||||
} |
||||
|
||||
public override string ToString() |
||||
{ |
||||
return String.Format( |
||||
"Properties added: {0}\r\nProperties updated: {1}", |
||||
PropertiesToString(propertiesAdded), |
||||
PropertiesToString(propertiesUpdated)); |
||||
} |
||||
|
||||
static string PropertiesToString(IEnumerable<string> properties) |
||||
{ |
||||
if (!properties.Any()) { |
||||
return String.Empty; |
||||
} |
||||
|
||||
return String.Join(",\r\n", properties.Select(property => property)); |
||||
} |
||||
|
||||
public void AddPropertyAdded(string propertyName) |
||||
{ |
||||
propertiesAdded.Add(propertyName); |
||||
} |
||||
|
||||
public void AddPropertyUpdated(string propertyName) |
||||
{ |
||||
propertiesUpdated.Add(propertyName); |
||||
} |
||||
|
||||
public bool AnyPropertiesChanged() |
||||
{ |
||||
return propertiesUpdated.Any() || propertiesAdded.Any(); |
||||
} |
||||
} |
||||
} |
||||
@ -0,0 +1,95 @@
@@ -0,0 +1,95 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Linq; |
||||
|
||||
using ICSharpCode.SharpDevelop.Project; |
||||
using Microsoft.Build.Construction; |
||||
using Microsoft.Build.Evaluation; |
||||
|
||||
namespace ICSharpCode.PackageManagement.Scripting |
||||
{ |
||||
public class MSBuildProjectPropertiesMerger |
||||
{ |
||||
IPackageManagementProjectService projectService; |
||||
Project msbuildProject; |
||||
MSBuildBasedProject sharpDevelopProject; |
||||
MSBuildProjectPropertiesMergeResult result = new MSBuildProjectPropertiesMergeResult(); |
||||
|
||||
public MSBuildProjectPropertiesMerger(Project msbuildProject, MSBuildBasedProject sharpDevelopProject) |
||||
: this(msbuildProject, sharpDevelopProject, new PackageManagementProjectService()) |
||||
{ |
||||
} |
||||
|
||||
public MSBuildProjectPropertiesMerger( |
||||
Project msbuildProject, |
||||
MSBuildBasedProject sharpDevelopProject, |
||||
IPackageManagementProjectService projectService) |
||||
{ |
||||
this.msbuildProject = msbuildProject; |
||||
this.sharpDevelopProject = sharpDevelopProject; |
||||
this.projectService = projectService; |
||||
} |
||||
|
||||
public MSBuildProjectPropertiesMergeResult Result { |
||||
get { return result; } |
||||
} |
||||
|
||||
public void Merge() |
||||
{ |
||||
foreach (ProjectPropertyElement property in msbuildProject.Xml.Properties) { |
||||
UpdateProperty(property); |
||||
} |
||||
|
||||
projectService.Save(sharpDevelopProject); |
||||
} |
||||
|
||||
void UpdateProperty(ProjectPropertyElement msbuildProjectProperty) |
||||
{ |
||||
List<ProjectPropertyElement> sharpDevelopProjectProperties = FindSharpDevelopProjectProperties(msbuildProjectProperty); |
||||
if (sharpDevelopProjectProperties.Count > 1) { |
||||
// Ignore. Currently do not handle properties defined inside
|
||||
// property groups with conditions (e.g. OutputPath)
|
||||
} else if (!sharpDevelopProjectProperties.Any()) { |
||||
AddPropertyToSharpDevelopProject(msbuildProjectProperty); |
||||
} else if (HasMSBuildProjectPropertyBeenUpdated(msbuildProjectProperty, sharpDevelopProjectProperties.First())) { |
||||
UpdatePropertyInSharpDevelopProject(msbuildProjectProperty); |
||||
} |
||||
} |
||||
|
||||
List<ProjectPropertyElement> FindSharpDevelopProjectProperties(ProjectPropertyElement msbuildProjectProperty) |
||||
{ |
||||
lock (sharpDevelopProject.SyncRoot) { |
||||
return sharpDevelopProject |
||||
.MSBuildProjectFile |
||||
.Properties |
||||
.Where(property => String.Equals(property.Name, msbuildProjectProperty.Name, StringComparison.OrdinalIgnoreCase)) |
||||
.ToList(); |
||||
} |
||||
} |
||||
|
||||
void AddPropertyToSharpDevelopProject(ProjectPropertyElement msbuildProjectProperty) |
||||
{ |
||||
SetPropertyInSharpDevelopProject(msbuildProjectProperty); |
||||
result.AddPropertyAdded(msbuildProjectProperty.Name); |
||||
} |
||||
|
||||
void SetPropertyInSharpDevelopProject(ProjectPropertyElement msbuildProjectProperty) |
||||
{ |
||||
sharpDevelopProject.SetProperty(msbuildProjectProperty.Name, msbuildProjectProperty.Value); |
||||
} |
||||
|
||||
bool HasMSBuildProjectPropertyBeenUpdated(ProjectPropertyElement msbuildProjectProperty, ProjectPropertyElement sharpDevelopProjectProperty) |
||||
{ |
||||
return msbuildProjectProperty.Value != sharpDevelopProjectProperty.Value; |
||||
} |
||||
|
||||
void UpdatePropertyInSharpDevelopProject(ProjectPropertyElement msbuildProjectProperty) |
||||
{ |
||||
SetPropertyInSharpDevelopProject(msbuildProjectProperty); |
||||
result.AddPropertyUpdated(msbuildProjectProperty.Name); |
||||
} |
||||
} |
||||
} |
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,249 @@
@@ -0,0 +1,249 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using System.Linq; |
||||
using ICSharpCode.PackageManagement; |
||||
using ICSharpCode.PackageManagement.Scripting; |
||||
using Microsoft.Build.Construction; |
||||
using Microsoft.Build.Evaluation; |
||||
using NUnit.Framework; |
||||
using PackageManagement.Tests.Helpers; |
||||
using Rhino.Mocks; |
||||
|
||||
namespace PackageManagement.Tests.Scripting |
||||
{ |
||||
[TestFixture] |
||||
public class MSBuildProjectPropertiesMergerTests |
||||
{ |
||||
MSBuildProjectPropertiesMerger propertiesMerger; |
||||
IPackageManagementProjectService projectService; |
||||
TestableProject sharpDevelopProject; |
||||
Project msbuildProject; |
||||
|
||||
[SetUp] |
||||
public void Init() |
||||
{ |
||||
CreateMSBuildProject(); |
||||
CreateSharpDevelopProject(); |
||||
CreateProjectPropertiesMerger(); |
||||
} |
||||
|
||||
void CreateMSBuildProject() |
||||
{ |
||||
msbuildProject = new Project(); |
||||
} |
||||
|
||||
void CreateSharpDevelopProject() |
||||
{ |
||||
sharpDevelopProject = ProjectHelper.CreateTestProject(); |
||||
} |
||||
|
||||
void CreateProjectPropertiesMerger() |
||||
{ |
||||
projectService = MockRepository.GenerateStub<IPackageManagementProjectService>(); |
||||
propertiesMerger = new MSBuildProjectPropertiesMerger(msbuildProject, sharpDevelopProject, projectService); |
||||
} |
||||
|
||||
void Merge() |
||||
{ |
||||
propertiesMerger.Merge(); |
||||
} |
||||
|
||||
void AddPropertyToSharpDevelopProject(string name, string value) |
||||
{ |
||||
sharpDevelopProject.SetProperty(name, value); |
||||
} |
||||
|
||||
void AddPropertyToSharpDevelopProjectWithCondition(string name, string value, string condition) |
||||
{ |
||||
lock (sharpDevelopProject.SyncRoot) |
||||
AddPropertyWithCondition(sharpDevelopProject.MSBuildProjectFile, name, value, condition); |
||||
} |
||||
|
||||
void AddPropertyWithCondition(ProjectRootElement projectRoot, string name, string value, string condition) |
||||
{ |
||||
ProjectPropertyGroupElement groupProperty = projectRoot.CreatePropertyGroupElement(); |
||||
groupProperty.Condition = condition; |
||||
projectRoot.AppendChild(groupProperty); |
||||
|
||||
ProjectPropertyElement property = projectRoot.CreatePropertyElement(name); |
||||
groupProperty.AppendChild(property); |
||||
property.Value = value; |
||||
property.Condition = condition; |
||||
} |
||||
|
||||
void AddPropertyToMSBuildProject(string name, string value) |
||||
{ |
||||
msbuildProject.SetProperty(name, value); |
||||
} |
||||
|
||||
void AddPropertyToMSBuildProjectWithCondition(string name, string value, string condition) |
||||
{ |
||||
AddPropertyWithCondition(msbuildProject.Xml, name, value, condition); |
||||
} |
||||
|
||||
void AssertSharpDevelopProjectContainsProperty(string propertyName, string expectedValue) |
||||
{ |
||||
string actualValue = sharpDevelopProject.GetEvaluatedProperty(propertyName); |
||||
|
||||
Assert.AreEqual(expectedValue, actualValue); |
||||
} |
||||
|
||||
[Test] |
||||
public void Merge_MSBuildProjectHasNewPropertyAdded_PropertyAddedToSharpDevelopProject() |
||||
{ |
||||
AddPropertyToMSBuildProject("Test", "test-value"); |
||||
|
||||
Merge(); |
||||
|
||||
AssertSharpDevelopProjectContainsProperty("Test", "test-value"); |
||||
} |
||||
|
||||
[Test] |
||||
public void Merge_MSBuildProjectHasNewPropertyAdded_SharpDevelopProjectIsSaved() |
||||
{ |
||||
AddPropertyToMSBuildProject("Test", "test-value"); |
||||
|
||||
Merge(); |
||||
|
||||
projectService.AssertWasCalled(service => service.Save(sharpDevelopProject)); |
||||
} |
||||
|
||||
[Test] |
||||
public void Merge_MSBuildProjectHasTwoNewPropertiesAdded_BothPropertiesAddedToSharpDevelopProject() |
||||
{ |
||||
AddPropertyToMSBuildProject("Test1", "test-value1"); |
||||
AddPropertyToMSBuildProject("Test2", "test-value2"); |
||||
|
||||
Merge(); |
||||
|
||||
AssertSharpDevelopProjectContainsProperty("Test1", "test-value1"); |
||||
AssertSharpDevelopProjectContainsProperty("Test2", "test-value2"); |
||||
} |
||||
|
||||
[Test] |
||||
public void Merge_MSBuildProjectHasTwoNewPropertiesAdded_MergeResultHasBothPropertiesAdded() |
||||
{ |
||||
AddPropertyToMSBuildProject("Test1", "test-value2"); |
||||
AddPropertyToMSBuildProject("Test2", "test-value2"); |
||||
|
||||
Merge(); |
||||
|
||||
var expected = new string[] { "Test1", "Test2" }; |
||||
string expectedToString = "Properties added: Test1,\r\nTest2\r\nProperties updated: "; |
||||
CollectionAssert.AreEqual(expected, propertiesMerger.Result.PropertiesAdded); |
||||
Assert.AreEqual(expectedToString, propertiesMerger.Result.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void Merge_MSBuildProjectPropertyUpdated_SharpDevelopProjectPropertyIsUpdated() |
||||
{ |
||||
AddPropertyToSharpDevelopProject("Test", "old-value"); |
||||
AddPropertyToMSBuildProject("Test", "new-value"); |
||||
|
||||
Merge(); |
||||
|
||||
AssertSharpDevelopProjectContainsProperty("Test", "new-value"); |
||||
} |
||||
|
||||
[Test] |
||||
public void Merge_TwoMSBuildProjectsPropertiesUpdated_BothPropertiesUpdatedInSharpDevelopProject() |
||||
{ |
||||
AddPropertyToSharpDevelopProject("Test1", "old-value"); |
||||
AddPropertyToSharpDevelopProject("Test2", "old-value"); |
||||
AddPropertyToMSBuildProject("Test1", "new-value1"); |
||||
AddPropertyToMSBuildProject("Test2", "new-value2"); |
||||
|
||||
Merge(); |
||||
|
||||
AssertSharpDevelopProjectContainsProperty("Test1", "new-value1"); |
||||
AssertSharpDevelopProjectContainsProperty("Test2", "new-value2"); |
||||
} |
||||
|
||||
[Test] |
||||
public void Merge_TwoMSBuildProjectsPropertiesUpdated_MergeResultShowsUpdatedProperty() |
||||
{ |
||||
AddPropertyToSharpDevelopProject("Test1", "old-value"); |
||||
AddPropertyToSharpDevelopProject("Test2", "old-value"); |
||||
AddPropertyToMSBuildProject("Test1", "new-value"); |
||||
AddPropertyToMSBuildProject("Test2", "new-value"); |
||||
|
||||
Merge(); |
||||
|
||||
var expected = new string[] { "Test1", "Test2" }; |
||||
string expectedToString = "Properties added: \r\nProperties updated: Test1,\r\nTest2"; |
||||
CollectionAssert.AreEqual(expected, propertiesMerger.Result.PropertiesUpdated); |
||||
Assert.AreEqual(expectedToString, propertiesMerger.Result.ToString()); |
||||
} |
||||
|
||||
[Test] |
||||
public void Merge_TwoMSBuildProjectsNotChanged_MergeResultShowNoUpdatedProperties() |
||||
{ |
||||
AddPropertyToSharpDevelopProject("Test1", "old-value"); |
||||
AddPropertyToSharpDevelopProject("Test2", "old-value"); |
||||
AddPropertyToMSBuildProject("Test1", "old-value"); |
||||
AddPropertyToMSBuildProject("Test2", "old-value"); |
||||
|
||||
Merge(); |
||||
|
||||
var expected = new string[0]; |
||||
CollectionAssert.AreEqual(expected, propertiesMerger.Result.PropertiesUpdated); |
||||
CollectionAssert.AreEqual(expected, propertiesMerger.Result.PropertiesAdded); |
||||
Assert.IsFalse(propertiesMerger.Result.AnyPropertiesChanged()); |
||||
} |
||||
|
||||
[Test] |
||||
public void SetProperty_UseDifferentCaseForMSBuildPropertyName_WhatHappens() |
||||
{ |
||||
AddPropertyToMSBuildProject("test", "value"); |
||||
|
||||
string propertyValue = msbuildProject.GetPropertyValue("TEST"); |
||||
|
||||
Assert.AreEqual("value", propertyValue); |
||||
} |
||||
|
||||
[Test] |
||||
public void Merge_MSBuildProjectPropertyUpdatedButDifferentCaseUsedForName_SharpDevelopProjectPropertyIsStillUpdated() |
||||
{ |
||||
AddPropertyToSharpDevelopProject("TEST", "old-value"); |
||||
AddPropertyToMSBuildProject("Test", "new-value"); |
||||
|
||||
Merge(); |
||||
|
||||
AssertSharpDevelopProjectContainsProperty("TEST", "new-value"); |
||||
} |
||||
|
||||
[Test] |
||||
public void Merge_MSBuildProjectPropertyUpdatedButDifferentCaseUsedForName_MergeResultShowsPropertyHasBeenUpdated() |
||||
{ |
||||
AddPropertyToSharpDevelopProject("TEST", "old-value"); |
||||
AddPropertyToMSBuildProject("Test", "new-value"); |
||||
|
||||
Merge(); |
||||
|
||||
var expected = new string[] { "Test" }; |
||||
CollectionAssert.AreEqual(expected, propertiesMerger.Result.PropertiesUpdated); |
||||
Assert.AreEqual(0, propertiesMerger.Result.PropertiesAdded.Count()); |
||||
} |
||||
|
||||
/// <summary>
|
||||
/// Ignore any properties that are duplicated in the project file, such as
|
||||
/// OutputPath which exists twice due to Debug and Release configurations.
|
||||
/// </summary>
|
||||
[Test] |
||||
public void Merge_OutputPathPropertyInDebugAndReleaseConfigurations_SharpDevelopProjectPropertiesNotChanged() |
||||
{ |
||||
string debugConfiguration = "'$(Configuration)' == 'Debug'"; |
||||
string releaseConfiguration = "'$(Configuration)' == 'Release'"; |
||||
AddPropertyToSharpDevelopProjectWithCondition("OutputPath", @"bin\Release", releaseConfiguration); |
||||
AddPropertyToSharpDevelopProjectWithCondition("OutputPath", @"bin\Debug", debugConfiguration); |
||||
AddPropertyToMSBuildProjectWithCondition("OutputPath", @"bin\Release", releaseConfiguration); |
||||
AddPropertyToMSBuildProjectWithCondition("OutputPath", @"bin\Debug", debugConfiguration); |
||||
|
||||
Merge(); |
||||
|
||||
Assert.IsFalse(propertiesMerger.Result.AnyPropertiesChanged()); |
||||
} |
||||
} |
||||
} |
||||
Loading…
Reference in new issue