Added save chart to image example
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||
<HasSharedItems>true</HasSharedItems>
|
||||
<SharedGUID>31408948-1083-4fd4-9fda-fc2dfe5b0360</SharedGUID>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration">
|
||||
<Import_RootNamespace>ExportElementToImage</Import_RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>31408948-1083-4fd4-9fda-fc2dfe5b0360</ProjectGuid>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
|
||||
<PropertyGroup />
|
||||
<Import Project="ExportElementToImage.Shared.projitems" Label="Shared" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
|
||||
</Project>
|
|
@ -0,0 +1,7 @@
|
|||
<Application
|
||||
x:Class="ExportElementToImage.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:ExportElementToImage">
|
||||
|
||||
</Application>
|
|
@ -0,0 +1,131 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.ApplicationModel.Activation;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Media.Animation;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=391641
|
||||
|
||||
namespace ExportElementToImage
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides application-specific behavior to supplement the default Application class.
|
||||
/// </summary>
|
||||
public sealed partial class App : Application
|
||||
{
|
||||
private TransitionCollection transitions;
|
||||
|
||||
/// <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 += this.OnSuspending;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when the application is launched normally by the end user. Other entry points
|
||||
/// will be used when the application is launched to open a specific file, to display
|
||||
/// search results, and so forth.
|
||||
/// </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();
|
||||
|
||||
// TODO: change this value to a cache size that is appropriate for your application
|
||||
rootFrame.CacheSize = 1;
|
||||
|
||||
if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
|
||||
{
|
||||
// TODO: Load state from previously suspended application
|
||||
}
|
||||
|
||||
// Place the frame in the current Window
|
||||
Window.Current.Content = rootFrame;
|
||||
}
|
||||
|
||||
if (rootFrame.Content == null)
|
||||
{
|
||||
// Removes the turnstile navigation for startup.
|
||||
if (rootFrame.ContentTransitions != null)
|
||||
{
|
||||
this.transitions = new TransitionCollection();
|
||||
foreach (var c in rootFrame.ContentTransitions)
|
||||
{
|
||||
this.transitions.Add(c);
|
||||
}
|
||||
}
|
||||
|
||||
rootFrame.ContentTransitions = null;
|
||||
rootFrame.Navigated += this.RootFrame_FirstNavigated;
|
||||
|
||||
// When the navigation stack isn't restored navigate to the first page,
|
||||
// configuring the new page by passing required information as a navigation
|
||||
// parameter
|
||||
if (!rootFrame.Navigate(typeof(MainPage), e.Arguments))
|
||||
{
|
||||
throw new Exception("Failed to create initial page");
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure the current window is active
|
||||
Window.Current.Activate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restores the content transitions after the app has launched.
|
||||
/// </summary>
|
||||
/// <param name="sender">The object where the handler is attached.</param>
|
||||
/// <param name="e">Details about the navigation event.</param>
|
||||
private void RootFrame_FirstNavigated(object sender, NavigationEventArgs e)
|
||||
{
|
||||
var rootFrame = sender as Frame;
|
||||
rootFrame.ContentTransitions = this.transitions ?? new TransitionCollection() { new NavigationThemeTransition() };
|
||||
rootFrame.Navigated -= this.RootFrame_FirstNavigated;
|
||||
}
|
||||
|
||||
/// <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();
|
||||
}
|
||||
}
|
||||
}
|
Двоичные данные
Chart/SaveToImage/ExportElementToImage.WindowsPhone/Assets/Logo.scale-240.png
Normal file
После Ширина: | Высота: | Размер: 2.5 KiB |
Двоичные данные
Chart/SaveToImage/ExportElementToImage.WindowsPhone/Assets/SmallLogo.scale-240.png
Normal file
После Ширина: | Высота: | Размер: 753 B |
Двоичные данные
Chart/SaveToImage/ExportElementToImage.WindowsPhone/Assets/SplashScreen.scale-240.png
Normal file
После Ширина: | Высота: | Размер: 14 KiB |
Двоичные данные
Chart/SaveToImage/ExportElementToImage.WindowsPhone/Assets/Square71x71Logo.scale-240.png
Normal file
После Ширина: | Высота: | Размер: 1.1 KiB |
Двоичные данные
Chart/SaveToImage/ExportElementToImage.WindowsPhone/Assets/StoreLogo.scale-240.png
Normal file
После Ширина: | Высота: | Размер: 2.1 KiB |
Двоичные данные
Chart/SaveToImage/ExportElementToImage.WindowsPhone/Assets/WideLogo.scale-240.png
Normal file
После Ширина: | Высота: | Размер: 4.4 KiB |
|
@ -0,0 +1,135 @@
|
|||
<?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>{3E1B9DC3-D110-4047-BE11-74712583DEE3}</ProjectGuid>
|
||||
<OutputType>AppContainerExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ExportElementToImage</RootNamespace>
|
||||
<AssemblyName>ExportElementToImage.WindowsPhone</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<TargetPlatformVersion>8.1</TargetPlatformVersion>
|
||||
<MinimumVisualStudioVersion>12</MinimumVisualStudioVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{76F1466A-8B6D-4E39-A767-685A06062A39};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<SynthesizeLinkMetadata>true</SynthesizeLinkMetadata>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP</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_PHONE_APP</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_PHONE_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_PHONE_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|x86'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_PHONE_APP</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;WINDOWS_PHONE_APP</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 -->
|
||||
<SDKReference Include="Telerik UI For Windows Universal, Version=2015.1.317.45">
|
||||
<Name>Telerik UI For Windows Phone 8.1</Name>
|
||||
</SDKReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\Logo.scale-240.png" />
|
||||
<Content Include="Assets\SmallLogo.scale-240.png" />
|
||||
<Content Include="Assets\SplashScreen.scale-240.png" />
|
||||
<Content Include="Assets\Square71x71Logo.scale-240.png" />
|
||||
<Content Include="Assets\StoreLogo.scale-240.png" />
|
||||
<Content Include="Assets\WideLogo.scale-240.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '12.0' ">
|
||||
<VisualStudioVersion>12.0</VisualStudioVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(TargetPlatformIdentifier)' == '' ">
|
||||
<TargetPlatformIdentifier>WindowsPhoneApp</TargetPlatformIdentifier>
|
||||
</PropertyGroup>
|
||||
<Import Project="..\ExportElementToImage.Shared\ExportElementToImage.Shared.projitems" Label="Shared" />
|
||||
<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.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
|
@ -0,0 +1,28 @@
|
|||
<Page
|
||||
x:Class="ExportElementToImage.MainPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:ExportElementToImage"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:telerikChart="using:Telerik.UI.Xaml.Controls.Chart"
|
||||
mc:Ignorable="d"
|
||||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Button Content="Save Chart as Image" Click="Button_Click"/>
|
||||
<telerikChart:RadCartesianChart Grid.Row="1" x:Name="radChart">
|
||||
<telerikChart:RadCartesianChart.HorizontalAxis>
|
||||
<telerikChart:CategoricalAxis/>
|
||||
</telerikChart:RadCartesianChart.HorizontalAxis>
|
||||
<telerikChart:RadCartesianChart.VerticalAxis>
|
||||
<telerikChart:LinearAxis/>
|
||||
</telerikChart:RadCartesianChart.VerticalAxis>
|
||||
<telerikChart:LineSeries ItemsSource="{Binding}"/>
|
||||
</telerikChart:RadCartesianChart>
|
||||
</Grid>
|
||||
</Page>
|
|
@ -0,0 +1,89 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.Graphics.Imaging;
|
||||
using Windows.Storage;
|
||||
using Windows.Storage.Pickers;
|
||||
using Windows.Storage.Streams;
|
||||
using Windows.UI.Popups;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Media.Imaging;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=391641
|
||||
|
||||
namespace ExportElementToImage
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class MainPage : Page
|
||||
{
|
||||
public MainPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
this.NavigationCacheMode = NavigationCacheMode.Required;
|
||||
|
||||
this.radChart.DataContext = new double[] { 20, 30, 50, 10, 60, 40, 20, 80 };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when this page is about to be displayed in a Frame.
|
||||
/// </summary>
|
||||
/// <param name="e">Event data that describes how this page was reached.
|
||||
/// This parameter is typically used to configure the page.</param>
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
// TODO: Prepare page for display here.
|
||||
|
||||
// TODO: If your application contains multiple pages, ensure that you are
|
||||
// handling the hardware Back button by registering for the
|
||||
// Windows.Phone.UI.Input.HardwareButtons.BackPressed event.
|
||||
// If you are using the NavigationHelper provided by some templates,
|
||||
// this event is handled for you.
|
||||
}
|
||||
|
||||
private async void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
StorageFolder picsFolder = KnownFolders.SavedPictures;
|
||||
StorageFile file = await picsFolder.CreateFileAsync("savedChart.jpg", CreationCollisionOption.GenerateUniqueName);
|
||||
|
||||
await this.SaveVisualElementToFile(this.radChart, file);
|
||||
|
||||
var cd = new MessageDialog(string.Format("Image saved in Saved Pictures folder as {0}", file.Name));
|
||||
|
||||
await cd.ShowAsync();
|
||||
}
|
||||
|
||||
private async Task SaveVisualElementToFile(FrameworkElement element, StorageFile file)
|
||||
{
|
||||
var renderTargetBitmap = new RenderTargetBitmap();
|
||||
await renderTargetBitmap.RenderAsync(element, (int)element.ActualWidth, (int)element.ActualHeight);
|
||||
var pixels = await renderTargetBitmap.GetPixelsAsync();
|
||||
|
||||
using (IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.ReadWrite))
|
||||
{
|
||||
var encoder = await
|
||||
BitmapEncoder.CreateAsync(BitmapEncoder.JpegEncoderId, stream);
|
||||
byte[] bytes = pixels.ToArray();
|
||||
encoder.SetPixelData(BitmapPixelFormat.Bgra8,
|
||||
BitmapAlphaMode.Ignore,
|
||||
(uint)element.ActualWidth, (uint)element.ActualHeight,
|
||||
96, 96, bytes);
|
||||
|
||||
await encoder.FlushAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
<?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" xmlns:m3="http://schemas.microsoft.com/appx/2014/manifest" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest">
|
||||
<Identity Name="64b30930-20c1-409c-9bb8-80a17ae74a52" Publisher="CN=konov" Version="1.0.0.0" />
|
||||
<mp:PhoneIdentity PhoneProductId="64b30930-20c1-409c-9bb8-80a17ae74a52" PhonePublisherId="00000000-0000-0000-0000-000000000000" />
|
||||
<Properties>
|
||||
<DisplayName>ExportElementToImage.WindowsPhone</DisplayName>
|
||||
<PublisherDisplayName>konov</PublisherDisplayName>
|
||||
<Logo>Assets\StoreLogo.png</Logo>
|
||||
</Properties>
|
||||
<Prerequisites>
|
||||
<OSMinVersion>6.3.1</OSMinVersion>
|
||||
<OSMaxVersionTested>6.3.1</OSMaxVersionTested>
|
||||
</Prerequisites>
|
||||
<Resources>
|
||||
<Resource Language="x-generate" />
|
||||
</Resources>
|
||||
<Applications>
|
||||
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="ExportElementToImage.WindowsPhone.App">
|
||||
<m3:VisualElements DisplayName="ExportElementToImage.WindowsPhone" Square150x150Logo="Assets\Logo.png" Square44x44Logo="Assets\SmallLogo.png" Description="ExportElementToImage.WindowsPhone" ForegroundText="light" BackgroundColor="transparent">
|
||||
<m3:DefaultTile Wide310x150Logo="Assets\WideLogo.png" Square71x71Logo="Assets\Square71x71Logo.png">
|
||||
</m3:DefaultTile>
|
||||
<m3:SplashScreen Image="Assets\SplashScreen.png" />
|
||||
</m3:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
<Capabilities>
|
||||
<Capability Name="internetClientServer" />
|
||||
<Capability Name="picturesLibrary" />
|
||||
</Capabilities>
|
||||
</Package>
|
|
@ -0,0 +1,29 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ExportElementToImage.WindowsPhone")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ExportElementToImage.WindowsPhone")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: ComVisible(false)]
|
|
@ -0,0 +1,84 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.31101.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExportElementToImage", "ExportElementToImage\ExportElementToImage.csproj", "{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ExportElementToImage", "ExportElementToImage", "{8F5F3A4E-D204-4E33-883E-CB69548F522A}"
|
||||
EndProject
|
||||
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ExportElementToImage.Shared", "ExportElementToImage.Shared\ExportElementToImage.Shared.shproj", "{31408948-1083-4FD4-9FDA-FC2DFE5B0360}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExportElementToImage.WindowsPhone", "ExportElementToImage.WindowsPhone\ExportElementToImage.WindowsPhone.csproj", "{3E1B9DC3-D110-4047-BE11-74712583DEE3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SharedMSBuildProjectFiles) = preSolution
|
||||
ExportElementToImage.Shared\ExportElementToImage.Shared.projitems*{3e1b9dc3-d110-4047-be11-74712583dee3}*SharedItemsImports = 4
|
||||
ExportElementToImage.Shared\ExportElementToImage.Shared.projitems*{31408948-1083-4fd4-9fda-fc2dfe5b0360}*SharedItemsImports = 13
|
||||
ExportElementToImage.Shared\ExportElementToImage.Shared.projitems*{ece8862c-0dae-462b-9e96-cf1154fffdc4}*SharedItemsImports = 4
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Debug|ARM = Debug|ARM
|
||||
Debug|x64 = Debug|x64
|
||||
Debug|x86 = Debug|x86
|
||||
Release|Any CPU = Release|Any CPU
|
||||
Release|ARM = Release|ARM
|
||||
Release|x64 = Release|x64
|
||||
Release|x86 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Debug|x64.Build.0 = Debug|x64
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Debug|x64.Deploy.0 = Debug|x64
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Debug|x86.Build.0 = Debug|x86
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Debug|x86.Deploy.0 = Debug|x86
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Release|ARM.Build.0 = Release|ARM
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Release|ARM.Deploy.0 = Release|ARM
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Release|x64.ActiveCfg = Release|x64
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Release|x64.Build.0 = Release|x64
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Release|x64.Deploy.0 = Release|x64
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Release|x86.ActiveCfg = Release|x86
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Release|x86.Build.0 = Release|x86
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}.Release|x86.Deploy.0 = Release|x86
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Debug|ARM.Build.0 = Debug|ARM
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Debug|ARM.Deploy.0 = Debug|ARM
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Debug|x86.Build.0 = Debug|x86
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Debug|x86.Deploy.0 = Debug|x86
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Release|Any CPU.Deploy.0 = Release|Any CPU
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Release|ARM.ActiveCfg = Release|ARM
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Release|ARM.Build.0 = Release|ARM
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Release|ARM.Deploy.0 = Release|ARM
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Release|x86.ActiveCfg = Release|x86
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Release|x86.Build.0 = Release|x86
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3}.Release|x86.Deploy.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4} = {8F5F3A4E-D204-4E33-883E-CB69548F522A}
|
||||
{31408948-1083-4FD4-9FDA-FC2DFE5B0360} = {8F5F3A4E-D204-4E33-883E-CB69548F522A}
|
||||
{3E1B9DC3-D110-4047-BE11-74712583DEE3} = {8F5F3A4E-D204-4E33-883E-CB69548F522A}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,7 @@
|
|||
<Application
|
||||
x:Class="ExportElementToImage.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:ExportElementToImage">
|
||||
|
||||
</Application>
|
|
@ -0,0 +1,109 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.ApplicationModel.Activation;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The Blank Application template is documented at http://go.microsoft.com/fwlink/?LinkId=234227
|
||||
|
||||
namespace ExportElementToImage
|
||||
{
|
||||
/// <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();
|
||||
// Set the default language
|
||||
rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0];
|
||||
|
||||
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 (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();
|
||||
}
|
||||
}
|
||||
}
|
После Ширина: | Высота: | Размер: 801 B |
После Ширина: | Высота: | Размер: 329 B |
Двоичные данные
Chart/SaveToImage/ExportElementToImage/Assets/SplashScreen.scale-100.png
Normal file
После Ширина: | Высота: | Размер: 2.1 KiB |
После Ширина: | Высота: | Размер: 429 B |
|
@ -0,0 +1,153 @@
|
|||
<?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>{ECE8862C-0DAE-462B-9E96-CF1154FFFDC4}</ProjectGuid>
|
||||
<OutputType>AppContainerExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ExportElementToImage</RootNamespace>
|
||||
<AssemblyName>ExportElementToImage</AssemblyName>
|
||||
<DefaultLanguage>en-US</DefaultLanguage>
|
||||
<TargetPlatformVersion>8.1</TargetPlatformVersion>
|
||||
<MinimumVisualStudioVersion>12</MinimumVisualStudioVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<PackageCertificateKeyFile>ExportElementToImage_TemporaryKey.pfx</PackageCertificateKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_APP</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_APP</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'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x86\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_APP</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;WINDOWS_APP</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 -->
|
||||
<SDKReference Include="Telerik UI For Windows Universal, Version=2015.1.317.45">
|
||||
<Name>Telerik UI For Windows Universal</Name>
|
||||
</SDKReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainPage.xaml.cs">
|
||||
<DependentUpon>MainPage.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppxManifest Include="Package.appxmanifest">
|
||||
<SubType>Designer</SubType>
|
||||
</AppxManifest>
|
||||
<None Include="ExportElementToImage_TemporaryKey.pfx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Assets\Logo.scale-100.png" />
|
||||
<Content Include="Assets\SmallLogo.scale-100.png" />
|
||||
<Content Include="Assets\SplashScreen.scale-100.png" />
|
||||
<Content Include="Assets\StoreLogo.scale-100.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainPage.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<Import Project="..\ExportElementToImage.Shared\ExportElementToImage.Shared.projitems" Label="Shared" />
|
||||
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '12.0' ">
|
||||
<VisualStudioVersion>12.0</VisualStudioVersion>
|
||||
</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.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
Двоичные данные
Chart/SaveToImage/ExportElementToImage/ExportElementToImage_TemporaryKey.pfx
Normal file
|
@ -0,0 +1,27 @@
|
|||
<Page
|
||||
x:Class="ExportElementToImage.MainPage"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="using:ExportElementToImage"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:telerikChart="using:Telerik.UI.Xaml.Controls.Chart"
|
||||
mc:Ignorable="d">
|
||||
|
||||
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50"/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Button Content="Save Chart as Image" Click="Button_Click"/>
|
||||
<telerikChart:RadCartesianChart Grid.Row="1" x:Name="radChart">
|
||||
<telerikChart:RadCartesianChart.HorizontalAxis>
|
||||
<telerikChart:CategoricalAxis/>
|
||||
</telerikChart:RadCartesianChart.HorizontalAxis>
|
||||
<telerikChart:RadCartesianChart.VerticalAxis>
|
||||
<telerikChart:LinearAxis/>
|
||||
</telerikChart:RadCartesianChart.VerticalAxis>
|
||||
<telerikChart:LineSeries ItemsSource="{Binding}"/>
|
||||
</telerikChart:RadCartesianChart>
|
||||
</Grid>
|
||||
</Page>
|
|
@ -0,0 +1,75 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using System.Threading.Tasks;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
using Windows.Graphics.Imaging;
|
||||
using Windows.Storage;
|
||||
using Windows.Storage.Pickers;
|
||||
using Windows.Storage.Streams;
|
||||
using Windows.UI.Popups;
|
||||
using Windows.UI.Xaml;
|
||||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.UI.Xaml.Controls.Primitives;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using Windows.UI.Xaml.Input;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.UI.Xaml.Media.Imaging;
|
||||
using Windows.UI.Xaml.Navigation;
|
||||
|
||||
// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238
|
||||
|
||||
namespace ExportElementToImage
|
||||
{
|
||||
/// <summary>
|
||||
/// An empty page that can be used on its own or navigated to within a Frame.
|
||||
/// </summary>
|
||||
public sealed partial class MainPage : Page
|
||||
{
|
||||
public MainPage()
|
||||
{
|
||||
this.InitializeComponent();
|
||||
|
||||
this.radChart.DataContext = new double[] { 20, 30, 50, 10, 60, 40, 20, 80 };
|
||||
}
|
||||
|
||||
private async void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
FileSavePicker savePicker = new FileSavePicker();
|
||||
savePicker.SuggestedFileName = "SavedImage.jpg";
|
||||
savePicker.FileTypeChoices.Add("Image", new List<string>() { ".jpg" });
|
||||
|
||||
//Get the file the user selected
|
||||
StorageFile saveFile = await savePicker.PickSaveFileAsync();
|
||||
|
||||
await this.SaveVisualElementToFile(this.radChart, saveFile);
|
||||
|
||||
var cd = new MessageDialog(string.Format("Image saved in Saved Pictures folder as {0}", saveFile.Name));
|
||||
|
||||
await cd.ShowAsync();
|
||||
}
|
||||
|
||||
private async Task SaveVisualElementToFile(FrameworkElement element, StorageFile file)
|
||||
{
|
||||
var renderTargetBitmap = new RenderTargetBitmap();
|
||||
await renderTargetBitmap.RenderAsync(element, (int)element.ActualWidth, (int)element.ActualHeight);
|
||||
var pixels = await renderTargetBitmap.GetPixelsAsync();
|
||||
|
||||
using (IRandomAccessStream stream = await file.OpenAsync(FileAccessMode.ReadWrite))
|
||||
{
|
||||
var encoder = await
|
||||
BitmapEncoder.CreateAsync(BitmapEncoder.JpegEncoderId, stream);
|
||||
byte[] bytes = pixels.ToArray();
|
||||
encoder.SetPixelData(BitmapPixelFormat.Bgra8,
|
||||
BitmapAlphaMode.Ignore,
|
||||
(uint)element.ActualWidth, (uint)element.ActualHeight,
|
||||
96, 96, bytes);
|
||||
|
||||
await encoder.FlushAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<?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="4c0aba8b-e7f2-4f37-ac00-2e0e2181bb2c"
|
||||
Publisher="CN=konov"
|
||||
Version="1.0.0.0" />
|
||||
|
||||
<Properties>
|
||||
<DisplayName>ExportElementToImage</DisplayName>
|
||||
<PublisherDisplayName>konov</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="ExportElementToImage.App">
|
||||
<m2:VisualElements
|
||||
DisplayName="ExportElementToImage"
|
||||
Square150x150Logo="Assets\Logo.png"
|
||||
Square30x30Logo="Assets\SmallLogo.png"
|
||||
Description="ExportElementToImage"
|
||||
ForegroundText="light"
|
||||
BackgroundColor="#464646">
|
||||
<m2:SplashScreen Image="Assets\SplashScreen.png" />
|
||||
</m2:VisualElements>
|
||||
</Application>
|
||||
</Applications>
|
||||
<Capabilities>
|
||||
<Capability Name="internetClient" />
|
||||
</Capabilities>
|
||||
</Package>
|
|
@ -0,0 +1,29 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ExportElementToImage")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ExportElementToImage")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: ComVisible(false)]
|