Release 2.3.7
|
@ -114,3 +114,4 @@ UpgradeLog*.XML
|
|||
#LocalHistory VS plugin
|
||||
.localhistory/
|
||||
.settings/launch.json
|
||||
/.vs/GraphX for .NET/v15/Server/sqlite3
|
||||
|
|
|
@ -8,5 +8,5 @@ using System.Reflection;
|
|||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: AssemblyVersion("2.3.6.0")]
|
||||
[assembly: AssemblyFileVersion("2.3.6.0")]
|
||||
[assembly: AssemblyVersion("2.3.7.0")]
|
||||
[assembly: AssemblyFileVersion("2.3.7.0")]
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
WIP 2.3.7
|
||||
RELEASE 2.3.7
|
||||
- Added edge drag functionality to be able to reattach edge to another vertex (thanks to LaborJos)
|
||||
- Fixed SimpleTreeLayout vertex sizes supplement (thanks to edgardozoppi)
|
||||
- Fixed and improved parallel edge handling (thanks to perturbare)
|
||||
- Fixed RemoveEdge() method were not removing edges from data graph (thanks to perturbare)
|
||||
- Removed METRO support and example
|
||||
- Added UAP (UWP) support for Windows 10+ platform (VS2017)
|
||||
- Minor bugfixes
|
||||
|
||||
RELEASE 2.3.6
|
||||
DETAILED CHANGELOG:
|
||||
|
|
|
@ -1,230 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" 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>{44841666-C547-4874-9BC9-B34D2A1FA6D8}</ProjectGuid>
|
||||
<OutputType>appcontainerexe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>METRO.SimpleGraph</RootNamespace>
|
||||
<AssemblyName>METRO.SimpleGraph</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<PackageCertificateKeyFile>METRO.SimpleGraph_TemporaryKey.pfx</PackageCertificateKeyFile>
|
||||
<TargetPlatformVersion>8.1</TargetPlatformVersion>
|
||||
<MinimumVisualStudioVersion>12</MinimumVisualStudioVersion>
|
||||
<TargetFrameworkVersion />
|
||||
<PackageCertificateThumbprint>0E531EEE26E7E3F2FBD6A8E1E9F889D31225622F</PackageCertificateThumbprint>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NETFX_CORE, METRO</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<NoWarn>1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn>1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\ARM\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
|
||||
<OutputPath>bin\ARM\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
|
||||
<ProjectReference Include="..\..\GraphX.METRO.Controls\GraphX.METRO.Controls.csproj">
|
||||
<Project>{66f33708-c1c7-4385-8235-7201784d184c}</Project>
|
||||
<Name>GraphX.METRO.Controls</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\GraphX.PCL.Common\GraphX.PCL.Common.csproj">
|
||||
<Project>{3644d44b-dec0-4b65-bba0-c68e34821aae}</Project>
|
||||
<Name>GraphX.PCL.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\GraphX.PCL.Logic\GraphX.PCL.Logic.csproj">
|
||||
<Project>{a30d218b-aaa4-483a-99f7-eaeb1b8b4610}</Project>
|
||||
<Name>GraphX.PCL.Logic</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainPageDebug.xaml.cs">
|
||||
<DependentUpon>MainPageDebug.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\CurvedEr.cs" />
|
||||
<Compile Include="Models\CurvedErParameters.cs" />
|
||||
<Compile Include="Models\DataEdge.cs" />
|
||||
<Compile Include="Models\DataVertex.cs" />
|
||||
<Compile Include="Models\DebugItems.cs" />
|
||||
<Compile Include="Models\GraphAreaExample.cs" />
|
||||
<Compile Include="Models\GraphExample.cs" />
|
||||
<Compile Include="Models\GXLogicCoreExample.cs" />
|
||||
<Compile Include="Models\MouseOverScaleAnimation.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
<None Include="METRO.SimpleGraph_TemporaryKey.pfx" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\Logo.png" />
|
||||
<Content Include="Assets\MidLogo.png" />
|
||||
<Content Include="Assets\play.png" />
|
||||
<Content Include="Assets\refresh.png" />
|
||||
<Content Include="Assets\SmallLogo.png" />
|
||||
<Content Include="Assets\SplashScreen.png" />
|
||||
<Content Include="Assets\StoreLogo.png" />
|
||||
<Content Include="Assets\tr_grren.png" />
|
||||
<Content Include="Assets\tr_red.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="Common\StandardStyles.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Common\templates2.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Page>
|
||||
<Page Include="MainPageDebug.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="MainPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Common\templates.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="QuickGraph, Version=3.6.61114.0, Culture=neutral, PublicKeyToken=f3fb40175eec2af3, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\QuickGraphPCL.3.6.61114.2\lib\portable-win+net4+sl5+wp8+win8+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\QuickGraph.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="QuickGraph.Graphviz, Version=3.6.61114.0, Culture=neutral, PublicKeyToken=f3fb40175eec2af3, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\QuickGraphPCL.3.6.61114.2\lib\portable-win+net4+sl5+wp8+win8+wpa81+MonoAndroid10+MonoTouch10+Xamarin.iOS10\QuickGraph.Graphviz.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '12.0' ">
|
||||
<VisualStudioVersion>12.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>METRO.SimpleGraph_TemporaryKey.pfx</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
Двоичные данные
Examples/METRO.SimpleGraph/METRO.SimpleGraph_TemporaryKey.pfx
|
@ -1,37 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
|
||||
<Identity Name="2c81b400-35e9-4947-b413-ba38af6a935c" Publisher="CN=panthernet" Version="1.1.0.0" />
|
||||
<Properties>
|
||||
<DisplayName>METRO.SimpleGraph</DisplayName>
|
||||
<PublisherDisplayName>panth_000</PublisherDisplayName>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
<Prerequisites>
|
||||
<OSMinVersion>6.3.0</OSMinVersion>
|
||||
<OSMaxVersionTested>6.3.0</OSMaxVersionTested>
|
||||
</Prerequisites>
|
||||
<Resources>
|
||||
<Resource Language="x-generate" />
|
||||
</Resources>
|
||||
<Applications>
|
||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="METRO.SimpleGraph.App">
|
||||
<m2:VisualElements DisplayName="METRO.SimpleGraph" Description="METRO.SimpleGraph" BackgroundColor="#464646" ForegroundText="light" Square150x150Logo="Assets\Logo.png" Square30x30Logo="Assets\SmallLogo.png">
|
||||
<m2:DefaultTile>
|
||||
<m2:ShowNameOnTiles>
|
||||
<m2:ShowOn Tile="square150x150Logo" />
|
||||
</m2:ShowNameOnTiles>
|
||||
</m2:DefaultTile>
|
||||
<m2:InitialRotationPreference>
|
||||
<m2:Rotation Preference="portrait" />
|
||||
<m2:Rotation Preference="landscape" />
|
||||
<m2:Rotation Preference="portraitFlipped" />
|
||||
<m2:Rotation Preference="landscapeFlipped" />
|
||||
</m2:InitialRotationPreference>
|
||||
<m2:SplashScreen Image="Assets\SplashScreen.png" />
|
||||
</m2:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
</Capabilities>
|
||||
</Package>
|
|
@ -1,16 +0,0 @@
|
|||
using System.Reflection;
|
||||
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("METRO.SimpleGraph")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("METRO.SimpleGraph")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
|
@ -1,4 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="QuickGraphPCL" version="3.6.61114.2" targetFramework="win81" />
|
||||
</packages>
|
|
@ -1,5 +1,5 @@
|
|||
<Application
|
||||
x:Class="METRO.SimpleGraph.App"
|
||||
x:Class="UAP.SimpleGraph.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
>
|
|
@ -6,7 +6,7 @@ using Windows.UI.Xaml.Controls;
|
|||
|
||||
// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
|
||||
|
||||
namespace METRO.SimpleGraph
|
||||
namespace UAP.SimpleGraph
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides application-specific behavior to supplement the default Application class.
|
До Ширина: | Высота: | Размер: 338 B После Ширина: | Высота: | Размер: 338 B |
До Ширина: | Высота: | Размер: 475 B После Ширина: | Высота: | Размер: 475 B |
До Ширина: | Высота: | Размер: 918 B После Ширина: | Высота: | Размер: 918 B |
До Ширина: | Высота: | Размер: 174 B После Ширина: | Высота: | Размер: 174 B |
До Ширина: | Высота: | Размер: 189 B После Ширина: | Высота: | Размер: 189 B |
До Ширина: | Высота: | Размер: 167 B После Ширина: | Высота: | Размер: 167 B |
До Ширина: | Высота: | Размер: 48 KiB После Ширина: | Высота: | Размер: 48 KiB |
До Ширина: | Высота: | Размер: 189 B После Ширина: | Высота: | Размер: 189 B |
До Ширина: | Высота: | Размер: 338 B После Ширина: | Высота: | Размер: 338 B |
До Ширина: | Высота: | Размер: 89 KiB После Ширина: | Высота: | Размер: 89 KiB |
До Ширина: | Высота: | Размер: 22 KiB После Ширина: | Высота: | Размер: 22 KiB |
До Ширина: | Высота: | Размер: 93 KiB После Ширина: | Высота: | Размер: 93 KiB |
До Ширина: | Высота: | Размер: 336 KiB После Ширина: | Высота: | Размер: 336 KiB |
До Ширина: | Высота: | Размер: 22 KiB После Ширина: | Высота: | Размер: 22 KiB |
До Ширина: | Высота: | Размер: 27 KiB После Ширина: | Высота: | Размер: 27 KiB |
До Ширина: | Высота: | Размер: 22 KiB После Ширина: | Высота: | Размер: 22 KiB |
До Ширина: | Высота: | Размер: 11 KiB После Ширина: | Высота: | Размер: 11 KiB |
До Ширина: | Высота: | Размер: 59 KiB После Ширина: | Высота: | Размер: 59 KiB |
До Ширина: | Высота: | Размер: 18 KiB После Ширина: | Высота: | Размер: 18 KiB |
До Ширина: | Высота: | Размер: 18 KiB После Ширина: | Высота: | Размер: 18 KiB |
|
@ -1,16 +1,15 @@
|
|||
<Page
|
||||
x:Class="METRO.SimpleGraph.MainPage"
|
||||
x:Class="UAP.SimpleGraph.MainPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:METRO.SimpleGraph"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls1="using:GraphX.Controls"
|
||||
UseLayoutRounding="True"
|
||||
xmlns:graphx="http://schemas.panthernet.ru/graphx/"
|
||||
xmlns:models="using:UAP.SimpleGraph.Models"
|
||||
mc:Ignorable="d" >
|
||||
|
||||
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Grid Background="Black">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
|
@ -18,7 +17,7 @@
|
|||
|
||||
|
||||
<controls1:ZoomControl x:Name="zc" ViewFinderVisibility="Collapsed" Grid.Row="1">
|
||||
<local:GraphAreaExample x:Name="graph" />
|
||||
<models:GraphAreaExample x:Name="graph" />
|
||||
</controls1:ZoomControl>
|
||||
|
||||
<Grid Grid.Row="0" Margin="5">
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
|
@ -12,10 +11,11 @@ using GraphX.Controls.Models;
|
|||
using GraphX.PCL.Common.Enums;
|
||||
using GraphX.PCL.Logic.Algorithms.LayoutAlgorithms;
|
||||
using GraphX.PCL.Logic.Algorithms.OverlapRemoval;
|
||||
using UAP.SimpleGraph.Models;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace METRO.SimpleGraph
|
||||
namespace UAP.SimpleGraph
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
|
@ -1,11 +1,12 @@
|
|||
<Page
|
||||
x:Class="METRO.SimpleGraph.MainPageDebug"
|
||||
x:Class="UAP.SimpleGraph.MainPageDebug"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:METRO.SimpleGraph"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls1="using:GraphX.Controls"
|
||||
xmlns:models="using:UAP.SimpleGraph.Models"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
@ -16,7 +17,7 @@
|
|||
|
||||
|
||||
<controls1:ZoomControl x:Name="zc" ViewFinderVisibility="Collapsed" Grid.Row="1">
|
||||
<local:GraphAreaExample x:Name="graph" />
|
||||
<models:GraphAreaExample x:Name="graph" />
|
||||
</controls1:ZoomControl>
|
||||
|
||||
<Grid Grid.Row="0" Margin="5">
|
|
@ -4,19 +4,17 @@ using System.Diagnostics;
|
|||
using System.Linq;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
using GraphX.Controls;
|
||||
using GraphX.Controls.Animations;
|
||||
using GraphX.Controls.Models;
|
||||
using GraphX.PCL.Common.Enums;
|
||||
using GraphX.PCL.Logic.Algorithms.LayoutAlgorithms;
|
||||
using GraphX.PCL.Logic.Algorithms.OverlapRemoval;
|
||||
using METRO.SimpleGraph.Models;
|
||||
using UAP.SimpleGraph.Models;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace METRO.SimpleGraph
|
||||
namespace UAP.SimpleGraph
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
|
@ -1,13 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using GraphX;
|
||||
using GraphX.Measure;
|
||||
using GraphX.PCL.Common.Interfaces;
|
||||
using GraphX.PCL.Logic.Algorithms.EdgeRouting;
|
||||
using METRO.SimpleGraph;
|
||||
|
||||
namespace InteractiveGraph.Models
|
||||
namespace UAP.SimpleGraph.Models
|
||||
{
|
||||
public class CurvedEr: EdgeRoutingAlgorithmBase<DataVertex, DataEdge, GraphExample>
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
using GraphX.PCL.Logic.Algorithms.EdgeRouting;
|
||||
|
||||
namespace InteractiveGraph.Models
|
||||
namespace UAP.SimpleGraph.Models
|
||||
{
|
||||
public class CurvedErParameters: EdgeRoutingParameters
|
||||
{
|
|
@ -1,8 +1,7 @@
|
|||
using System.ComponentModel;
|
||||
using GraphX;
|
||||
using GraphX.PCL.Common.Models;
|
||||
|
||||
namespace METRO.SimpleGraph
|
||||
namespace UAP.SimpleGraph.Models
|
||||
{
|
||||
/* DataEdge is the data class for the edges. It contains all custom edge data specified by the user.
|
||||
* This class also must be derived from EdgeBase class that provides properties and methods mandatory for
|
|
@ -1,8 +1,7 @@
|
|||
using System.ComponentModel;
|
||||
using GraphX;
|
||||
using GraphX.PCL.Common.Models;
|
||||
|
||||
namespace METRO.SimpleGraph
|
||||
namespace UAP.SimpleGraph.Models
|
||||
{
|
||||
/* DataVertex is the data class for the vertices. It contains all custom vertex data specified by the user.
|
||||
* This class also must be derived from VertexBase that provides properties and methods mandatory for
|
|
@ -1,4 +1,4 @@
|
|||
namespace METRO.SimpleGraph.Models
|
||||
namespace UAP.SimpleGraph.Models
|
||||
{
|
||||
public enum DebugItems
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
using GraphX.PCL.Logic.Models;
|
||||
using QuickGraph;
|
||||
|
||||
namespace METRO.SimpleGraph
|
||||
namespace UAP.SimpleGraph.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Logics core object which contains all algorithms and logic settings
|
|
@ -1,8 +1,7 @@
|
|||
using GraphX;
|
||||
using GraphX.Controls;
|
||||
using QuickGraph;
|
||||
|
||||
namespace METRO.SimpleGraph
|
||||
namespace UAP.SimpleGraph.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// This is custom GraphArea representation using custom data types.
|
|
@ -1,6 +1,6 @@
|
|||
using QuickGraph;
|
||||
|
||||
namespace METRO.SimpleGraph
|
||||
namespace UAP.SimpleGraph.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// This is our custom data graph derived from BidirectionalGraph class using custom data types.
|
|
@ -1,13 +1,12 @@
|
|||
using Windows.Foundation;
|
||||
using System;
|
||||
using Windows.Foundation;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Media.Animation;
|
||||
using GraphX;
|
||||
using System;
|
||||
using GraphX.Controls;
|
||||
using GraphX.Controls.Animations;
|
||||
|
||||
namespace METRO.SimpleGraph
|
||||
namespace UAP.SimpleGraph.Models
|
||||
{
|
||||
public sealed class MouseOverAnimation : IBidirectionalControlAnimation
|
||||
{
|
|
@ -3,7 +3,7 @@
|
|||
<Identity Name="e80be425-9029-4724-abf0-e177effb0522" Publisher="CN=panthernet" Version="1.0.0.0" />
|
||||
<mp:PhoneIdentity PhoneProductId="e80be425-9029-4724-abf0-e177effb0522" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||
<Properties>
|
||||
<DisplayName>UWA.SimpleGraph</DisplayName>
|
||||
<DisplayName>UAP.SimpleGraph</DisplayName>
|
||||
<PublisherDisplayName>panth</PublisherDisplayName>
|
||||
<Logo>Assets/50.png</Logo>
|
||||
</Properties>
|
||||
|
@ -14,8 +14,8 @@
|
|||
<Resource Language="x-generate" />
|
||||
</Resources>
|
||||
<Applications>
|
||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="METRO.SimpleGraph.App">
|
||||
<uap:VisualElements DisplayName="UWA.SimpleGraph" Square150x150Logo="Assets/150.png" Square44x44Logo="Assets/44.png" Description="UWA.SimpleGraph" BackgroundColor="transparent">
|
||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="UAP.SimpleGraph.App">
|
||||
<uap:VisualElements DisplayName="UAP.SimpleGraph" Square150x150Logo="Assets/150.png" Square44x44Logo="Assets/44.png" Description="UAP.SimpleGraph" BackgroundColor="transparent">
|
||||
<uap:InitialRotationPreference>
|
||||
<uap:Rotation Preference="portrait" />
|
||||
<uap:Rotation Preference="landscape" />
|
|
@ -7,11 +7,11 @@
|
|||
<ProjectGuid>{51C7122B-AAD1-4C49-B2E9-1B09B367952F}</ProjectGuid>
|
||||
<OutputType>AppContainerExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>METRO.SimpleGraph</RootNamespace>
|
||||
<AssemblyName>UWA.SimpleGraph</AssemblyName>
|
||||
<RootNamespace>UAP.SimpleGraph</RootNamespace>
|
||||
<AssemblyName>UAP.SimpleGraph</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion>10.0.10586.0</TargetPlatformVersion>
|
||||
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.14393.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.10586.0</TargetPlatformMinVersion>
|
||||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
|
@ -91,47 +91,26 @@
|
|||
<ItemGroup>
|
||||
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
|
||||
<None Include="project.json" />
|
||||
<None Include="UWA.SimpleGraph_TemporaryKey.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\METRO.SimpleGraph\MainPage.xaml.cs">
|
||||
<Link>MainPage.xaml.cs</Link>
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\MainPageDebug.xaml.cs">
|
||||
<Link>MainPageDebug.xaml.cs</Link>
|
||||
<DependentUpon>MainPageDebug.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\CurvedEr.cs">
|
||||
<Link>Models\CurvedEr.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\CurvedErParameters.cs">
|
||||
<Link>Models\CurvedErParameters.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\DataEdge.cs">
|
||||
<Link>Models\DataEdge.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\DataVertex.cs">
|
||||
<Link>Models\DataVertex.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\DebugItems.cs">
|
||||
<Link>Models\DebugItems.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\GraphAreaExample.cs">
|
||||
<Link>Models\GraphAreaExample.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\GraphExample.cs">
|
||||
<Link>Models\GraphExample.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\GXLogicCoreExample.cs">
|
||||
<Link>Models\GXLogicCoreExample.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\METRO.SimpleGraph\Models\MouseOverScaleAnimation.cs">
|
||||
<Link>Models\MouseOverScaleAnimation.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainPageDebug.xaml.cs">
|
||||
<DependentUpon>MainPageDebug.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Models\CurvedEr.cs" />
|
||||
<Compile Include="Models\CurvedErParameters.cs" />
|
||||
<Compile Include="Models\DataEdge.cs" />
|
||||
<Compile Include="Models\DataVertex.cs" />
|
||||
<Compile Include="Models\DebugItems.cs" />
|
||||
<Compile Include="Models\GraphAreaExample.cs" />
|
||||
<Compile Include="Models\GraphExample.cs" />
|
||||
<Compile Include="Models\GXLogicCoreExample.cs" />
|
||||
<Compile Include="Models\MouseOverScaleAnimation.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -140,37 +119,20 @@
|
|||
</AppxManifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\Logo.png">
|
||||
<Link>Assets\Logo.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\MidLogo.png">
|
||||
<Link>Assets\MidLogo.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\play.png">
|
||||
<Link>Assets\play.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\refresh.png">
|
||||
<Link>Assets\refresh.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\SmallLogo.png">
|
||||
<Link>Assets\SmallLogo.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\SplashScreen.png">
|
||||
<Link>Assets\SplashScreen.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\StoreLogo.png">
|
||||
<Link>Assets\StoreLogo.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\tr_grren.png">
|
||||
<Link>Assets\tr_grren.png</Link>
|
||||
</Content>
|
||||
<Content Include="..\METRO.SimpleGraph\Assets\tr_red.png">
|
||||
<Link>Assets\tr_red.png</Link>
|
||||
</Content>
|
||||
<Content Include="Assets\Logo.png" />
|
||||
<Content Include="Assets\Logo.scale-100.png" />
|
||||
<Content Include="Assets\Logo.scale-200.png" />
|
||||
<Content Include="Assets\MidLogo.png" />
|
||||
<Content Include="Assets\newlogo_big.png" />
|
||||
<Content Include="Assets\play.png" />
|
||||
<Content Include="Assets\refresh.png" />
|
||||
<Content Include="Assets\SmallLogo.png" />
|
||||
<Content Include="Assets\SplashScreen.png" />
|
||||
<Content Include="Assets\SplashScreen.scale-100.png" />
|
||||
<Content Include="Assets\SplashScreen.scale-200.png" />
|
||||
<Content Include="Assets\StoreLogo.png" />
|
||||
<Content Include="Assets\tr_grren.png" />
|
||||
<Content Include="Assets\tr_red.png" />
|
||||
<Content Include="Properties\Default.rd.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -178,37 +140,28 @@
|
|||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="..\METRO.SimpleGraph\Common\StandardStyles.xaml">
|
||||
<Link>Common\StandardStyles.xaml</Link>
|
||||
<Page Include="Common\StandardStyles.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="..\METRO.SimpleGraph\Common\templates.xaml">
|
||||
<Link>Common\templates.xaml</Link>
|
||||
<Page Include="Common\templates.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="..\METRO.SimpleGraph\Common\templates2.xaml">
|
||||
<Link>Common\templates2.xaml</Link>
|
||||
<Page Include="Common\templates2.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="..\METRO.SimpleGraph\MainPage.xaml">
|
||||
<Link>MainPage.xaml</Link>
|
||||
<Page Include="MainPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="..\METRO.SimpleGraph\MainPageDebug.xaml">
|
||||
<Link>MainPageDebug.xaml</Link>
|
||||
<Page Include="MainPageDebug.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\GraphX.METRO.Controls\GraphX.METRO.Controls.csproj">
|
||||
<Project>{66f33708-c1c7-4385-8235-7201784d184c}</Project>
|
||||
<Name>GraphX.METRO.Controls</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\GraphX.PCL.Common\GraphX.PCL.Common.csproj">
|
||||
<Project>{3644d44b-dec0-4b65-bba0-c68e34821aae}</Project>
|
||||
<Name>GraphX.PCL.Common</Name>
|
||||
|
@ -217,6 +170,10 @@
|
|||
<Project>{a30d218b-aaa4-483a-99f7-eaeb1b8b4610}</Project>
|
||||
<Name>GraphX.PCL.Logic</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\GraphX.UAP.Controls\GraphX.UAP.Controls.csproj">
|
||||
<Project>{4bebc41e-2710-4613-80b1-198e08d10619}</Project>
|
||||
<Name>GraphX.UAP.Controls</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||
|
@ -226,7 +183,8 @@
|
|||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>UWA.SimpleGraph_TemporaryKey.pfx</AssemblyOriginatorKeyFile>
|
||||
<AssemblyOriginatorKeyFile>
|
||||
</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">D:\Projects\GraphX for.NET\GraphX\Examples\UAP.SimpleGraph\project.lock.json</ProjectAssetsFile>
|
||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
|
||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\panthernet\.nuget\packages\;C:\Program Files (x86)\Microsoft SDKs\NuGetPackagesFallback\</NuGetPackageFolders>
|
||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">ProjectJson</NuGetProjectStyle>
|
||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">4.5.0</NuGetToolVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
</PropertyGroup>
|
||||
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-x86\1.7.0\build\Microsoft.Net.Native.SharedLibrary-x86.props" Condition="Exists('$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-x86\1.7.0\build\Microsoft.Net.Native.SharedLibrary-x86.props')" />
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-x64\1.7.0\build\Microsoft.Net.Native.SharedLibrary-x64.props" Condition="Exists('$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-x64\1.7.0\build\Microsoft.Net.Native.SharedLibrary-x64.props')" />
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-arm\1.7.0\build\Microsoft.Net.Native.SharedLibrary-arm.props" Condition="Exists('$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-arm\1.7.0\build\Microsoft.Net.Native.SharedLibrary-arm.props')" />
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.net.native.compiler\1.7.3\build\Microsoft.Net.Native.Compiler.props" Condition="Exists('$(NuGetPackageRoot)microsoft.net.native.compiler\1.7.3\build\Microsoft.Net.Native.Compiler.props')" />
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
</PropertyGroup>
|
||||
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-x86\1.7.0\build\Microsoft.Net.Native.SharedLibrary-x86.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-x86\1.7.0\build\Microsoft.Net.Native.SharedLibrary-x86.targets')" />
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-x64\1.7.0\build\Microsoft.Net.Native.SharedLibrary-x64.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-x64\1.7.0\build\Microsoft.Net.Native.SharedLibrary-x64.targets')" />
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-arm\1.7.0\build\Microsoft.Net.Native.SharedLibrary-arm.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.net.native.sharedlibrary-arm\1.7.0\build\Microsoft.Net.Native.SharedLibrary-arm.targets')" />
|
||||
<Import Project="$(NuGetPackageRoot)microsoft.net.native.compiler\1.7.3\build\Microsoft.Net.Native.Compiler.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.net.native.compiler\1.7.3\build\Microsoft.Net.Native.Compiler.targets')" />
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.UniversalWindowsPlatform": "5.1.0",
|
||||
"Microsoft.NETCore.UniversalWindowsPlatform": "6.0.6",
|
||||
"QuickGraphPCL": "3.6.61114.2"
|
||||
},
|
||||
"frameworks": {
|
||||
"uap10.0": {}
|
||||
"uap10.0.10586": {}
|
||||
},
|
||||
"runtimes": {
|
||||
"win10-arm": {},
|
|
@ -1,14 +0,0 @@
|
|||
<Application
|
||||
x:Class="METRO.SimpleGraph.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
RequestedTheme="Dark">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
|
||||
<ResourceDictionary Source="Common/templates.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
|
@ -1,96 +0,0 @@
|
|||
using System;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.ApplicationModel.Activation;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
namespace METRO.SimpleGraph
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides application-specific behavior to supplement the default Application class.
|
||||
/// </summary>
|
||||
sealed partial class App : Application
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes the singleton application object. This is the first line of authored code
|
||||
/// executed, and as such is the logical equivalent of main() or WinMain().
|
||||
/// </summary>
|
||||
public App()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
this.Suspending += OnSuspending;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when the application is launched normally by the end user. Other entry points
|
||||
/// will be used such as when the application is launched to open a specific file.
|
||||
/// </summary>
|
||||
/// <param name="e">Details about the launch request and process.</param>
|
||||
protected override void OnLaunched(LaunchActivatedEventArgs e)
|
||||
{
|
||||
#if DEBUG
|
||||
if (System.Diagnostics.Debugger.IsAttached)
|
||||
{
|
||||
this.DebugSettings.EnableFrameRateCounter = true;
|
||||
}
|
||||
#endif
|
||||
Frame rootFrame = Window.Current.Content as Frame;
|
||||
|
||||
// Do not repeat app initialization when the Window already has content,
|
||||
// just ensure that the window is active
|
||||
if (rootFrame == null)
|
||||
{
|
||||
// Create a Frame to act as the navigation context and navigate to the first page
|
||||
rootFrame = new Frame();
|
||||
|
||||
rootFrame.NavigationFailed += OnNavigationFailed;
|
||||
|
||||
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
|
||||
{
|
||||
//TODO: Load state from previously suspended application
|
||||
}
|
||||
|
||||
// Place the frame in the current Window
|
||||
Window.Current.Content = rootFrame;
|
||||
}
|
||||
|
||||
if (e.PrelaunchActivated == false)
|
||||
{
|
||||
if (rootFrame.Content == null)
|
||||
{
|
||||
// When the navigation stack isn't restored navigate to the first page,
|
||||
// configuring the new page by passing required information as a navigation
|
||||
// parameter
|
||||
rootFrame.Navigate(typeof(MainPage), e.Arguments);
|
||||
}
|
||||
// Ensure the current window is active
|
||||
Window.Current.Activate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when Navigation to a certain page fails
|
||||
/// </summary>
|
||||
/// <param name="sender">The Frame which failed navigation</param>
|
||||
/// <param name="e">Details about the navigation failure</param>
|
||||
void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
|
||||
{
|
||||
throw new Exception("Failed to load Page " + e.SourcePageType.FullName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when application execution is being suspended. Application state is saved
|
||||
/// without knowing whether the application will be terminated or resumed with the contents
|
||||
/// of memory still intact.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the suspend request.</param>
|
||||
/// <param name="e">Details about the suspend request.</param>
|
||||
private void OnSuspending(object sender, SuspendingEventArgs e)
|
||||
{
|
||||
var deferral = e.SuspendingOperation.GetDeferral();
|
||||
//TODO: Save application state and stop any background activity
|
||||
deferral.Complete();
|
||||
}
|
||||
}
|
||||
}
|
Двоичные данные
Examples/UWA.SimpleGraph/UWA.SimpleGraph_TemporaryKey.pfx
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2020
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{D9664367-2C2C-46B2-81A6-26CDCD087B29}"
|
||||
EndProject
|
||||
|
@ -40,13 +40,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphX.PCL.Logic", "GraphX.
|
|||
EndProject
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WindowsDesktop_VB.NET_WinForms_Example", "Examples\WindowsDesktop_VB.NET_WinForms_Example\WindowsDesktop_VB.NET_WinForms_Example.vbproj", "{C2718C9A-6455-43F6-835A-26B788824F53}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphX.METRO.Controls", "GraphX.METRO.Controls\GraphX.METRO.Controls.csproj", "{66F33708-C1C7-4385-8235-7201784D184C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "METRO.SimpleGraph", "Examples\METRO.SimpleGraph\METRO.SimpleGraph.csproj", "{44841666-C547-4874-9BC9-B34D2A1FA6D8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShowcaseApp.WPF", "Examples\ShowcaseApp.WPF\ShowcaseApp.WPF.csproj", "{C054C423-7284-46A6-9738-B82E2237E9C7}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UWA.SimpleGraph", "Examples\UWA.SimpleGraph\UWA.SimpleGraph.csproj", "{51C7122B-AAD1-4C49-B2E9-1B09B367952F}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphX.UAP.Controls", "GraphX.UAP.Controls\GraphX.UAP.Controls.csproj", "{4BEBC41E-2710-4613-80B1-198E08D10619}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UAP.SimpleGraph", "Examples\UAP.SimpleGraph\UAP.SimpleGraph.csproj", "{51C7122B-AAD1-4C49-B2E9-1B09B367952F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -125,43 +123,6 @@ Global
|
|||
{C2718C9A-6455-43F6-835A-26B788824F53}.Release|ARM.ActiveCfg = Release|Any CPU
|
||||
{C2718C9A-6455-43F6-835A-26B788824F53}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{C2718C9A-6455-43F6-835A-26B788824F53}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{66F33708-C1C7-4385-8235-7201784D184C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{66F33708-C1C7-4385-8235-7201784D184C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{66F33708-C1C7-4385-8235-7201784D184C}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{66F33708-C1C7-4385-8235-7201784D184C}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{66F33708-C1C7-4385-8235-7201784D184C}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{66F33708-C1C7-4385-8235-7201784D184C}.Debug|x64.Build.0 = Debug|x64
|
||||
{66F33708-C1C7-4385-8235-7201784D184C}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{66F33708-C1C7-4385-8235-7201784D184C}.Debug|x86.Build.0 = Debug|x86
|
||||
{66F33708-C1C7-4385-8235-7201784D184C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{66F33708-C1C7-4385-8235-7201784D184C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{66F33708-C1C7-4385-8235-7201784D184C}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{66F33708-C1C7-4385-8235-7201784D184C}.Release|ARM.Build.0 = Release|ARM
|
||||
{66F33708-C1C7-4385-8235-7201784D184C}.Release|x64.ActiveCfg = Release|x64
|
||||
{66F33708-C1C7-4385-8235-7201784D184C}.Release|x64.Build.0 = Release|x64
|
||||
{66F33708-C1C7-4385-8235-7201784D184C}.Release|x86.ActiveCfg = Release|x86
|
||||
{66F33708-C1C7-4385-8235-7201784D184C}.Release|x86.Build.0 = Release|x86
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Debug|x64.Build.0 = Debug|x64
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Debug|x86.Build.0 = Debug|x86
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Debug|x86.Deploy.0 = Debug|x86
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Release|ARM.Build.0 = Release|ARM
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Release|ARM.Deploy.0 = Release|ARM
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Release|x64.ActiveCfg = Release|x64
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Release|x64.Build.0 = Release|x64
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Release|x64.Deploy.0 = Release|x64
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Release|x86.ActiveCfg = Release|x86
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Release|x86.Build.0 = Release|x86
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8}.Release|x86.Deploy.0 = Release|x86
|
||||
{C054C423-7284-46A6-9738-B82E2237E9C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C054C423-7284-46A6-9738-B82E2237E9C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C054C423-7284-46A6-9738-B82E2237E9C7}.Debug|ARM.ActiveCfg = Debug|Any CPU
|
||||
|
@ -178,8 +139,23 @@ Global
|
|||
{C054C423-7284-46A6-9738-B82E2237E9C7}.Release|x64.Build.0 = Release|Any CPU
|
||||
{C054C423-7284-46A6-9738-B82E2237E9C7}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{C054C423-7284-46A6-9738-B82E2237E9C7}.Release|x86.Build.0 = Release|Any CPU
|
||||
{4BEBC41E-2710-4613-80B1-198E08D10619}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4BEBC41E-2710-4613-80B1-198E08D10619}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4BEBC41E-2710-4613-80B1-198E08D10619}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{4BEBC41E-2710-4613-80B1-198E08D10619}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{4BEBC41E-2710-4613-80B1-198E08D10619}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4BEBC41E-2710-4613-80B1-198E08D10619}.Debug|x64.Build.0 = Debug|x64
|
||||
{4BEBC41E-2710-4613-80B1-198E08D10619}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{4BEBC41E-2710-4613-80B1-198E08D10619}.Debug|x86.Build.0 = Debug|x86
|
||||
{4BEBC41E-2710-4613-80B1-198E08D10619}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4BEBC41E-2710-4613-80B1-198E08D10619}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4BEBC41E-2710-4613-80B1-198E08D10619}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{4BEBC41E-2710-4613-80B1-198E08D10619}.Release|ARM.Build.0 = Release|ARM
|
||||
{4BEBC41E-2710-4613-80B1-198E08D10619}.Release|x64.ActiveCfg = Release|x64
|
||||
{4BEBC41E-2710-4613-80B1-198E08D10619}.Release|x64.Build.0 = Release|x64
|
||||
{4BEBC41E-2710-4613-80B1-198E08D10619}.Release|x86.ActiveCfg = Release|x86
|
||||
{4BEBC41E-2710-4613-80B1-198E08D10619}.Release|x86.Build.0 = Release|x86
|
||||
{51C7122B-AAD1-4C49-B2E9-1B09B367952F}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{51C7122B-AAD1-4C49-B2E9-1B09B367952F}.Debug|Any CPU.Deploy.0 = Debug|x86
|
||||
{51C7122B-AAD1-4C49-B2E9-1B09B367952F}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{51C7122B-AAD1-4C49-B2E9-1B09B367952F}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{51C7122B-AAD1-4C49-B2E9-1B09B367952F}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
|
@ -208,11 +184,11 @@ Global
|
|||
{E00C5274-AA34-4CC1-BB24-F59BCF130B85} = {D9664367-2C2C-46B2-81A6-26CDCD087B29}
|
||||
{E8B92A96-39FD-441D-9925-34A6F6DC8BEE} = {D9664367-2C2C-46B2-81A6-26CDCD087B29}
|
||||
{C2718C9A-6455-43F6-835A-26B788824F53} = {D9664367-2C2C-46B2-81A6-26CDCD087B29}
|
||||
{44841666-C547-4874-9BC9-B34D2A1FA6D8} = {D9664367-2C2C-46B2-81A6-26CDCD087B29}
|
||||
{C054C423-7284-46A6-9738-B82E2237E9C7} = {D9664367-2C2C-46B2-81A6-26CDCD087B29}
|
||||
{51C7122B-AAD1-4C49-B2E9-1B09B367952F} = {D9664367-2C2C-46B2-81A6-26CDCD087B29}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {9548CBF3-9C1D-4132-B928-475E2AA6A99B}
|
||||
VisualSVNWorkingCopyRoot = .
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -390,7 +390,7 @@ namespace GraphX.Controls
|
|||
}
|
||||
|
||||
#endregion PropertyChanged callbacks
|
||||
|
||||
#if WPF
|
||||
private static void OnEdgeDrageStarted(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
{
|
||||
DependencyObject obj = sender as DependencyObject;
|
||||
|
@ -469,7 +469,7 @@ namespace GraphX.Controls
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#if WPF
|
||||
|
||||
private static void OnVertexDragStarted(object sender, System.Windows.Input.MouseButtonEventArgs e)
|
||||
|
|
|
@ -708,15 +708,23 @@ namespace GraphX.Controls
|
|||
//get the size of the target
|
||||
var targetSize = new Size
|
||||
{
|
||||
#if WPF
|
||||
Width = SystemParameters.CursorWidth,
|
||||
Height = SystemParameters.CursorHeight
|
||||
#else
|
||||
#endif
|
||||
};
|
||||
|
||||
//get the position center of the target
|
||||
var targetPos = new Point
|
||||
{
|
||||
#if WPF
|
||||
X = Mouse.GetPosition(this.RootArea).X,/* + targetSize.Width * 0.5,*/
|
||||
Y = Mouse.GetPosition(this.RootArea).Y/* + targetSize.Height * 0.5*/
|
||||
#else
|
||||
X=0,
|
||||
Y=0
|
||||
#endif
|
||||
};
|
||||
|
||||
var routedEdge = this.Edge as IRoutingInfo;
|
||||
|
@ -736,8 +744,11 @@ namespace GraphX.Controls
|
|||
// Get the TopLeft position of the Target Vertex.
|
||||
var targetPos1 = new Point
|
||||
{
|
||||
#if WPF
|
||||
X = Mouse.GetPosition(this.RootArea).X,
|
||||
Y = Mouse.GetPosition(this.RootArea).Y
|
||||
#else
|
||||
#endif
|
||||
};
|
||||
|
||||
var hasEpSource = EdgePointerForSource != null;
|
||||
|
@ -1009,7 +1020,8 @@ namespace GraphX.Controls
|
|||
// to route information or simply the center of the target vertex.
|
||||
if (needParallelCalc())
|
||||
{
|
||||
targetCenter = sourceCpCenter + (targetCenter - sourceCenter);
|
||||
var m = new Point(targetCenter.X - sourceCenter.X, targetCenter.Y - sourceCenter.Y);
|
||||
targetCenter = new Point(sourceCpCenter.X + m.X, sourceCpCenter.Y + m.Y);
|
||||
}
|
||||
else if (hasRouteInfo)
|
||||
{
|
||||
|
@ -1028,7 +1040,8 @@ namespace GraphX.Controls
|
|||
// to route information or simply the center of the source vertex.
|
||||
if (needParallelCalc())
|
||||
{
|
||||
sourceCenter = targetCpCenter + (sourceCenter - targetCenter);
|
||||
var m = new Point(sourceCenter.X - targetCenter.X, sourceCenter.Y - targetCenter.Y);
|
||||
sourceCenter = new Point(targetCpCenter.X + m.X, targetCpCenter.Y + m.Y);
|
||||
}
|
||||
else if (hasRouteInfo)
|
||||
{
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
#if WPF
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using DefaultEventArgs = System.EventArgs;
|
||||
#elif METRO
|
||||
using System;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
@ -32,9 +34,13 @@ namespace GraphX.Controls
|
|||
/// </summary>
|
||||
static DefaultEdgePointer()
|
||||
{
|
||||
#if WPF
|
||||
var oldPmd = VisibilityProperty.GetMetadata(typeof(DefaultEdgePointer).BaseType);
|
||||
var newPmd = new PropertyMetadata(oldPmd.DefaultValue, oldPmd.PropertyChangedCallback, CoerceVisibility);
|
||||
VisibilityProperty.OverrideMetadata(typeof(DefaultEdgePointer), newPmd);
|
||||
#else
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#region Common part
|
||||
|
@ -101,10 +107,17 @@ namespace GraphX.Controls
|
|||
IsSuppressed = false;
|
||||
}
|
||||
|
||||
#if WPF
|
||||
private static readonly DependencyPropertyKey IsSuppressedPropertyKey =
|
||||
DependencyProperty.RegisterReadOnly("IsSuppressed", typeof(bool), typeof(DefaultEdgePointer), new PropertyMetadata(false, OnSuppressChanged));
|
||||
|
||||
public static readonly DependencyProperty IsSuppressedProperty = IsSuppressedPropertyKey.DependencyProperty;
|
||||
#else
|
||||
private static readonly DependencyProperty IsSuppressedPropertyKey =
|
||||
DependencyProperty.Register("IsSuppressed", typeof(bool), typeof(DefaultEdgePointer), new PropertyMetadata(false, OnSuppressChanged));
|
||||
|
||||
public static readonly DependencyProperty IsSuppressedProperty = IsSuppressedPropertyKey;
|
||||
#endif
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the pointer is suppressed. A suppressed pointer won't be displayed, but
|
||||
|
@ -121,8 +134,10 @@ namespace GraphX.Controls
|
|||
/// </summary>
|
||||
private static void OnSuppressChanged(object source, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
#if WPF
|
||||
var dep = source as DefaultEdgePointer;
|
||||
dep?.CoerceValue(VisibilityProperty);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -177,8 +192,16 @@ namespace GraphX.Controls
|
|||
Arrange(LastKnownRectSize);
|
||||
}
|
||||
|
||||
if(NeedRotation)
|
||||
RenderTransform = new RotateTransform { Angle = angle, CenterX = 0, CenterY = 0 };
|
||||
try
|
||||
{
|
||||
if (NeedRotation)
|
||||
RenderTransform = new RotateTransform {Angle = double.IsNaN(angle) ? 0 : angle, CenterX = 0, CenterY = 0};
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//TODO ex handling and reason
|
||||
}
|
||||
|
||||
return new Point(direction.X * ActualWidth, direction.Y * ActualHeight);
|
||||
}
|
||||
|
||||
|
|
|
@ -1026,7 +1026,7 @@ namespace GraphX.Controls
|
|||
}
|
||||
|
||||
#elif METRO
|
||||
public Task RelayoutGraphAsync(bool generateAllEdges = false)
|
||||
public override Task RelayoutGraphAsync(bool generateAllEdges = false)
|
||||
{
|
||||
return RelayoutGraphAsync(CancellationToken.None, generateAllEdges);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
#if WPF
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
@ -512,7 +513,12 @@ namespace GraphX
|
|||
|
||||
public abstract VertexControl GetVertexControlAt(Point position);
|
||||
|
||||
#if WPF
|
||||
public abstract void RelayoutGraph(bool generateAllEdges = false);
|
||||
#else
|
||||
public abstract Task RelayoutGraphAsync(bool generateAllEdges = false);
|
||||
|
||||
#endif
|
||||
|
||||
// INTERNAL VARIABLES FOR CONTROLS INTEROPERABILITY
|
||||
internal abstract bool IsEdgeRoutingEnabled { get; }
|
||||
|
|
|
@ -10,6 +10,7 @@ using Point = System.Windows.Point;
|
|||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.Foundation;
|
||||
using USize = Windows.Foundation.Size;
|
||||
#endif
|
||||
using GraphX.Controls.Models;
|
||||
using GraphX.PCL.Common;
|
||||
|
|
|
@ -1,108 +1,109 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" 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>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{66F33708-C1C7-4385-8235-7201784D184C}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>GraphX.Controls</RootNamespace>
|
||||
<AssemblyName>GraphX.Controls</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.14393.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.10586.0</TargetPlatformMinVersion>
|
||||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>
|
||||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
|
||||
<RestorePackages>true</RestorePackages>
|
||||
<TargetPlatformIdentifier>Windows</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion>8.1</TargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NETFX_CORE, METRO;NETFX_CORE;WINDOWS_APP</DefineConstants>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<GenerateLibraryLayout>false</GenerateLibraryLayout>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE, METRO;NETFX_CORE;WINDOWS_APP</DefineConstants>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\ARM\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
|
||||
<OutputPath>bin\ARM\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_APP</DefineConstants>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\ARM\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<OutputPath>bin\ARM\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
|
||||
|
@ -352,8 +353,8 @@
|
|||
<Private>True</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '12.0' ">
|
||||
<VisualStudioVersion>12.0</VisualStudioVersion>
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
using System;
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
namespace GraphX.Controls
|
||||
{
|
||||
public sealed class DoubleToLog10Converter : IValueConverter
|
||||
{
|
||||
#region IValueConverter Members
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
var val = Math.Log10((double)value);
|
||||
return double.IsNegativeInfinity(val) ? 0 : val;
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
var val = Math.Pow(10, (double)value);
|
||||
return double.IsNegativeInfinity(val) ? 0 : val;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
namespace GraphX.Controls
|
||||
{
|
||||
public sealed class EqualityToBooleanConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
return Equals(value, parameter);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if ((bool)value)
|
||||
return parameter;
|
||||
|
||||
//it's false, so don't bind it back
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/*************************************************************************************
|
||||
|
||||
Extended WPF Toolkit
|
||||
|
||||
Copyright (C) 2007-2013 Xceed Software Inc.
|
||||
|
||||
This program is provided to you under the terms of the Microsoft Public
|
||||
License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
||||
For more features, controls, and fast professional support,
|
||||
pick up the Plus Edition at http://xceed.com/wpf_toolkit
|
||||
|
||||
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
using System;
|
||||
using Windows.Foundation;
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
namespace GraphX.Controls
|
||||
{
|
||||
public class RoundedValueConverter : IValueConverter
|
||||
{
|
||||
#region Precision Property
|
||||
|
||||
public int Precision
|
||||
{
|
||||
get
|
||||
{
|
||||
return _precision;
|
||||
}
|
||||
set
|
||||
{
|
||||
_precision = value;
|
||||
}
|
||||
}
|
||||
|
||||
private int _precision = 0;
|
||||
|
||||
#endregion
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
if( value is double )
|
||||
{
|
||||
return Math.Round( ( double )value, _precision );
|
||||
}
|
||||
else if( value is Point )
|
||||
{
|
||||
return new Point( Math.Round( ( ( Point )value ).X, _precision ), Math.Round( ( ( Point )value ).Y, _precision ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*************************************************************************************
|
||||
|
||||
Extended WPF Toolkit
|
||||
|
||||
Copyright (C) 2007-2013 Xceed Software Inc.
|
||||
|
||||
This program is provided to you under the terms of the Microsoft Public
|
||||
License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
||||
For more features, controls, and fast professional support,
|
||||
pick up the Plus Edition at http://xceed.com/wpf_toolkit
|
||||
|
||||
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
using System;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
namespace GraphX.Controls
|
||||
{
|
||||
[Bindable]
|
||||
public sealed class VisibilityToBoolConverter : IValueConverter
|
||||
{
|
||||
public bool Inverted { get; set; }
|
||||
public bool Not { get; set; }
|
||||
|
||||
public object Convert(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
return this.Inverted ? this.BoolToVisibility( value ) : this.VisibilityToBool( value );
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language)
|
||||
{
|
||||
return this.Inverted ? this.VisibilityToBool( value ) : this.BoolToVisibility( value );
|
||||
}
|
||||
|
||||
private object VisibilityToBool( object value )
|
||||
{
|
||||
if( !( value is Visibility ) )
|
||||
throw new InvalidOperationException( "SuppliedValueWasNotVisibility" );
|
||||
|
||||
return ( ( ( Visibility )value ) == Visibility.Visible ) ^ Not;
|
||||
}
|
||||
|
||||
private object BoolToVisibility( object value )
|
||||
{
|
||||
if( !( value is bool ) )
|
||||
throw new InvalidOperationException( "SuppliedValueWasNotBool" );
|
||||
|
||||
return ( ( bool )value ^ Not ) ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/*************************************************************************************
|
||||
|
||||
Extended WPF Toolkit
|
||||
|
||||
Copyright (C) 2007-2013 Xceed Software Inc.
|
||||
|
||||
This program is provided to you under the terms of the Microsoft Public
|
||||
License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
||||
For more features, controls, and fast professional support,
|
||||
pick up the Plus Edition at http://xceed.com/wpf_toolkit
|
||||
|
||||
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using GraphX.Measure;
|
||||
using Point = Windows.Foundation.Point;
|
||||
using Rect = Windows.Foundation.Rect;
|
||||
using Size = Windows.Foundation.Size;
|
||||
|
||||
namespace GraphX.Controls
|
||||
{
|
||||
internal static class DoubleHelper
|
||||
{
|
||||
public static bool AreVirtuallyEqual( double d1, double d2 )
|
||||
{
|
||||
if( double.IsPositiveInfinity( d1 ) )
|
||||
return double.IsPositiveInfinity( d2 );
|
||||
|
||||
if( double.IsNegativeInfinity( d1 ) )
|
||||
return double.IsNegativeInfinity( d2 );
|
||||
|
||||
if( IsNaN( d1 ) )
|
||||
return IsNaN( d2 );
|
||||
|
||||
var n = d1 - d2;
|
||||
var d = ( Math.Abs( d1 ) + Math.Abs( d2 ) + 10 ) * 1.0e-15;
|
||||
return ( -d < n ) && ( d > n );
|
||||
}
|
||||
|
||||
public static bool AreVirtuallyEqual( Size s1, Size s2 )
|
||||
{
|
||||
return ( AreVirtuallyEqual( s1.Width, s2.Width )
|
||||
&& AreVirtuallyEqual( s1.Height, s2.Height ) );
|
||||
}
|
||||
|
||||
public static bool AreVirtuallyEqual( Point p1, Point p2 )
|
||||
{
|
||||
return ( AreVirtuallyEqual( p1.X, p2.X )
|
||||
&& AreVirtuallyEqual( p1.Y, p2.Y ) );
|
||||
}
|
||||
|
||||
public static bool AreVirtuallyEqual( Rect r1, Rect r2 )
|
||||
{
|
||||
return ( AreVirtuallyEqual( r1.TopLeft(), r2.TopLeft() )
|
||||
&& AreVirtuallyEqual( r1.BottomRight(), r2.BottomRight() ) );
|
||||
}
|
||||
|
||||
public static bool AreVirtuallyEqual( Vector v1, Vector v2 )
|
||||
{
|
||||
return ( AreVirtuallyEqual( v1.X, v2.X )
|
||||
&& AreVirtuallyEqual( v1.Y, v2.Y ) );
|
||||
}
|
||||
|
||||
|
||||
public static bool IsNaN( double value )
|
||||
{
|
||||
// used reflector to borrow the high performance IsNan function
|
||||
// from the WPF MS.Internal namespace
|
||||
var t = new NanUnion {DoubleValue = value};
|
||||
|
||||
var exp = t.UintValue & 0xfff0000000000000;
|
||||
var man = t.UintValue & 0x000fffffffffffff;
|
||||
|
||||
return ( exp == 0x7ff0000000000000 || exp == 0xfff0000000000000 ) && ( man != 0 );
|
||||
}
|
||||
|
||||
#region NanUnion Nested Types
|
||||
|
||||
[StructLayout( LayoutKind.Explicit )]
|
||||
private struct NanUnion
|
||||
{
|
||||
[FieldOffset( 0 )]
|
||||
internal double DoubleValue;
|
||||
[FieldOffset( 0 )]
|
||||
internal UInt64 UintValue;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/*************************************************************************************
|
||||
|
||||
Extended WPF Toolkit
|
||||
|
||||
Copyright (C) 2007-2013 Xceed Software Inc.
|
||||
|
||||
This program is provided to you under the terms of the Microsoft Public
|
||||
License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
||||
For more features, controls, and fast professional support,
|
||||
pick up the Plus Edition at http://xceed.com/wpf_toolkit
|
||||
|
||||
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
using System;
|
||||
using Windows.Foundation;
|
||||
|
||||
namespace GraphX.Controls
|
||||
{
|
||||
internal static class PointHelper
|
||||
{
|
||||
public static double DistanceBetween( Point p1, Point p2 )
|
||||
{
|
||||
return Math.Sqrt( Math.Pow( p1.X - p2.X, 2 ) + Math.Pow( p1.Y - p2.Y, 2 ) );
|
||||
}
|
||||
|
||||
public static Point Empty
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Point( double.NaN, double.NaN );
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsEmpty( Point point )
|
||||
{
|
||||
return DoubleHelper.IsNaN( point.X ) && DoubleHelper.IsNaN( point.Y );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,157 @@
|
|||
/*************************************************************************************
|
||||
|
||||
Extended WPF Toolkit
|
||||
|
||||
Copyright (C) 2007-2013 Xceed Software Inc.
|
||||
|
||||
This program is provided to you under the terms of the Microsoft Public
|
||||
License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license
|
||||
|
||||
For more features, controls, and fast professional support,
|
||||
pick up the Plus Edition at http://xceed.com/wpf_toolkit
|
||||
|
||||
Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids
|
||||
|
||||
***********************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
namespace GraphX.Controls
|
||||
{
|
||||
public static class VisualTreeHelperEx
|
||||
{
|
||||
public static DependencyObject FindAncestorByType(DependencyObject element, Type type, bool specificTypeOnly)
|
||||
{
|
||||
if (element == null)
|
||||
return null;
|
||||
|
||||
if (element.GetType() == type)
|
||||
return element;
|
||||
|
||||
return FindAncestorByType(VisualTreeHelper.GetParent(element), type, specificTypeOnly);
|
||||
}
|
||||
|
||||
public static T FindAncestorByType<T>(DependencyObject depObj) where T : DependencyObject
|
||||
{
|
||||
if (depObj == null)
|
||||
{
|
||||
return default(T);
|
||||
}
|
||||
if (depObj is T)
|
||||
{
|
||||
return (T) depObj;
|
||||
}
|
||||
|
||||
T parent = default(T);
|
||||
|
||||
parent = FindAncestorByType<T>(VisualTreeHelper.GetParent(depObj));
|
||||
|
||||
return parent;
|
||||
}
|
||||
|
||||
public static UIElement FindDescendantByName(UIElement element, string name)
|
||||
{
|
||||
if (element != null && (element is FrameworkElement) && (element as FrameworkElement).Name == name)
|
||||
return element;
|
||||
|
||||
UIElement foundElement = null;
|
||||
if (element is FrameworkElement)
|
||||
(element as FrameworkElement).InvalidateArrange();
|
||||
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(element); i++)
|
||||
{
|
||||
var visual = VisualTreeHelper.GetChild(element, i) as UIElement;
|
||||
foundElement = FindDescendantByName(visual, name);
|
||||
if (foundElement != null)
|
||||
break;
|
||||
}
|
||||
|
||||
return foundElement;
|
||||
}
|
||||
|
||||
public static UIElement FindDescendantByType(UIElement element, Type type)
|
||||
{
|
||||
return FindDescendantByType(element, type, true);
|
||||
}
|
||||
|
||||
public static UIElement FindDescendantByType(UIElement element, Type type, bool specificTypeOnly)
|
||||
{
|
||||
if (element == null)
|
||||
return null;
|
||||
|
||||
if (element.GetType() == type)
|
||||
return element;
|
||||
|
||||
UIElement foundElement = null;
|
||||
if (element is FrameworkElement)
|
||||
(element as FrameworkElement).InvalidateArrange();
|
||||
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(element); i++)
|
||||
{
|
||||
var visual = VisualTreeHelper.GetChild(element, i) as UIElement;
|
||||
foundElement = FindDescendantByType(visual, type, specificTypeOnly);
|
||||
if (foundElement != null)
|
||||
break;
|
||||
}
|
||||
|
||||
return foundElement;
|
||||
}
|
||||
|
||||
public static T FindDescendantByType<T>(UIElement element) where T : UIElement
|
||||
{
|
||||
UIElement temp = FindDescendantByType(element, typeof (T));
|
||||
|
||||
return (T) temp;
|
||||
}
|
||||
|
||||
public static UIElement FindDescendantWithPropertyValue(UIElement element,
|
||||
DependencyProperty dp, object value)
|
||||
{
|
||||
if (element == null)
|
||||
return null;
|
||||
|
||||
if (element.GetValue(dp).Equals(value))
|
||||
return element;
|
||||
|
||||
UIElement foundElement = null;
|
||||
if (element is FrameworkElement)
|
||||
(element as FrameworkElement).InvalidateArrange();
|
||||
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(element); i++)
|
||||
{
|
||||
var visual = VisualTreeHelper.GetChild(element, i) as UIElement;
|
||||
foundElement = FindDescendantWithPropertyValue(visual, dp, value);
|
||||
if (foundElement != null)
|
||||
break;
|
||||
}
|
||||
|
||||
return foundElement;
|
||||
}
|
||||
|
||||
#region Find descendants of type
|
||||
|
||||
public static IEnumerable<T> FindDescendantsOfType<T>(this UIElement element) where T : class
|
||||
{
|
||||
if (element == null) yield break;
|
||||
if (element is T)
|
||||
yield return element as T;
|
||||
|
||||
var frameworkElement = element as FrameworkElement;
|
||||
if (frameworkElement != null)
|
||||
frameworkElement.InvalidateArrange();
|
||||
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(element); i++)
|
||||
{
|
||||
var visual = VisualTreeHelper.GetChild(element, i) as UIElement;
|
||||
if (visual == null) continue;
|
||||
foreach (var item in visual.FindDescendantsOfType<T>())
|
||||
yield return item;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using Windows.Foundation;
|
||||
|
||||
namespace GraphX.Controls
|
||||
{
|
||||
public class AreaSelectedEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Rectangle data in coordinates of content object
|
||||
/// </summary>
|
||||
public Rect Rectangle { get; set; }
|
||||
|
||||
public AreaSelectedEventArgs(Rect rec)
|
||||
: base()
|
||||
{
|
||||
Rectangle = rec;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
namespace GraphX.Controls
|
||||
{
|
||||
public delegate void AreaSelectedEventHandler(object sender, AreaSelectedEventArgs args);
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
using Windows.Foundation;
|
||||
|
||||
namespace GraphX.Controls
|
||||
{
|
||||
public delegate void ContentSizeChangedHandler(object sender, Size newSize);
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
namespace GraphX.Controls
|
||||
{
|
||||
public enum MouseWheelZoomingMode
|
||||
{
|
||||
Positional = 0,
|
||||
Absolute
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
namespace GraphX.Controls
|
||||
{
|
||||
public enum ZoomControlModes
|
||||
{
|
||||
/// <summary>
|
||||
/// The content should fill the given space.
|
||||
/// </summary>
|
||||
Fill,
|
||||
|
||||
/// <summary>
|
||||
/// The content will be represented in its original size.
|
||||
/// </summary>
|
||||
Original,
|
||||
|
||||
/// <summary>
|
||||
/// The content will be zoomed with a custom percent.
|
||||
/// </summary>
|
||||
Custom
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
namespace GraphX.Controls
|
||||
{
|
||||
public enum ZoomViewModifierMode
|
||||
{
|
||||
/// <summary>
|
||||
/// It does nothing at all.
|
||||
/// </summary>
|
||||
None,
|
||||
|
||||
/// <summary>
|
||||
/// You can pan the view with the mouse in this mode.
|
||||
/// </summary>
|
||||
Pan,
|
||||
|
||||
/// <summary>
|
||||
/// You can zoom in with the mouse in this mode.
|
||||
/// </summary>
|
||||
ZoomIn,
|
||||
|
||||
/// <summary>
|
||||
/// You can zoom out with the mouse in this mode.
|
||||
/// </summary>
|
||||
ZoomOut,
|
||||
|
||||
/// <summary>
|
||||
/// Zooming after the user has been selected the zooming box.
|
||||
/// </summary>
|
||||
ZoomBox
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
using System.ComponentModel;
|
||||
using Windows.Foundation;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
namespace GraphX.Controls
|
||||
{
|
||||
[Bindable]
|
||||
public sealed class ZCP : ContentPresenter, INotifyPropertyChanged
|
||||
{
|
||||
public event ContentSizeChangedHandler ContentSizeChanged;
|
||||
|
||||
private Size _contentSize;
|
||||
|
||||
/* public Point ContentTopLeft { get; private set; }
|
||||
public Point ContentBottomRight { get; private set; }
|
||||
public Point ContentActualSize { get; private set; }
|
||||
*/
|
||||
public Size ContentSize
|
||||
{
|
||||
get { return _contentSize; }
|
||||
private set {
|
||||
if (value == _contentSize)
|
||||
return;
|
||||
|
||||
_contentSize = value;
|
||||
if (ContentSizeChanged != null)
|
||||
ContentSizeChanged(this, _contentSize);
|
||||
}
|
||||
}
|
||||
|
||||
protected override Size MeasureOverride(Size constraint)
|
||||
{
|
||||
base.MeasureOverride(new Size(double.PositiveInfinity, double.PositiveInfinity));
|
||||
var max = 1000000000;
|
||||
var x = double.IsInfinity(constraint.Width) ? max : constraint.Width;
|
||||
var y = double.IsInfinity(constraint.Height) ? max : constraint.Height;
|
||||
return new Size(x, y);
|
||||
}
|
||||
|
||||
protected override Size ArrangeOverride(Size arrangeBounds)
|
||||
{
|
||||
UIElement child = Content != null
|
||||
? VisualTreeHelper.GetChild(this, 0) as UIElement
|
||||
: null;
|
||||
if (child == null)
|
||||
return arrangeBounds;
|
||||
|
||||
//set the ContentSize
|
||||
ContentSize = child.DesiredSize;
|
||||
child.Arrange(new Rect(new Point(),child.DesiredSize));
|
||||
/* if (child is GraphAreaBase)
|
||||
{
|
||||
ContentBottomRight = (child as GraphAreaBase).BottomRight;
|
||||
ContentTopLeft = (child as GraphAreaBase).TopLeft;
|
||||
ContentActualSize = new Point((child as GraphAreaBase).ActualWidth, (child as GraphAreaBase).ActualHeight);
|
||||
}*/
|
||||
|
||||
return arrangeBounds;
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string name)
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(name));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,911 @@
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.System;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Media.Animation;
|
||||
using GraphX.Measure;
|
||||
using GraphX.Controls.Models;
|
||||
using Point = Windows.Foundation.Point;
|
||||
using Rect = Windows.Foundation.Rect;
|
||||
using Thickness = Windows.UI.Xaml.Thickness;
|
||||
|
||||
namespace GraphX.Controls
|
||||
{
|
||||
[TemplatePart(Name = PART_PRESENTER, Type = typeof(ZCP))]
|
||||
public class ZoomControl : ContentControl, IZoomControl, INotifyPropertyChanged
|
||||
{
|
||||
|
||||
#region Properties
|
||||
|
||||
#region ViewFinderVisibility Attached Property
|
||||
|
||||
public static readonly DependencyProperty ViewFinderVisibilityProperty =
|
||||
DependencyProperty.RegisterAttached("ViewFinderVisibility", typeof(Visibility), typeof(ZoomControl),
|
||||
new PropertyMetadata(Visibility.Visible));
|
||||
|
||||
public static Visibility GetViewFinderVisibility(DependencyObject d)
|
||||
{
|
||||
return (Visibility)(d.GetValue(ViewFinderVisibilityProperty));
|
||||
}
|
||||
|
||||
public static void SetViewFinderVisibility(DependencyObject d, Visibility value)
|
||||
{
|
||||
d.SetValue(ViewFinderVisibilityProperty, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public DelegateCommand<object> ZoomToFillCommand { get { return new DelegateCommand<object>((o) => ZoomToFill());} }
|
||||
|
||||
public DelegateCommand<object> CenterToContentCommand { get { return new DelegateCommand<object>((o) => CenterContent());} }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets if animation should be disabled
|
||||
/// </summary>
|
||||
public bool IsAnimationDisabled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Use Ctrl key to zoom with mouse wheel or without it
|
||||
/// </summary>
|
||||
public bool UseCtrlForMouseWheel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets absolute zooming on mouse wheel which doesn't depend on mouse position
|
||||
/// </summary>
|
||||
public MouseWheelZoomingMode MouseWheelZoomingMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Fires when area has been selected using SelectionModifiers
|
||||
/// </summary>
|
||||
public event AreaSelectedEventHandler AreaSelected;
|
||||
|
||||
private void OnAreaSelected(Rect selection)
|
||||
{
|
||||
if (AreaSelected != null)
|
||||
AreaSelected(this, new AreaSelectedEventArgs(selection));
|
||||
}
|
||||
|
||||
private const string PART_PRESENTER = "PART_Presenter";
|
||||
|
||||
public static readonly DependencyProperty HideZoomProperty =
|
||||
DependencyProperty.Register("HideZoom", typeof(Visibility), typeof(ZoomControl),
|
||||
new PropertyMetadata(Visibility.Visible));
|
||||
|
||||
public static readonly DependencyProperty AnimationLengthProperty =
|
||||
DependencyProperty.Register("AnimationLength", typeof(TimeSpan), typeof(ZoomControl),
|
||||
new PropertyMetadata(TimeSpan.FromMilliseconds(500)));
|
||||
|
||||
public static readonly DependencyProperty MaximumZoomStepProperty =
|
||||
DependencyProperty.Register("MaximumZoomStep", typeof(double), typeof(ZoomControl),
|
||||
new PropertyMetadata(5.0));
|
||||
|
||||
public static readonly DependencyProperty MaxZoomProperty =
|
||||
DependencyProperty.Register("MaxZoom", typeof(double), typeof(ZoomControl), new PropertyMetadata(100.0));
|
||||
|
||||
public static readonly DependencyProperty MinZoomProperty =
|
||||
DependencyProperty.Register("MinZoom", typeof(double), typeof(ZoomControl), new PropertyMetadata(0.01));
|
||||
|
||||
public static readonly DependencyProperty ModeProperty =
|
||||
DependencyProperty.Register("Mode", typeof(ZoomControlModes), typeof(ZoomControl),
|
||||
new PropertyMetadata(ZoomControlModes.Custom, Mode_PropertyChanged));
|
||||
|
||||
private static void Mode_PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var zc = (ZoomControl)d;
|
||||
var mode = (ZoomControlModes)e.NewValue;
|
||||
switch (mode)
|
||||
{
|
||||
case ZoomControlModes.Fill:
|
||||
zc.DoZoomToFill();
|
||||
break;
|
||||
case ZoomControlModes.Original:
|
||||
zc.DoZoomToOriginal();
|
||||
break;
|
||||
case ZoomControlModes.Custom:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty ModifierModeProperty =
|
||||
DependencyProperty.Register("ModifierMode", typeof(ZoomViewModifierMode), typeof(ZoomControl),
|
||||
new PropertyMetadata(ZoomViewModifierMode.None));
|
||||
|
||||
#region TranslateX TranslateY
|
||||
public static readonly DependencyProperty TranslateXProperty =
|
||||
DependencyProperty.Register("TranslateX", typeof(double), typeof(ZoomControl),
|
||||
new PropertyMetadata(0.0, TranslateX_PropertyChanged));
|
||||
|
||||
public static readonly DependencyProperty TranslateYProperty =
|
||||
DependencyProperty.Register("TranslateY", typeof(double), typeof(ZoomControl),
|
||||
new PropertyMetadata(0.0, TranslateY_PropertyChanged));
|
||||
|
||||
|
||||
private static void TranslateX_PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var zc = (ZoomControl)d;
|
||||
if (zc._translateTransform == null)
|
||||
return;
|
||||
zc._translateTransform.X = (double)e.NewValue;
|
||||
if (!zc._isZooming)
|
||||
zc.Mode = ZoomControlModes.Custom;
|
||||
zc.OnPropertyChanged("Presenter");
|
||||
zc.Presenter.OnPropertyChanged("RenderTransform");
|
||||
}
|
||||
|
||||
private static void TranslateY_PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var zc = (ZoomControl)d;
|
||||
if (zc._translateTransform == null)
|
||||
return;
|
||||
zc._translateTransform.Y = (double)e.NewValue;
|
||||
if (!zc._isZooming)
|
||||
zc.Mode = ZoomControlModes.Custom;
|
||||
zc.OnPropertyChanged("Presenter");
|
||||
zc.Presenter.OnPropertyChanged("RenderTransform");
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static readonly DependencyProperty ZoomBoxBackgroundProperty =
|
||||
DependencyProperty.Register("ZoomBoxBackground", typeof(Brush), typeof(ZoomControl),
|
||||
new PropertyMetadata(null));
|
||||
|
||||
|
||||
public static readonly DependencyProperty ZoomBoxBorderBrushProperty =
|
||||
DependencyProperty.Register("ZoomBoxBorderBrush", typeof(Brush), typeof(ZoomControl),
|
||||
new PropertyMetadata(null));
|
||||
|
||||
|
||||
public static readonly DependencyProperty ZoomBoxBorderThicknessProperty =
|
||||
DependencyProperty.Register("ZoomBoxBorderThickness", typeof(Thickness), typeof(ZoomControl),
|
||||
new PropertyMetadata(null));
|
||||
|
||||
|
||||
public static readonly DependencyProperty ZoomBoxOpacityProperty =
|
||||
DependencyProperty.Register("ZoomBoxOpacity", typeof(double), typeof(ZoomControl),
|
||||
new PropertyMetadata(0.5));
|
||||
|
||||
|
||||
public static readonly DependencyProperty ZoomBoxProperty =
|
||||
DependencyProperty.Register("ZoomBox", typeof(Rect), typeof(ZoomControl),
|
||||
new PropertyMetadata(new Rect()));
|
||||
|
||||
public static readonly DependencyProperty ZoomSensitivityProperty =
|
||||
DependencyProperty.Register("ZoomSensitivity", typeof(double), typeof(ZoomControl),
|
||||
new PropertyMetadata(100.0));
|
||||
|
||||
#region Zoom
|
||||
public static readonly DependencyProperty ZoomProperty =
|
||||
DependencyProperty.Register("Zoom", typeof(double), typeof(ZoomControl),
|
||||
new PropertyMetadata(1.0, Zoom_PropertyChanged));
|
||||
|
||||
private static void Zoom_PropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var zc = (ZoomControl)d;
|
||||
|
||||
if (zc._scaleTransform == null)
|
||||
return;
|
||||
|
||||
var zoom = (double)e.NewValue;
|
||||
zc._scaleTransform.ScaleX = zoom;
|
||||
zc._scaleTransform.ScaleY = zoom;
|
||||
/* if (!zc._isZooming)
|
||||
{
|
||||
var delta = (double)e.NewValue / (double)e.OldValue;
|
||||
zc.TranslateX *= delta;
|
||||
zc.TranslateY *= delta;
|
||||
zc.Mode = ZoomControlModes.Custom;
|
||||
}*/
|
||||
zc.OnPropertyChanged("Presenter");
|
||||
zc.Presenter.OnPropertyChanged("RenderTransform");
|
||||
zc.OnPropertyChanged("Zoom");
|
||||
|
||||
//VF zc.UpdateViewport();
|
||||
}
|
||||
#endregion
|
||||
|
||||
private Point _mouseDownPos;
|
||||
private ZCP _presenter;
|
||||
|
||||
/// <summary>
|
||||
/// Applied to the presenter.
|
||||
/// </summary>
|
||||
private ScaleTransform _scaleTransform;
|
||||
private Vector _startTranslate;
|
||||
private TransformGroup _transformGroup;
|
||||
|
||||
/// <summary>
|
||||
/// Applied to the scrollviewer.
|
||||
/// </summary>
|
||||
private TranslateTransform _translateTransform;
|
||||
|
||||
private Storyboard _currentZoomAnimation;
|
||||
|
||||
private bool _isZooming;
|
||||
|
||||
public Brush ZoomBoxBackground
|
||||
{
|
||||
get { return (Brush)GetValue(ZoomBoxBackgroundProperty); }
|
||||
set { SetValue(ZoomBoxBackgroundProperty, value); }
|
||||
}
|
||||
|
||||
public Brush ZoomBoxBorderBrush
|
||||
{
|
||||
get { return (Brush)GetValue(ZoomBoxBorderBrushProperty); }
|
||||
set { SetValue(ZoomBoxBorderBrushProperty, value); }
|
||||
}
|
||||
|
||||
public Thickness ZoomBoxBorderThickness
|
||||
{
|
||||
get { return (Thickness)GetValue(ZoomBoxBorderThicknessProperty); }
|
||||
set { SetValue(ZoomBoxBorderThicknessProperty, value); }
|
||||
}
|
||||
|
||||
public double ZoomBoxOpacity
|
||||
{
|
||||
get { return (double)GetValue(ZoomBoxOpacityProperty); }
|
||||
set { SetValue(ZoomBoxOpacityProperty, value); }
|
||||
}
|
||||
|
||||
public Rect ZoomBox
|
||||
{
|
||||
get { return (Rect)GetValue(ZoomBoxProperty); }
|
||||
set { SetValue(ZoomBoxProperty, value); }
|
||||
}
|
||||
|
||||
public Point OrigoPosition
|
||||
{
|
||||
get { return new Point(ActualWidth / 2, ActualHeight / 2); }
|
||||
}
|
||||
|
||||
private Storyboard _lastTranslateXAnimation;
|
||||
public double TranslateX
|
||||
{
|
||||
get
|
||||
{
|
||||
var value = (double)GetValue(TranslateXProperty);
|
||||
return double.IsNaN(value) ? 0 : value;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_lastTranslateXAnimation != null)
|
||||
{
|
||||
//_lastTranslateXAnimation.SkipToFill();
|
||||
_lastTranslateXAnimation.Stop();
|
||||
//SetValue(TranslateXProperty, TranslateX);
|
||||
}
|
||||
_lastTranslateXAnimation = AnimationHelper.CreateDoubleAnimation(TranslateX, value, 0, "TranslateX", this, null, (o, e) => SetValue(TranslateXProperty, value));
|
||||
// ((DoubleAnimation)_lastTranslateXAnimation.Children[0]).EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut };
|
||||
_lastTranslateXAnimation.Begin();
|
||||
//SetValue(TranslateXProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
private Storyboard _lastTranslateYAnimation;
|
||||
public double TranslateY
|
||||
{
|
||||
get {
|
||||
var value = (double)GetValue(TranslateYProperty);
|
||||
return double.IsNaN(value) ? 0 : value;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_lastTranslateYAnimation != null)
|
||||
{
|
||||
//_lastTranslateYAnimation.SkipToFill();
|
||||
_lastTranslateYAnimation.Stop();
|
||||
//SetValue(TranslateYProperty, TranslateY);
|
||||
}
|
||||
|
||||
_lastTranslateYAnimation = AnimationHelper.CreateDoubleAnimation(TranslateY, value, 0, "TranslateY", this, null, (o, e) => SetValue(TranslateYProperty, value));
|
||||
//((DoubleAnimation)_lastTranslateYAnimation.Children[0]).EasingFunction = new ExponentialEase { EasingMode = EasingMode.EaseOut };
|
||||
_lastTranslateYAnimation.Begin();
|
||||
//SetValue(TranslateYProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
public TimeSpan AnimationLength
|
||||
{
|
||||
get { return (TimeSpan)GetValue(AnimationLengthProperty); }
|
||||
set { SetValue(AnimationLengthProperty, value); }
|
||||
}
|
||||
|
||||
public double MinZoom
|
||||
{
|
||||
get { return (double)GetValue(MinZoomProperty); }
|
||||
set { SetValue(MinZoomProperty, value); }
|
||||
}
|
||||
|
||||
public double MaxZoom
|
||||
{
|
||||
get { return (double)GetValue(MaxZoomProperty); }
|
||||
set { SetValue(MaxZoomProperty, value); }
|
||||
}
|
||||
|
||||
public double MaximumZoomStep
|
||||
{
|
||||
get { return (double)GetValue(MaximumZoomStepProperty); }
|
||||
set { SetValue(MaximumZoomStepProperty, value); }
|
||||
}
|
||||
|
||||
public double ZoomSensitivity
|
||||
{
|
||||
get { return (double)GetValue(ZoomSensitivityProperty); }
|
||||
set { SetValue(ZoomSensitivityProperty, value); }
|
||||
}
|
||||
|
||||
public double Zoom
|
||||
{
|
||||
get { return (double)GetValue(ZoomProperty); }
|
||||
set
|
||||
{
|
||||
if (value == (double)GetValue(ZoomProperty))
|
||||
return;
|
||||
//TODO BeginAnimation(ZoomProperty, null);
|
||||
SetValue(ZoomProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets content object as UIElement
|
||||
/// </summary>
|
||||
public UIElement ContentVisual
|
||||
{
|
||||
get
|
||||
{
|
||||
return Content as UIElement;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets content as ITrackableContent like GraphArea
|
||||
/// </summary>
|
||||
public ITrackableContent TrackableContent
|
||||
{
|
||||
get
|
||||
{
|
||||
return Content as ITrackableContent;
|
||||
}
|
||||
}
|
||||
|
||||
bool _isga;
|
||||
/// <summary>
|
||||
/// Is loaded content represents ITrackableContent object
|
||||
/// </summary>
|
||||
public bool IsContentTrackable
|
||||
{
|
||||
get { return _isga; }
|
||||
}
|
||||
|
||||
|
||||
public ZCP Presenter
|
||||
{
|
||||
get { return _presenter; }
|
||||
set
|
||||
{
|
||||
_presenter = value;
|
||||
if (_presenter == null)
|
||||
return;
|
||||
|
||||
//add the ScaleTransform to the presenter
|
||||
_transformGroup = new TransformGroup();
|
||||
_scaleTransform = new ScaleTransform();
|
||||
_translateTransform = new TranslateTransform();
|
||||
_transformGroup.Children.Add(_scaleTransform);
|
||||
_transformGroup.Children.Add(_translateTransform);
|
||||
_presenter.RenderTransform = _transformGroup;
|
||||
_presenter.RenderTransformOrigin = new Point(0.5, 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
public UIElement PresenterVisual
|
||||
{
|
||||
get { return Presenter; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the active modifier mode.
|
||||
/// </summary>
|
||||
public ZoomViewModifierMode ModifierMode
|
||||
{
|
||||
get { return (ZoomViewModifierMode)GetValue(ModifierModeProperty); }
|
||||
set { SetValue(ModifierModeProperty, value); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the mode of the zoom control.
|
||||
/// </summary>
|
||||
public ZoomControlModes Mode
|
||||
{
|
||||
get { return (ZoomControlModes)GetValue(ModeProperty); }
|
||||
set { SetValue(ModeProperty, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public ZoomControl()
|
||||
{
|
||||
DefaultStyleKey = typeof (ZoomControl);
|
||||
if (DesignMode.DesignModeEnabled)
|
||||
{
|
||||
//Mode = ZoomControlModes.Fill;
|
||||
|
||||
Loaded += ZoomControl_DesignerLoaded;
|
||||
}
|
||||
else
|
||||
{
|
||||
PointerWheelChanged += ZoomControl_MouseWheel;
|
||||
PointerPressed += ZoomControl_PreviewMouseDown;
|
||||
PointerReleased += ZoomControl_MouseUp;
|
||||
UseCtrlForMouseWheel = true;
|
||||
Loaded += ZoomControl_Loaded;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ZoomControl_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
SetValue(ZoomProperty, Zoom);
|
||||
}
|
||||
|
||||
void ZoomControl_DesignerLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Zoom = 1.0;
|
||||
}
|
||||
|
||||
#region ContentChanged
|
||||
protected override void OnContentChanged(object oldContent, object newContent)
|
||||
{
|
||||
if (oldContent != null)
|
||||
{
|
||||
var old = oldContent as ITrackableContent;
|
||||
if (old != null) old.ContentSizeChanged -= Content_ContentSizeChanged;
|
||||
}
|
||||
if (newContent != null)
|
||||
{
|
||||
//VF UpdateViewFinderDisplayContentBounds();
|
||||
//VF UpdateViewport();
|
||||
var newc = newContent as ITrackableContent;
|
||||
if (newc != null)
|
||||
{
|
||||
_isga = true;
|
||||
newc.ContentSizeChanged += Content_ContentSizeChanged;
|
||||
}
|
||||
else _isga = false;
|
||||
}
|
||||
|
||||
base.OnContentChanged(oldContent, newContent);
|
||||
}
|
||||
|
||||
void Content_ContentSizeChanged(object sender, ContentSizeChangedEventArgs e)
|
||||
{
|
||||
//VF UpdateViewFinderDisplayContentBounds();
|
||||
//VF UpdateViewport();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Mouse controls
|
||||
|
||||
/// <summary>
|
||||
/// Converts screen rectangle area to rectangle in content coordinate space according to scale and translation
|
||||
/// </summary>
|
||||
/// <param name="screenRectangle">Screen rectangle data</param>
|
||||
public Rect ToContentRectangle(Rect screenRectangle)
|
||||
{
|
||||
var transformer = TransformToVisual(ContentVisual);
|
||||
var tl = transformer.TransformPoint(new Point(screenRectangle.X, screenRectangle.Y));
|
||||
var br = transformer.TransformPoint(new Point(screenRectangle.Right, screenRectangle.Bottom));
|
||||
return new Rect(tl.X, tl.Y, Math.Abs(Math.Abs(br.X) - Math.Abs(tl.X)), Math.Abs(Math.Abs(br.Y) - Math.Abs(tl.Y)));
|
||||
}
|
||||
|
||||
private void ZoomControl_MouseWheel(object sender, PointerRoutedEventArgs e)
|
||||
{
|
||||
|
||||
var handle = (e.KeyModifiers == VirtualKeyModifiers.Control && ModifierMode == ZoomViewModifierMode.None) || UseCtrlForMouseWheel;
|
||||
if (!handle) return;
|
||||
|
||||
e.Handled = true;
|
||||
//var origoPosition = new Point(ActualWidth / 2, ActualHeight / 2);
|
||||
//var mousePosition = e.GetCurrentPoint(this).Position;
|
||||
MouseWheelAction(e.GetCurrentPoint(this).Properties.MouseWheelDelta, e.GetCurrentPoint(this).Position);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines action on mousewheel
|
||||
/// </summary>
|
||||
/// <param name="delta"></param>
|
||||
/// <param name="mousePosition"></param>
|
||||
protected virtual void MouseWheelAction(int delta, Point mousePosition)
|
||||
{
|
||||
var origoPosition = OrigoPosition;
|
||||
|
||||
DoZoom(
|
||||
Math.Max(1 / MaximumZoomStep, Math.Min(MaximumZoomStep, (Math.Abs(delta) / 10000.0 * ZoomSensitivity + 1))),
|
||||
delta < 0 ? -1 : 1,
|
||||
origoPosition,
|
||||
MouseWheelZoomingMode == MouseWheelZoomingMode.Absolute ? OrigoPosition : mousePosition,
|
||||
MouseWheelZoomingMode == MouseWheelZoomingMode.Absolute ? OrigoPosition : mousePosition);
|
||||
}
|
||||
|
||||
|
||||
private void ZoomControl_MouseUp(object sender, PointerRoutedEventArgs e)
|
||||
{
|
||||
switch (ModifierMode)
|
||||
{
|
||||
case ZoomViewModifierMode.None:
|
||||
return;
|
||||
case ZoomViewModifierMode.Pan:
|
||||
break;
|
||||
case ZoomViewModifierMode.ZoomIn:
|
||||
break;
|
||||
case ZoomViewModifierMode.ZoomOut:
|
||||
break;
|
||||
case ZoomViewModifierMode.ZoomBox:
|
||||
if (_startedAsAreaSelection)
|
||||
{
|
||||
_startedAsAreaSelection = false;
|
||||
|
||||
OnAreaSelected(ToContentRectangle(ZoomBox));
|
||||
ZoomBox = Rect.Empty;
|
||||
}
|
||||
else ZoomToInternal(ZoomBox);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
ModifierMode = ZoomViewModifierMode.None;
|
||||
PointerMoved -= ZoomControl_PreviewMouseMove;
|
||||
ReleasePointerCapture(e.Pointer);
|
||||
}
|
||||
|
||||
private void ZoomControl_PreviewMouseMove(object sender, PointerRoutedEventArgs e)
|
||||
{
|
||||
var pos = e.GetCurrentPoint(this).Position;
|
||||
switch (ModifierMode)
|
||||
{
|
||||
case ZoomViewModifierMode.None:
|
||||
return;
|
||||
case ZoomViewModifierMode.Pan:
|
||||
var pps = pos.Subtract(_mouseDownPos);
|
||||
var translatex = _startTranslate.X + pps.X;
|
||||
var translatey = _startTranslate.Y + pps.Y;
|
||||
TranslateX = translatex;
|
||||
TranslateY = translatey;
|
||||
//VF UpdateViewport();
|
||||
break;
|
||||
case ZoomViewModifierMode.ZoomIn:
|
||||
break;
|
||||
case ZoomViewModifierMode.ZoomOut:
|
||||
break;
|
||||
case ZoomViewModifierMode.ZoomBox:
|
||||
var x = Math.Min(_mouseDownPos.X, pos.X);
|
||||
var y = Math.Min(_mouseDownPos.Y, pos.Y);
|
||||
var sizeX = Math.Abs(_mouseDownPos.X - pos.X);
|
||||
var sizeY = Math.Abs(_mouseDownPos.Y - pos.Y);
|
||||
ZoomBox = new Rect(x, y, sizeX, sizeY);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
/* private void ZoomControl_MouseDown(object sender, PointerRoutedEventArgs e)
|
||||
{
|
||||
OnMouseDown(e, false);
|
||||
}*/
|
||||
|
||||
private void ZoomControl_PreviewMouseDown(object sender, PointerRoutedEventArgs e)
|
||||
{
|
||||
OnMouseDown(e, false);
|
||||
e.Handled = false;
|
||||
}
|
||||
|
||||
private bool _startedAsAreaSelection;
|
||||
private void OnMouseDown(PointerRoutedEventArgs e, bool isPreview)
|
||||
{
|
||||
if (ModifierMode != ZoomViewModifierMode.None)
|
||||
return;
|
||||
_startedAsAreaSelection = false;
|
||||
switch (e.KeyModifiers)
|
||||
{
|
||||
case VirtualKeyModifiers.None:
|
||||
if (!isPreview)
|
||||
ModifierMode = ZoomViewModifierMode.Pan;
|
||||
break;
|
||||
case VirtualKeyModifiers.Windows | VirtualKeyModifiers.Control:
|
||||
_startedAsAreaSelection = true;
|
||||
ModifierMode = ZoomViewModifierMode.ZoomBox;
|
||||
break;
|
||||
case VirtualKeyModifiers.Windows:
|
||||
ModifierMode = ZoomViewModifierMode.ZoomBox;
|
||||
break;
|
||||
case VirtualKeyModifiers.Control:
|
||||
break;
|
||||
case VirtualKeyModifiers.Shift:
|
||||
ModifierMode = ZoomViewModifierMode.Pan;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if (ModifierMode == ZoomViewModifierMode.None)
|
||||
return;
|
||||
|
||||
_mouseDownPos = e.GetCurrentPoint(this).Position;
|
||||
_startTranslate = new Vector(TranslateX, TranslateY);
|
||||
CapturePointer(e.Pointer);
|
||||
PointerMoved += ZoomControl_PreviewMouseMove;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Animation
|
||||
|
||||
public event EventHandler ZoomAnimationCompleted;
|
||||
|
||||
private void OnZoomAnimationCompleted()
|
||||
{
|
||||
if (ZoomAnimationCompleted != null)
|
||||
ZoomAnimationCompleted(this, EventArgs.Empty);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void DoZoomAnimation(double targetZoom, double transformX, double transformY, bool isZooming = true)
|
||||
{
|
||||
if (targetZoom == 0d && double.IsNaN(transformX) && double.IsNaN(transformY)) return;
|
||||
_isZooming = isZooming;
|
||||
var duration = !IsAnimationDisabled ? new Duration(AnimationLength) : new Duration(new TimeSpan(0,0,0,0,100));
|
||||
var value = (double)GetValue(TranslateXProperty);
|
||||
if (double.IsNaN(value) || double.IsInfinity(value)) SetValue(TranslateXProperty, 0d);
|
||||
value = (double)GetValue(TranslateYProperty);
|
||||
if (double.IsNaN(value) || double.IsInfinity(value)) SetValue(TranslateYProperty, 0d);
|
||||
StartAnimation(TranslateXProperty, "TranslateX", transformX, duration);
|
||||
if (double.IsNaN(transformY) || double.IsInfinity(transformY)) transformY = 0;
|
||||
StartAnimation(TranslateYProperty, "TranslateY", transformY, duration);
|
||||
if (double.IsNaN(targetZoom) || double.IsInfinity(targetZoom)) targetZoom = 1;
|
||||
StartAnimation(ZoomProperty, "Zoom", targetZoom, duration);
|
||||
}
|
||||
|
||||
private void StartAnimation(DependencyProperty dp, string dpName, double toValue, Duration duration)
|
||||
{
|
||||
if (double.IsNaN(toValue) || double.IsInfinity(toValue))
|
||||
{
|
||||
if (dp == ZoomProperty)
|
||||
{
|
||||
_isZooming = false;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
_currentZoomAnimation = AnimationHelper.CreateDoubleAnimation(null, toValue, duration.TimeSpan.TotalMilliseconds, dpName, this);
|
||||
if (dp == ZoomProperty)
|
||||
{
|
||||
_zoomAnimCount++;
|
||||
_currentZoomAnimation.Completed += (s, args) =>
|
||||
{
|
||||
_zoomAnimCount--;
|
||||
if (_zoomAnimCount > 0 && _currentZoomAnimation != s)
|
||||
return;
|
||||
var zoom = Zoom;
|
||||
SetValue(ZoomProperty, zoom);
|
||||
_isZooming = false;
|
||||
//VF UpdateViewport();
|
||||
OnZoomAnimationCompleted();
|
||||
};
|
||||
}
|
||||
_currentZoomAnimation.Begin();
|
||||
}
|
||||
|
||||
private int _zoomAnimCount;
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Zoom to rectangle area (MAY BE DEPRECATED). Use ZoomToContent method instead.
|
||||
/// </summary>
|
||||
/// <param name="rect"></param>
|
||||
/// <param name="setDelta"></param>
|
||||
public void ZoomTo(Rect rect, bool setDelta = false)
|
||||
{
|
||||
ZoomToInternal(rect, setDelta);
|
||||
//VF UpdateViewFinderDisplayContentBounds();
|
||||
//VF UpdateViewport();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Zoom to rectangle area of the content
|
||||
/// </summary>
|
||||
/// <param name="rectangle">Rectangle area</param>
|
||||
/// <param name="usingContentCoordinates">Sets if content coordinates or screen coordinates was specified</param>
|
||||
public void ZoomToContent(Rect rectangle, bool usingContentCoordinates = true)
|
||||
{
|
||||
//if content isn't UIElement - return
|
||||
if (ContentVisual == null) return;
|
||||
// translate the region from the coordinate space of the content
|
||||
// to the coordinate space of the content presenter
|
||||
var transformer = ContentVisual.TransformToVisual(_presenter);
|
||||
var region = usingContentCoordinates ?
|
||||
new Rect(
|
||||
transformer.TransformPoint(new Point(rectangle.Top, rectangle.Left)),
|
||||
transformer.TransformPoint(new Point(rectangle.Bottom, rectangle.Right))) : rectangle;
|
||||
|
||||
// calculate actual zoom, which must fit the entire selection
|
||||
// while maintaining a 1:1 ratio
|
||||
var aspectX = ActualWidth / region.Width;
|
||||
var aspectY = ActualHeight / region.Height;
|
||||
var newRelativeScale = aspectX < aspectY ? aspectX : aspectY;
|
||||
// ensure that the scale value alls within the valid range
|
||||
if (newRelativeScale > MaxZoom)
|
||||
newRelativeScale = MaxZoom;
|
||||
else if (newRelativeScale < MinZoom)
|
||||
newRelativeScale = MinZoom;
|
||||
|
||||
var center = new Point(rectangle.X + rectangle.Width / 2, rectangle.Y + rectangle.Height / 2);
|
||||
var newRelativePosition = new Point((ActualWidth / 2 - center.X) * Zoom, (ActualHeight / 2 - center.Y) * Zoom);
|
||||
|
||||
TranslateX = newRelativePosition.X;
|
||||
TranslateY = newRelativePosition.Y;
|
||||
Zoom = newRelativeScale;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Zoom to original size
|
||||
/// </summary>
|
||||
public void ZoomToOriginal()
|
||||
{
|
||||
if (Mode == ZoomControlModes.Original)
|
||||
DoZoomToOriginal();
|
||||
else Mode = ZoomControlModes.Original;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Centers content on the screen
|
||||
/// </summary>
|
||||
public void CenterContent()
|
||||
{
|
||||
if (_presenter == null)
|
||||
return;
|
||||
|
||||
var initialTranslate = GetTrackableTranslate();
|
||||
DoZoomAnimation(Zoom, initialTranslate.X*Zoom, initialTranslate.Y*Zoom);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Zoom to fill screen area with the content
|
||||
/// </summary>
|
||||
public void ZoomToFill()
|
||||
{
|
||||
if(Mode == ZoomControlModes.Fill)
|
||||
DoZoomToFill();
|
||||
else Mode = ZoomControlModes.Fill;
|
||||
}
|
||||
|
||||
private void ZoomToInternal(Rect rect, bool setDelta = false)
|
||||
{
|
||||
var deltaZoom = Math.Min(ActualWidth / rect.Width, ActualHeight / rect.Height);
|
||||
var startHandlePosition = new Point(rect.X + rect.Width / 2, rect.Y + rect.Height / 2);
|
||||
DoZoom(deltaZoom, 1, OrigoPosition, startHandlePosition, OrigoPosition, setDelta);
|
||||
ZoomBox = new Rect();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns initial translate depending on container graph settings (to deal with optinal new coord system)
|
||||
/// </summary>
|
||||
private Vector GetTrackableTranslate()
|
||||
{
|
||||
if (!IsContentTrackable) return new Vector();
|
||||
return DesignMode.DesignModeEnabled ? GetInitialTranslate(200,100) : GetInitialTranslate(TrackableContent.ContentSize.Width, TrackableContent.ContentSize.Height, TrackableContent.ContentSize.X, TrackableContent.ContentSize.Y);
|
||||
}
|
||||
|
||||
private void DoZoomToOriginal()
|
||||
{
|
||||
if (_presenter == null)
|
||||
return;
|
||||
|
||||
var initialTranslate = GetTrackableTranslate();
|
||||
DoZoomAnimation(1.0, initialTranslate.X, initialTranslate.Y);
|
||||
}
|
||||
|
||||
private Vector GetInitialTranslate(double contentWidth, double contentHeight, double offsetX = 0, double offsetY = 0)
|
||||
{
|
||||
if (_presenter == null)
|
||||
return new Vector(0.0, 0.0);
|
||||
var w = contentWidth - ActualWidth;
|
||||
var h = contentHeight - ActualHeight;
|
||||
var tX = -(w / 2.0 + offsetX);
|
||||
var tY = -(h / 2.0 + offsetY);
|
||||
|
||||
return new Vector(tX, tY);
|
||||
}
|
||||
|
||||
private void DoZoomToFill()
|
||||
{
|
||||
if (_presenter == null)
|
||||
return;
|
||||
var c = IsContentTrackable ? TrackableContent.ContentSize.Size() : ContentVisual.DesiredSize;
|
||||
var deltaZoom = Math.Min(MaxZoom,Math.Min( ActualWidth / (c.Width), ActualHeight / (c.Height)));
|
||||
var initialTranslate = IsContentTrackable ? GetTrackableTranslate() : GetInitialTranslate(c.Width, c.Height);
|
||||
DoZoomAnimation(deltaZoom, initialTranslate.X * deltaZoom, initialTranslate.Y * deltaZoom);
|
||||
}
|
||||
|
||||
private double GetCoercedTranslate(double baseValue)
|
||||
{
|
||||
return _presenter == null ? 0.0 : baseValue;
|
||||
}
|
||||
|
||||
private void DoZoom(double deltaZoom, int mod, Point origoPosition, Point startHandlePosition, Point targetHandlePosition, bool setDelta = false)
|
||||
{
|
||||
var startZoom = Zoom;
|
||||
var currentZoom = setDelta ? deltaZoom : (mod == -1 ? (startZoom / deltaZoom) : (startZoom * deltaZoom));
|
||||
currentZoom = Math.Max(MinZoom, Math.Min(MaxZoom, currentZoom));
|
||||
|
||||
var startTranslate = new Point(TranslateX, TranslateY);
|
||||
|
||||
var v = startHandlePosition.Subtract(origoPosition);
|
||||
var vTarget = targetHandlePosition.Subtract(origoPosition);
|
||||
|
||||
var targetPoint = v.Subtract(startTranslate).Div(startZoom);
|
||||
var zoomedTargetPointPos = targetPoint.Mul(currentZoom).Sum(startTranslate);
|
||||
var endTranslate = vTarget.Subtract(zoomedTargetPointPos);
|
||||
|
||||
|
||||
if (setDelta)
|
||||
{
|
||||
var transformX = GetCoercedTranslate(endTranslate.X);
|
||||
var transformY = GetCoercedTranslate(endTranslate.Y);
|
||||
DoZoomAnimation(currentZoom, transformX, transformY);
|
||||
}
|
||||
else
|
||||
{
|
||||
var transformX = GetCoercedTranslate(TranslateX + endTranslate.X);
|
||||
var transformY = GetCoercedTranslate(TranslateY + endTranslate.Y);
|
||||
DoZoomAnimation(currentZoom, transformX, transformY);
|
||||
}
|
||||
Mode = ZoomControlModes.Custom;
|
||||
}
|
||||
|
||||
protected override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
//VF AttachToVisualTree();
|
||||
|
||||
//get the presenter, and initialize
|
||||
Presenter = GetTemplateChild(PART_PRESENTER) as ZCP;
|
||||
if (Presenter != null)
|
||||
{
|
||||
Presenter.SizeChanged += (s, a) =>
|
||||
{
|
||||
//VF UpdateViewport();
|
||||
if (Mode == ZoomControlModes.Fill)
|
||||
DoZoomToFill();
|
||||
};
|
||||
Presenter.ContentSizeChanged += (s, a) =>
|
||||
{
|
||||
//UpdateViewFinderDisplayContentBounds();
|
||||
if (Mode == ZoomControlModes.Fill)
|
||||
{
|
||||
DoZoomToFill();
|
||||
//IsAnimationDisabled = false;
|
||||
}
|
||||
};
|
||||
}
|
||||
ZoomToFill();
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string name)
|
||||
{
|
||||
if (PropertyChanged != null)
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(name));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
using GraphX.PCL.Common.Models;
|
||||
|
||||
namespace GraphX.Controls.DesignerExampleData
|
||||
{
|
||||
internal sealed class EdgeDataExample<TVertex> : EdgeBase<TVertex>
|
||||
{
|
||||
public EdgeDataExample(TVertex source, TVertex target)
|
||||
: base(source, target)
|
||||
{
|
||||
|
||||
}
|
||||
public EdgeDataExample(TVertex source, TVertex target, double weight)
|
||||
: base(source, target, weight)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public string Text { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
using GraphX.PCL.Common.Models;
|
||||
|
||||
namespace GraphX.Controls.DesignerExampleData
|
||||
{
|
||||
internal sealed class VertexDataExample : VertexBase
|
||||
{
|
||||
public VertexDataExample(int id, string name)
|
||||
{
|
||||
ID = id; Name = name;
|
||||
//DataImage = new BitmapImage(new Uri(@"pack://application:,,,/GraphX.Controls;component/Images/help_black.png", UriKind.Absolute));
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
//public ImageSource DataImage{ get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
using System;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Data;
|
||||
|
||||
namespace GraphX.Controls
|
||||
{
|
||||
public static class DependencyObjectExtensions
|
||||
{
|
||||
public static IDisposable WatchProperty(this DependencyObject target,
|
||||
string propertyPath,
|
||||
DependencyPropertyChangedEventHandler handler)
|
||||
{
|
||||
return new DependencyPropertyWatcher(target, propertyPath, handler);
|
||||
}
|
||||
|
||||
private class DependencyPropertyWatcher : DependencyObject, IDisposable
|
||||
{
|
||||
private DependencyPropertyChangedEventHandler _handler;
|
||||
|
||||
public DependencyPropertyWatcher(DependencyObject target,
|
||||
string propertyPath,
|
||||
DependencyPropertyChangedEventHandler handler)
|
||||
{
|
||||
if (target == null) throw new ArgumentNullException("target");
|
||||
if (propertyPath == null) throw new ArgumentNullException("propertyPath");
|
||||
if (handler == null) throw new ArgumentNullException("handler");
|
||||
|
||||
_handler = handler;
|
||||
|
||||
var binding = new Binding
|
||||
{
|
||||
Source = target,
|
||||
Path = new PropertyPath(propertyPath),
|
||||
Mode = BindingMode.OneWay,
|
||||
};
|
||||
BindingOperations.SetBinding(this, ValueProperty, binding);
|
||||
}
|
||||
|
||||
private static readonly DependencyProperty ValueProperty =
|
||||
DependencyProperty.Register(
|
||||
"Value",
|
||||
typeof (object),
|
||||
typeof (DependencyPropertyWatcher),
|
||||
new PropertyMetadata(null, ValuePropertyChanged));
|
||||
|
||||
private static void ValuePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var watcher = d as DependencyPropertyWatcher;
|
||||
if (watcher == null)
|
||||
return;
|
||||
|
||||
watcher.OnValueChanged(e);
|
||||
}
|
||||
|
||||
private void OnValueChanged(DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var handler = _handler;
|
||||
if (handler != null)
|
||||
handler(this, e);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_handler = null;
|
||||
// There is no ClearBinding method, so set a dummy binding instead
|
||||
BindingOperations.SetBinding(this, ValueProperty, new Binding());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,370 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" 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>{4BEBC41E-2710-4613-80B1-198E08D10619}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>GraphX.UAP.Controls</RootNamespace>
|
||||
<AssemblyName>GraphX.UAP.Controls</AssemblyName>
|
||||
<DefaultLanguage>ru-RU</DefaultLanguage>
|
||||
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
|
||||
<TargetPlatformVersion Condition=" '$(TargetPlatformVersion)' == '' ">10.0.14393.0</TargetPlatformVersion>
|
||||
<TargetPlatformMinVersion>10.0.10586.0</TargetPlatformMinVersion>
|
||||
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NETFX_CORE;WINDOWS_UWP;METRO</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP;METRO</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\ARM\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<OutputPath>bin\ARM\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>ARM</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<NoWarn>;2008</NoWarn>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\GraphX.Controls\Animations\DeleteFadeAnimation.cs">
|
||||
<Link>Animations\DeleteFadeAnimation.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Animations\DeleteShrinkAnimation.cs">
|
||||
<Link>Animations\DeleteShrinkAnimation.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Animations\Enums\DeleteAnimation.cs">
|
||||
<Link>Animations\Enum\DeleteAnimation.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Animations\Enums\MouseOverAnimation.cs">
|
||||
<Link>Animations\Enum\MouseOverAnimation.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Animations\Enums\MoveAnimation.cs">
|
||||
<Link>Animations\Enum\MoveAnimation.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Animations\Interfaces\IBidirectionalControlAnimation.cs">
|
||||
<Link>Animations\Interfaces\IBidirectionalControlAnimation.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Animations\Interfaces\IOneWayControlAnimation.cs">
|
||||
<Link>Animations\Interfaces\IOneWayControlAnimation.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Animations\MouseOverScaleAnimation.cs">
|
||||
<Link>Animations\MouseOverScaleAnimation.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Animations\MoveAnimationBase.cs">
|
||||
<Link>Animations\MoveAnimationBase.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Animations\MoveFadeAnimation.cs">
|
||||
<Link>Animations\MoveFadeAnimation.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Animations\MoveSimpleAnimation.cs">
|
||||
<Link>Animations\MoveSimpleAnimation.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Behaviours\DragBehaviour.cs">
|
||||
<Link>Behaviours\DragBehaviour.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Behaviours\HighlightBehaviour.cs">
|
||||
<Link>Behaviours\HighlightBehaviour.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\EdgeControl.cs">
|
||||
<Link>Controls\EdgeControl.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\EdgeControlBase.cs">
|
||||
<Link>Controls\EdgeControlBase.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\EdgeLabels\AttachableEdgeLabelControl.cs">
|
||||
<Link>Controls\EdgeLabels\AttachableEdgeLabelControl.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\EdgeLabels\EdgeLabelControl.cs">
|
||||
<Link>Controls\EdgeLabels\EdgeLabelControl.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\EdgePointers\DefaultEdgePointer.cs">
|
||||
<Link>Controls\EdgePointers\DefaultEdgePointer.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\GraphArea.cs">
|
||||
<Link>Controls\GraphArea.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\GraphAreaBase.cs">
|
||||
<Link>Controls\GraphAreaBase.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\Misc\ControlDrawOrder.cs">
|
||||
<Link>Controls\Misc\ControlDrawOrder.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\Misc\EdgeDashStyle.cs">
|
||||
<Link>Controls\Misc\EdgeDashStyle.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\Misc\IEdgeLabelControl.cs">
|
||||
<Link>Controls\Misc\IEdgeLabelControl.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\Misc\IEdgePointer.cs">
|
||||
<Link>Controls\Misc\IEdgePointer.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\Misc\IGraphArea.cs">
|
||||
<Link>Controls\Misc\IGraphArea.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\Misc\IGraphAreaBase.cs">
|
||||
<Link>Controls\Misc\IGraphAreaBase.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\Misc\IGraphControl.cs">
|
||||
<Link>Controls\Misc\IGraphControl.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\Misc\IPositionChangeNotify.cs">
|
||||
<Link>Controls\Misc\IPositionChangeNotify.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\Misc\ITrackableContent.cs">
|
||||
<Link>Controls\Misc\ITrackableContent.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\Misc\IVertexConnectionPoint.cs">
|
||||
<Link>Controls\Misc\IVertexConnectionPoint.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\Misc\IVertexLabelControl.cs">
|
||||
<Link>Controls\Misc\IVertexLabelControl.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\Misc\IZoomControl.cs">
|
||||
<Link>Controls\Misc\IZoomControl.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\Misc\LogicCoreChangedAction.cs">
|
||||
<Link>Controls\Misc\LogicCoreChangedAction.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\VertexConnectionPoints\StaticVertexConnectionPoint.cs">
|
||||
<Link>Controls\VertexConnectionPoints\StaticVertexConnectionPoint.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\VertexControl.cs">
|
||||
<Link>Controls\VertexControl.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\VertexControlBase.cs">
|
||||
<Link>Controls\VertexControlBase.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\VertexLabels\AttachableVertexLabelControl.cs">
|
||||
<Link>Controls\VertexLabels\AttachableVertexLabelControl.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Controls\VertexLabels\VertexLabelControl.cs">
|
||||
<Link>Controls\VertexLabels\VertexLabelControl.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\CustomHelper.cs">
|
||||
<Link>CustomHelper.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\GeometryHelper.cs">
|
||||
<Link>GeometryHelper.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\MathHelper.cs">
|
||||
<Link>MathHelper.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Models\AnimationFactory.cs">
|
||||
<Link>Models\AnimationFactory.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Models\ContentSizeChangedEventHandler.cs">
|
||||
<Link>Models\ContentSizeChangedEventHandler.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Models\ControlEventArgs.cs">
|
||||
<Link>Models\ControlEventArgs.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Models\DefaultLabelFactory.cs">
|
||||
<Link>Models\DefaultLabelFactory.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Models\EdgeEventOptions.cs">
|
||||
<Link>Models\EdgeEventOptions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Models\EdgeSelectedEventHandler.cs">
|
||||
<Link>Models\EdgeSelectedEventHandler.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Models\GraphControlFactory.cs">
|
||||
<Link>Models\GraphControlFactory.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Models\Interfaces\IAttachableControl.cs">
|
||||
<Link>Models\Interfaces\IAttachableControl.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Models\Interfaces\IGraphControlFactory.cs">
|
||||
<Link>Models\Interfaces\IGraphControlFactory.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Models\Interfaces\ILabelFactory.cs">
|
||||
<Link>Models\Interfaces\ILabelFactory.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Models\RemoveControlEventHandler.cs">
|
||||
<Link>Models\RemoveControlEventHandler.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Models\StateStorage.cs">
|
||||
<Link>Models\StateStorage.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Models\VertexEventOptions.cs">
|
||||
<Link>Models\VertexEventOptions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Models\VertexPositionChangedEH.cs">
|
||||
<Link>Models\VertexPositionChangedEH.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Models\VertexPositionEventArgs.cs">
|
||||
<Link>Models\VertexPositionEventArgs.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\Models\VertexSelectedEventHandler.cs">
|
||||
<Link>Models\VertexSelectedEventHandler.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\GraphX.Controls\TypeExtensions.cs">
|
||||
<Link>TypeExtensions.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="Controls\ZoomControl\Converters\DoubleToLog10Converter.cs" />
|
||||
<Compile Include="Controls\ZoomControl\Converters\EqualityToBooleanConverter.cs" />
|
||||
<Compile Include="Controls\ZoomControl\Converters\RoundedValueConverter.cs" />
|
||||
<Compile Include="Controls\ZoomControl\Converters\VisibilityToBoolConverter.cs" />
|
||||
<Compile Include="Controls\ZoomControl\Helpers\DoubleHelper.cs" />
|
||||
<Compile Include="Controls\ZoomControl\Helpers\PointHelper.cs" />
|
||||
<Compile Include="Controls\ZoomControl\Helpers\VisualTreeHelperEx.cs" />
|
||||
<Compile Include="Controls\ZoomControl\SupportClasses\AreaSelectedEventArgs.cs" />
|
||||
<Compile Include="Controls\ZoomControl\SupportClasses\AreaSelectedEventHandler.cs" />
|
||||
<Compile Include="Controls\ZoomControl\SupportClasses\ContentSizeChangedHandler.cs" />
|
||||
<Compile Include="Controls\ZoomControl\SupportClasses\MouseWheelZoomingMode.cs" />
|
||||
<Compile Include="Controls\ZoomControl\SupportClasses\ZoomControlModes.cs" />
|
||||
<Compile Include="Controls\ZoomControl\SupportClasses\ZoomViewModifierMode.cs" />
|
||||
<Compile Include="Controls\ZoomControl\ZoomContentPresenter.cs" />
|
||||
<Compile Include="Controls\ZoomControl\ZoomControl.cs" />
|
||||
<Compile Include="DesignerExampleData\EdgeDataExample.cs" />
|
||||
<Compile Include="DesignerExampleData\VertexDataExample.cs" />
|
||||
<Compile Include="DpExtensions.cs" />
|
||||
<Compile Include="Models\AnimationHelper.cs" />
|
||||
<Compile Include="Models\DelegateCommand.cs" />
|
||||
<Compile Include="Models\DispatcherHelper.cs" />
|
||||
<Compile Include="Models\EdgeSelectedEventArgs.cs" />
|
||||
<Compile Include="Models\FileServiceProviderMETRO.cs" />
|
||||
<Compile Include="Models\ModifierKeys.cs" />
|
||||
<Compile Include="Models\MouseButtonEventArgs.cs" />
|
||||
<Compile Include="Models\VertexMovedEventArgs.cs" />
|
||||
<Compile Include="Models\VertexSelectedEventArgs.cs" />
|
||||
<Compile Include="Models\XamlTypes\ViewModelBase.cs" />
|
||||
<Compile Include="Models\XamlTypes\ViewModelXamlMember.cs" />
|
||||
<Compile Include="Models\XamlTypes\ViewModelXamlMetadataProvider.cs" />
|
||||
<Compile Include="Models\XamlTypes\ViewModelXamlType.cs" />
|
||||
<Compile Include="Models\XamlTypes\XamlSystemType.cs" />
|
||||
<Compile Include="Models\XamlTypes\XamlTypeProvider.cs" />
|
||||
<Compile Include="PrintHelper.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Properties\GraphX.UAP.Controls.rd.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
|
||||
<Version>6.0.6</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="QuickGraphPCL">
|
||||
<Version>3.6.61114.2</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\GraphX.PCL.Common\GraphX.PCL.Common.csproj">
|
||||
<Project>{3644d44b-dec0-4b65-bba0-c68e34821aae}</Project>
|
||||
<Name>GraphX.PCL.Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Images\cross-icon.png" />
|
||||
<Content Include="Images\help_black.png" />
|
||||
<Content Include="Images\round1.png" />
|
||||
<Content Include="Images\round2.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Page Include="Themes\Generic.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="uap_graphx.controls.pfx" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' ">
|
||||
<VisualStudioVersion>14.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignAssembly>true</SignAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyOriginatorKeyFile>uap_graphx.controls.pfx</AssemblyOriginatorKeyFile>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />
|
||||
<PropertyGroup>
|
||||
<PostBuildEvent>mkdir "$(SolutionDir)bin\$(ConfigurationName)"
|
||||
copy /Y "$(TargetDir)$(TargetName).dll" "$(SolutionDir)bin\$(ConfigurationName)\GraphX.UAP.Controls.dll"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
После Ширина: | Высота: | Размер: 50 KiB |
После Ширина: | Высота: | Размер: 5.3 KiB |
После Ширина: | Высота: | Размер: 22 KiB |
После Ширина: | Высота: | Размер: 34 KiB |
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Media.Animation;
|
||||
|
||||
namespace GraphX.Controls.Models
|
||||
{
|
||||
public static class AnimationHelper
|
||||
{
|
||||
public static Storyboard CreateDoubleAnimation(double? from, double? to, double duration, string propertyName, FrameworkElement target, FillBehavior? fillBehavior = null, EventHandler<object> onCompleted = null)
|
||||
{
|
||||
var animation = new DoubleAnimation
|
||||
{
|
||||
From = from,
|
||||
To = to,
|
||||
Duration = new Duration(TimeSpan.FromMilliseconds(duration)),
|
||||
EnableDependentAnimation = true ,
|
||||
//FillBehavior = fillBehavior
|
||||
//EasingFunction = new ExponentialEase() { EasingMode = EasingMode.EaseOut }
|
||||
};
|
||||
|
||||
if (fillBehavior.HasValue)
|
||||
animation.FillBehavior = fillBehavior.Value;
|
||||
var sb = new Storyboard();
|
||||
Storyboard.SetTarget(animation, target);
|
||||
Storyboard.SetTargetProperty(animation, propertyName);
|
||||
sb.Children.Add(animation);
|
||||
if(onCompleted != null)
|
||||
sb.Completed += onCompleted;
|
||||
return sb;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace GraphX.Controls.Models
|
||||
{
|
||||
public class DelegateCommand<T> : ICommand
|
||||
{
|
||||
private readonly Func<T, bool> _canExecuteMethod;
|
||||
private readonly Action<T> _executeMethod;
|
||||
|
||||
#region Constructors
|
||||
|
||||
public DelegateCommand(Action<T> executeMethod)
|
||||
: this(executeMethod, null)
|
||||
{
|
||||
}
|
||||
|
||||
public DelegateCommand(Action<T> executeMethod, Func<T, bool> canExecuteMethod)
|
||||
{
|
||||
_executeMethod = executeMethod;
|
||||
_canExecuteMethod = canExecuteMethod;
|
||||
}
|
||||
|
||||
#endregion Constructors
|
||||
|
||||
#region ICommand Members
|
||||
|
||||
public event EventHandler CanExecuteChanged;
|
||||
|
||||
bool ICommand.CanExecute(object parameter)
|
||||
{
|
||||
try
|
||||
{
|
||||
return CanExecute((T)parameter);
|
||||
}
|
||||
catch { return false; }
|
||||
}
|
||||
|
||||
void ICommand.Execute(object parameter)
|
||||
{
|
||||
Execute((T)parameter);
|
||||
}
|
||||
|
||||
#endregion ICommand Members
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public bool CanExecute(T parameter)
|
||||
{
|
||||
return ((_canExecuteMethod == null) || _canExecuteMethod(parameter));
|
||||
}
|
||||
|
||||
public void Execute(T parameter)
|
||||
{
|
||||
if (_executeMethod != null)
|
||||
{
|
||||
_executeMethod(parameter);
|
||||
}
|
||||
}
|
||||
|
||||
public void RaiseCanExecuteChanged()
|
||||
{
|
||||
OnCanExecuteChanged(EventArgs.Empty);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected virtual void OnCanExecuteChanged(EventArgs e)
|
||||
{
|
||||
var handler = CanExecuteChanged;
|
||||
if (handler != null)
|
||||
{
|
||||
handler(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.UI.Core;
|
||||
|
||||
namespace GraphX.Controls.Models
|
||||
{
|
||||
public static class DispatcherHelper
|
||||
{
|
||||
public static async Task CheckBeginInvokeOnUi(Action action)
|
||||
{
|
||||
var dispatcher = Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher;
|
||||
|
||||
if (dispatcher.HasThreadAccess)
|
||||
action();
|
||||
else await dispatcher.RunAsync(CoreDispatcherPriority.Normal,
|
||||
() => action());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
using Windows.UI.Xaml.Input;
|
||||
|
||||
namespace GraphX.Controls.Models
|
||||
{
|
||||
public class EdgeSelectedEventArgs : System.EventArgs
|
||||
{
|
||||
public EdgeControl EdgeControl { get; set; }
|
||||
public PointerRoutedEventArgs Args { get; set; }
|
||||
|
||||
public EdgeSelectedEventArgs(EdgeControl ec, PointerRoutedEventArgs e)
|
||||
: base()
|
||||
{
|
||||
EdgeControl = ec;
|
||||
Args = e;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class EdgeLabelSelectedEventArgs : EdgeSelectedEventArgs
|
||||
{
|
||||
public IEdgeLabelControl EdgeLabelControl { get; set; }
|
||||
|
||||
|
||||
public EdgeLabelSelectedEventArgs(IEdgeLabelControl label, EdgeControl ec, PointerRoutedEventArgs e, object nu = null)
|
||||
: base(ec, e)
|
||||
{
|
||||
EdgeLabelControl = label;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using GraphX.PCL.Common.Interfaces;
|
||||
using GraphX.PCL.Common.Models;
|
||||
|
||||
namespace GraphX.Controls.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// WPF implementation of IFileServiceProvider
|
||||
/// </summary>
|
||||
public static class FileServiceProviderMETRO
|
||||
{
|
||||
/// <summary>
|
||||
/// Serializes data classes list to file
|
||||
/// </summary>
|
||||
/// <param name="filename">File name</param>
|
||||
/// <param name="modelsList">Data classes list</param>
|
||||
public static void SerializeDataToFile(string filename, List<GraphSerializationData> modelsList)
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Deserializes data classes list from file
|
||||
/// </summary>
|
||||
/// <param name="filename">File name</param>
|
||||
public static List<GraphSerializationData> DeserializeDataFromFile(string filename)
|
||||
{
|
||||
|
||||
return Deserialize(filename).Result;
|
||||
}
|
||||
|
||||
#pragma warning disable 1998
|
||||
private static async Task<List<GraphSerializationData>> Deserialize(string filename)
|
||||
#pragma warning restore 1998
|
||||
{
|
||||
return new List<GraphSerializationData>();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
namespace GraphX.Controls.Models
|
||||
{
|
||||
public class Keyboard
|
||||
{
|
||||
public static ModifierKeys Modifiers;
|
||||
}
|
||||
|
||||
public class ModifierKeys
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
namespace GraphX.Controls.Models
|
||||
{
|
||||
public class MouseButtonEventArgs
|
||||
{
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using Windows.UI.Xaml.Input;
|
||||
|
||||
namespace GraphX.Controls.Models
|
||||
{
|
||||
public sealed class VertexMovedEventArgs : System.EventArgs
|
||||
{
|
||||
public VertexControl VertexControl { get; private set; }
|
||||
public PointerRoutedEventArgs Args { get; private set; }
|
||||
|
||||
public VertexMovedEventArgs(VertexControl vc, PointerRoutedEventArgs e)
|
||||
{
|
||||
Args = e;
|
||||
VertexControl = vc;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using Windows.UI.Xaml.Input;
|
||||
|
||||
namespace GraphX.Controls.Models
|
||||
{
|
||||
public sealed class VertexSelectedEventArgs : System.EventArgs
|
||||
{
|
||||
public VertexControl VertexControl { get; private set; }
|
||||
public PointerRoutedEventArgs Args { get; private set; }
|
||||
|
||||
public VertexSelectedEventArgs(VertexControl vc, PointerRoutedEventArgs e)
|
||||
{
|
||||
VertexControl = vc;
|
||||
Args = e;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace FancyDevelopment.WinRtPluginSystem.MVVM
|
||||
{
|
||||
public abstract class ViewModelBase : INotifyPropertyChanged
|
||||
{
|
||||
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public ViewModelBase()
|
||||
{
|
||||
PropertyValues = new Dictionary<string, object>();
|
||||
PropertyTypes = new Dictionary<string, Type>();
|
||||
}
|
||||
|
||||
public IDictionary<string, object> PropertyValues { get; set; }
|
||||
|
||||
public IDictionary<string, Type> PropertyTypes { get; set; }
|
||||
|
||||
protected T GetPropertyValue<T>(string propertyName)
|
||||
{
|
||||
return (T)PropertyValues[propertyName];
|
||||
}
|
||||
|
||||
protected void SetPropertyValue<T>(string propertyName, T value)
|
||||
{
|
||||
if(!PropertyValues[propertyName].Equals(value))
|
||||
{
|
||||
PropertyValues[propertyName] = value;
|
||||
OnPropertyChanged(propertyName);
|
||||
}
|
||||
}
|
||||
|
||||
public object GetPropertyValue(string propertyName)
|
||||
{
|
||||
return PropertyValues[propertyName];
|
||||
}
|
||||
|
||||
public void SetPropertyValue(string propertyName, object value)
|
||||
{
|
||||
if(value.GetType() != PropertyTypes[propertyName])
|
||||
throw new InvalidOperationException("Wrong Type");
|
||||
|
||||
if (!PropertyValues[propertyName].Equals(value))
|
||||
{
|
||||
PropertyValues[propertyName] = value;
|
||||
OnPropertyChanged(propertyName);
|
||||
}
|
||||
}
|
||||
|
||||
protected void CreateProperty<T>(string propertyName)
|
||||
{
|
||||
PropertyTypes[propertyName] = typeof(T);
|
||||
PropertyValues[propertyName] = default(T);
|
||||
}
|
||||
|
||||
protected void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
if(PropertyChanged != null)
|
||||
{
|
||||
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
using Windows.UI.Xaml.Markup;
|
||||
|
||||
namespace FancyDevelopment.WinRtPluginSystem.MVVM
|
||||
{
|
||||
class ViewModelXamlMember<T> : IXamlMember where T : ViewModelBase, new ()
|
||||
{
|
||||
private readonly string _propertyName;
|
||||
private readonly ViewModelXamlType<T> _targetType;
|
||||
private readonly IXamlType _propertyType;
|
||||
|
||||
public ViewModelXamlMember(string propertyName, ViewModelXamlType<T> targetType, IXamlType propertyType)
|
||||
{
|
||||
_propertyName = propertyName;
|
||||
_targetType = targetType;
|
||||
_propertyType = propertyType;
|
||||
}
|
||||
|
||||
public object GetValue(object instance)
|
||||
{
|
||||
ViewModelBase viewModel = instance as ViewModelBase;
|
||||
|
||||
if(viewModel == null)
|
||||
throw new InvalidOperationException("Only view model types are supported");
|
||||
|
||||
return viewModel.GetPropertyValue(_propertyName);
|
||||
}
|
||||
|
||||
public bool IsAttachable
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public bool IsDependencyProperty
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return _propertyName; }
|
||||
}
|
||||
|
||||
public void SetValue(object instance, object value)
|
||||
{
|
||||
ViewModelBase viewModel = instance as ViewModelBase;
|
||||
|
||||
if (viewModel == null)
|
||||
throw new InvalidOperationException("Only view model types are supported");
|
||||
|
||||
viewModel.SetPropertyValue(_propertyName, value);
|
||||
}
|
||||
|
||||
public IXamlType TargetType
|
||||
{
|
||||
get { return _targetType; }
|
||||
}
|
||||
|
||||
public IXamlType Type
|
||||
{
|
||||
get { return _propertyType; }
|
||||
}
|
||||
}
|
||||
}
|