diff options
author | Mikhail Melnikov <mikhail_melnikov@epam.com> | 2017-11-30 19:10:09 +0300 |
---|---|---|
committer | Joel Martinez <joelmartinez@gmail.com> | 2017-11-30 19:58:57 +0300 |
commit | a288b7c120dacf09e30b7318caa0c09153d76765 (patch) | |
tree | 53c43f46c092319dbb03b1e61f43507ddc38060f /mdoc/Test/AttachedEventsAndProperties | |
parent | f8cdfc060fc8df64af4fb7f131ea8c0627d48258 (diff) |
mdoc: Support for attached events and attached properties
Added AttachedEventReference, AttachedEventDefinition, AttachedPropertyReference, AttachedPropertyDefinition (equivalents of Cecil entities)
They are processed as any other Cecil entities
Added check-monodocer-attached-entities integration test
Added DocId support for attached events and attached properties
Closes #63
Diffstat (limited to 'mdoc/Test/AttachedEventsAndProperties')
12 files changed, 266 insertions, 0 deletions
diff --git a/mdoc/Test/AttachedEventsAndProperties/AquariumFilter.cs b/mdoc/Test/AttachedEventsAndProperties/AquariumFilter.cs new file mode 100644 index 00000000..2fbf4dd3 --- /dev/null +++ b/mdoc/Test/AttachedEventsAndProperties/AquariumFilter.cs @@ -0,0 +1,9 @@ +using System.Windows; + +namespace AttachedEventsAndProperties +{ + public class AquariumFilter + { + public static RoutedEvent NeedsCleaningEvent { get; set; } + } +}
\ No newline at end of file diff --git a/mdoc/Test/AttachedEventsAndProperties/AquariumObject.cs b/mdoc/Test/AttachedEventsAndProperties/AquariumObject.cs new file mode 100644 index 00000000..dd20bddd --- /dev/null +++ b/mdoc/Test/AttachedEventsAndProperties/AquariumObject.cs @@ -0,0 +1,6 @@ +namespace AttachedEventsAndProperties +{ + public class AquariumObject + { + } +}
\ No newline at end of file diff --git a/mdoc/Test/AttachedEventsAndProperties/AttachedEventExample.cs b/mdoc/Test/AttachedEventsAndProperties/AttachedEventExample.cs new file mode 100644 index 00000000..b2260c54 --- /dev/null +++ b/mdoc/Test/AttachedEventsAndProperties/AttachedEventExample.cs @@ -0,0 +1,81 @@ +using System.Windows; + +namespace AttachedEventsAndProperties +{ + public class AttachedEventExample + { + #region WPF decompiled example: + + public static readonly RoutedEvent DragOverEvent; + + public static void AddDragOverHandler(DependencyObject element, DragEventHandler handler) + { + } + + public static void RemoveDragOverHandler(DependencyObject element, DragEventHandler handler) + { + } + #endregion + + #region docs.microsoft.com example + public static readonly RoutedEvent NeedsCleaningEvent; + public static void AddNeedsCleaningHandler(DependencyObject d, RoutedEventHandler handler) + { + } + + public static void RemoveNeedsCleaningHandler(DependencyObject d, RoutedEventHandler handler) + { + } + #endregion + + #region Negative example (no RemoveNeedsCleaning2Handler) + public static readonly RoutedEvent NeedsCleaning2Event; + public static void AddNeedsCleaning2Handler(DependencyObject d, RoutedEventHandler handler) + { + } + #endregion + + #region Negative example (no AddNeedsCleaning3Handler) + public static readonly RoutedEvent NeedsCleaning3Event; + public static void RemoveNeedsCleaning3Handler(DependencyObject d, RoutedEventHandler handler) + { + } + #endregion + + #region Negative example (protected methods) + + public static readonly RoutedEvent NeedsCleaning4Event; + + protected static void AddNeedsCleaning4Handler(DependencyObject d, RoutedEventHandler handler) + { + } + + protected static void RemoveNeedsCleaning4Handler(DependencyObject d, RoutedEventHandler handler) + { + } + #endregion + + #region Negative example (non static) + public readonly RoutedEvent NeedsCleaning5Event; + + public void AddNeedsCleaning5Handler(DependencyObject d, RoutedEventHandler handler) + { + } + + public void RemoveNeedsCleaning5Handler(DependencyObject d, RoutedEventHandler handler) + { + } + #endregion + + + #region Negative example (field's name doesn't end with "Event") + public static readonly RoutedEvent NeedsCleaning6Event6; + public static void AddNeedsCleaning6Handler(DependencyObject d, RoutedEventHandler handler) + { + } + public static void RemoveNeedsCleaning6Handler(DependencyObject d, RoutedEventHandler handler) + { + } + #endregion + } +} diff --git a/mdoc/Test/AttachedEventsAndProperties/AttachedEventsAndProperties.csproj b/mdoc/Test/AttachedEventsAndProperties/AttachedEventsAndProperties.csproj new file mode 100644 index 00000000..f6fa226d --- /dev/null +++ b/mdoc/Test/AttachedEventsAndProperties/AttachedEventsAndProperties.csproj @@ -0,0 +1,57 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{304FC0FD-45EF-46ED-A05D-42907B55C123}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>AttachedEventsAndProperties</RootNamespace> + <AssemblyName>AttachedEventsAndProperties</AssemblyName> + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Data" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xml" /> + <Reference Include="WindowsBase" /> + </ItemGroup> + <ItemGroup> + <Compile Include="AquariumFilter.cs" /> + <Compile Include="AquariumObject.cs" /> + <Compile Include="AttachedEventExample.cs" /> + <Compile Include="AttachedPropertyExample.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + <Compile Include="RoutedEvent.cs" /> + <Compile Include="System.Windows\DragEventArgs.cs" /> + <Compile Include="System.Windows\DragEventHandler.cs" /> + <Compile Include="System.Windows\RoutedEventArgs.cs" /> + <Compile Include="System.Windows\RoutedEventHandler.cs" /> + <Compile Include="System.Windows\UIElement.cs" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/mdoc/Test/AttachedEventsAndProperties/AttachedPropertyExample.cs b/mdoc/Test/AttachedEventsAndProperties/AttachedPropertyExample.cs new file mode 100644 index 00000000..9575cf17 --- /dev/null +++ b/mdoc/Test/AttachedEventsAndProperties/AttachedPropertyExample.cs @@ -0,0 +1,44 @@ +using System; +using System.Windows; + +namespace AttachedEventsAndProperties +{ + public static class AttachedPropertyExample + { + #region modified docs.microsoft.com example + + public static readonly DependencyProperty IsBubbleSourceProperty = DependencyProperty.RegisterAttached( + "IsBubbleSource", + typeof(Boolean), + typeof(AquariumObject), + null +); + + public static void SetIsBubbleSource(UIElement element, Boolean value) + { + element.SetValue(IsBubbleSourceProperty, value); + } + + public static Boolean GetIsBubbleSource(UIElement element) + { + return (Boolean)element.GetValue(IsBubbleSourceProperty); + } + #endregion + + #region negative example (no get method) + + public static readonly DependencyProperty IsBubbleSource2Property = DependencyProperty.RegisterAttached( + "IsBubbleSource2", + typeof(Boolean), + typeof(AquariumObject), + null +); + + public static void SetIsBubbleSource2(UIElement element, Boolean value) + { + element.SetValue(IsBubbleSourceProperty, value); + } + #endregion + } + +}
\ No newline at end of file diff --git a/mdoc/Test/AttachedEventsAndProperties/Properties/AssemblyInfo.cs b/mdoc/Test/AttachedEventsAndProperties/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..1ec8d1d4 --- /dev/null +++ b/mdoc/Test/AttachedEventsAndProperties/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("AttachedEventsAndProperties")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("EPAM Systems")] +[assembly: AssemblyProduct("AttachedEventsAndProperties")] +[assembly: AssemblyCopyright("Copyright © EPAM Systems 2017")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("304fc0fd-45ef-46ed-a05d-42907b55c123")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/mdoc/Test/AttachedEventsAndProperties/RoutedEvent.cs b/mdoc/Test/AttachedEventsAndProperties/RoutedEvent.cs new file mode 100644 index 00000000..ec3e906a --- /dev/null +++ b/mdoc/Test/AttachedEventsAndProperties/RoutedEvent.cs @@ -0,0 +1,6 @@ +namespace System.Windows +{ + public class RoutedEvent + { + } +}
\ No newline at end of file diff --git a/mdoc/Test/AttachedEventsAndProperties/System.Windows/DragEventArgs.cs b/mdoc/Test/AttachedEventsAndProperties/System.Windows/DragEventArgs.cs new file mode 100644 index 00000000..0a22ed0c --- /dev/null +++ b/mdoc/Test/AttachedEventsAndProperties/System.Windows/DragEventArgs.cs @@ -0,0 +1,7 @@ +namespace System.Windows +{ + public sealed class DragEventArgs : RoutedEventArgs + { + + } +}
\ No newline at end of file diff --git a/mdoc/Test/AttachedEventsAndProperties/System.Windows/DragEventHandler.cs b/mdoc/Test/AttachedEventsAndProperties/System.Windows/DragEventHandler.cs new file mode 100644 index 00000000..1acf2dac --- /dev/null +++ b/mdoc/Test/AttachedEventsAndProperties/System.Windows/DragEventHandler.cs @@ -0,0 +1,4 @@ +namespace System.Windows +{ + public delegate void DragEventHandler(object sender, DragEventArgs e); +}
\ No newline at end of file diff --git a/mdoc/Test/AttachedEventsAndProperties/System.Windows/RoutedEventArgs.cs b/mdoc/Test/AttachedEventsAndProperties/System.Windows/RoutedEventArgs.cs new file mode 100644 index 00000000..921a5e46 --- /dev/null +++ b/mdoc/Test/AttachedEventsAndProperties/System.Windows/RoutedEventArgs.cs @@ -0,0 +1,6 @@ +namespace System.Windows +{ + public class RoutedEventArgs : EventArgs + { + } +}
\ No newline at end of file diff --git a/mdoc/Test/AttachedEventsAndProperties/System.Windows/RoutedEventHandler.cs b/mdoc/Test/AttachedEventsAndProperties/System.Windows/RoutedEventHandler.cs new file mode 100644 index 00000000..56ac8eff --- /dev/null +++ b/mdoc/Test/AttachedEventsAndProperties/System.Windows/RoutedEventHandler.cs @@ -0,0 +1,4 @@ +namespace System.Windows +{ + public delegate void RoutedEventHandler(object sender, RoutedEventArgs e); +}
\ No newline at end of file diff --git a/mdoc/Test/AttachedEventsAndProperties/System.Windows/UIElement.cs b/mdoc/Test/AttachedEventsAndProperties/System.Windows/UIElement.cs new file mode 100644 index 00000000..3c65a7d3 --- /dev/null +++ b/mdoc/Test/AttachedEventsAndProperties/System.Windows/UIElement.cs @@ -0,0 +1,6 @@ +namespace System.Windows +{ + public class UIElement : DependencyObject + { + } +}
\ No newline at end of file |