Rar! ϐs
ft g ; ; OVE0B RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\App.xaml I`
t j v v E0E RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\App.xaml.cs Vusing System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
namespace RadSpreadsheetPdfFontsExportDemo
{
public partial class App : Application
{
public App()
{
this.Startup += this.Application_Startup;
this.Exit += this.Application_Exit;
this.UnhandledException += this.Application_UnhandledException;
InitializeComponent();
}
private void Application_Startup(object sender, StartupEventArgs e)
{
this.RootVisual = new MainPage();
}
private void Application_Exit(object sender, EventArgs e)
{
}
private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
{
// If the app is running outside of the debugger then report the exception using
// the browser's exception mechanism. On IE this will display it a yellow alert
// icon in the status bar and Firefox will display a script error.
if (!System.Diagnostics.Debugger.IsAttached)
{
// NOTE: This will allow the application to continue running after an exception has been thrown
// but not handled.
// For production applications this error handling should be replaced with something that will
// report the error to the website and stop the application.
e.Handled = true;
Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });
}
}
private void ReportErrorToDOM(ApplicationUnhandledExceptionEventArgs e)
{
try
{
string errorMsg = e.ExceptionObject.Message + e.ExceptionObject.StackTrace;
errorMsg = errorMsg.Replace('"', '\'').Replace("\r\n", @"\n");
System.Windows.Browser.HtmlPage.Window.Eval("throw new Error(\"Unhandled Error in Silverlight Application " + errorMsg + "\");");
}
catch (Exception)
{
}
}
}
}
t w ޕzE0R RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\BeginEndUpdateCounter.cs dCusing System;
namespace RadSpreadsheetPdfFontsExportDemo
{
public class BeginEndUpdateCounter
{
private int count = 0;
private bool shouldExecuteAction;
private readonly Action onUpdatesFinished;
public BeginEndUpdateCounter(Action onUpdatesFinished)
{
this.shouldExecuteAction = false;
this.onUpdatesFinished = onUpdatesFinished;
}
public void BeginUpdate()
{
this.count++;
}
public void EndUpdate()
{
this.count--;
this.ValidateCount();
this.ExecuteAction();
}
public void ResumeActionExecution()
{
this.shouldExecuteAction = true;
this.ExecuteAction();
}
public void PauseActionExecution()
{
this.shouldExecuteAction = false;
}
private void ExecuteAction()
{
if (this.shouldExecuteAction && this.count == 0)
{
this.onUpdatesFinished();
this.shouldExecuteAction = false;
}
}
private void ValidateCount()
{
if (this.count < 0)
{
throw new InvalidOperationException("Cannot call RemoveFromCount method more times compared to AddToCount method!");
}
}
}
}
at l a a r;mE0G RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\MainPage.xaml
t o ;7E0J RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\MainPage.xaml.cs 4b,using RadSpreadsheetPdfFontsExportDemo.FontServiceReference;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Spreadsheet;
using Telerik.Windows.Documents.Fixed.Model.Fonts;
using Telerik.Windows.Documents.Spreadsheet.FormatProviders.Pdf;
using Telerik.Windows.Documents.Spreadsheet.Model;
using Telerik.Windows.Documents.Spreadsheet.Model.Protection;
namespace RadSpreadsheetPdfFontsExportDemo
{
public partial class MainPage : UserControl
{
private SaveFileDialog saveFileDialog;
private readonly FontServiceClient client;
private readonly BeginEndUpdateCounter pdfExportCounter;
public MainPage()
{
StyleManager.ApplicationTheme = new Windows8Theme();
InitializeComponent();
this.pdfExportCounter = new BeginEndUpdateCounter(this.ExportPdf);
this.client = new FontServiceClient();
this.client.GetFontDataCompleted += GetFontDataCompleted;
this.GenerateSampleWorksheet();
}
private Worksheet Worksheet
{
get
{
return this.radSpreadsheet.ActiveWorksheet;
}
}
private void GenerateSampleWorksheet()
{
int currentRow = 0;
foreach (string fontFamilyName in this.GetSpreadsheetFontFamilyNames(10))
{
this.Worksheet.Cells[new CellIndex(currentRow, 0)].SetValue(fontFamilyName);
this.SetCellValue("expotación", new CellIndex(currentRow, 1), fontFamilyName, false, false);
currentRow++;
}
this.Worksheet.Columns[this.Worksheet.UsedCellRange].AutoFitWidth();
this.Worksheet.Protect("protection password", WorksheetProtectionOptions.Default);
}
private IEnumerable GetSpreadsheetFontFamilyNames(int count)
{
int currentIndex = 0;
foreach (FontFamilyInfo fontFamilyInfo in this.radSpreadsheet.FontsProvider.RegisteredFonts)
{
if (currentIndex++ >= count)
{
break;
}
yield return fontFamilyInfo.FontFamily.ToString();
}
}
private void SetCellValue(string value, CellIndex cellIndex, string fontFamilyName, bool isItalic, bool isBold)
{
CellSelection cell = this.Worksheet.Cells[cellIndex];
cell.SetValue(value);
cell.SetFontFamily(new ThemableFontFamily(fontFamilyName));
cell.SetIsItalic(isItalic);
cell.SetIsBold(isBold);
}
private void GetFontDataCompleted(object sender, GetFontDataCompletedEventArgs e)
{
this.pdfExportCounter.EndUpdate();
System.Diagnostics.Debug.WriteLine("updated font:{0}", e.Result.FontFamilyName);
if (e.Error == null && e.Result.IsValid)
{
FontServiceFontData result = e.Result;
FontFamily fontFamily = new FontFamily(result.FontFamilyName);
FontStyle fontStyle = GetFontStyle(result.IsItalic);
FontWeight fontWeight = GetFontWeight(result.IsBold);
FontsRepository.RegisterFont(fontFamily, fontStyle, fontWeight, result.Bytes);
}
}
private static FontStyle GetFontStyle(bool isItalic)
{
return isItalic ? FontStyles.Italic : FontStyles.Normal;
}
private static FontWeight GetFontWeight(bool isBold)
{
return isBold ? FontWeights.Bold : FontWeights.Normal;
}
private void ExportPdfClick(object sender, RoutedEventArgs e)
{
this.saveFileDialog = new SaveFileDialog();
this.saveFileDialog.Filter = "Pdf documents|*.pdf";
if (this.saveFileDialog.ShowDialog() == true)
{
this.pdfExportCounter.PauseActionExecution();
this.RegisterMissingPdfFontsBeforeExport();
this.pdfExportCounter.ResumeActionExecution();
}
}
private void ExportPdf()
{
using (Stream stream = this.saveFileDialog.OpenFile())
{
PdfFormatProvider formatProvider = new PdfFormatProvider();
formatProvider.Export(this.radSpreadsheet.Workbook, stream);
}
}
private void RegisterMissingPdfFontsBeforeExport()
{
CellRange usedCellRange = this.Worksheet.UsedCellRange;
for(int row = 0; row <= usedCellRange.ToIndex.RowIndex; row++)
{
for (int column = 0; column <= usedCellRange.ToIndex.ColumnIndex; column++)
{
CellSelection cell = this.Worksheet.Cells[new CellIndex(row, column)];
string fontFamilyName = cell.GetFontFamily().Value.GetActualValue(this.Worksheet.Workbook.Theme).ToString();
bool isItalic = cell.GetIsItalic().Value;
bool isBold = cell.GetIsBold().Value;
this.RegisterFont(fontFamilyName, isItalic, isBold);
}
}
}
private void RegisterFont(string fontFamilyName, bool isItalic, bool isBold)
{
FontBase font;
if (!FontsRepository.TryCreateFont(new FontFamily(fontFamilyName), GetFontStyle(isItalic), GetFontWeight(isBold), out font))
{
this.pdfExportCounter.BeginUpdate();
this.client.GetFontDataAsync(fontFamilyName, isItalic, isBold);
}
}
private void RadSpreadsheetMessageShowing(object sender, MessageShowingEventArgs e)
{
string protectionError = LocalizationManager.GetString("Spreadsheet_ProtectedWorksheet_Error");
if (e.Content.Equals(protectionError, StringComparison.CurrentCulture))
{
e.IsHandled = true;
}
}
}
}
Ot y E0T RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\Properties\AppManifest.xml _
t y D
gE0T RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\Properties\AssemblyInfo.cs wyusing 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("RadSpreadsheetPdfFontsExportDemo")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RadSpreadsheetPdfFontsExportDemo")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4e345244-c59c-49e9-a9fd-22223270716f")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
wt ,% ,% WE0a RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\RadSpreadsheetPdfFontsExportDemo.csproj 9
Debug
AnyCPU
8.0.50727
2.0
{4E345244-C59C-49E9-A9FD-22223270716F}
{A1591282-1198-4647-A2B1-27E5FF5F6F3B};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
Library
Properties
RadSpreadsheetPdfFontsExportDemo
RadSpreadsheetPdfFontsExportDemo
Silverlight
v5.0
$(TargetFrameworkVersion)
true
true
true
RadSpreadsheetPdfFontsExportDemo.xap
Properties\AppManifest.xml
RadSpreadsheetPdfFontsExportDemo.App
RadSpreadsheetPdfFontsExportDemoTestPage.html
true
true
false
Properties\OutOfBrowserSettings.xml
false
true
v3.5
true
full
false
Bin\Debug
DEBUG;TRACE;SILVERLIGHT
true
true
prompt
4
pdbonly
true
Bin\Release
TRACE;SILVERLIGHT
true
true
prompt
4
$(TargetFrameworkDirectory)System.Core.dll
..\..\..\..\..\Work\WPF_Scrum\Current\Binaries\Silverlight\Telerik.Windows.Controls.dll
..\..\..\..\..\Work\WPF_Scrum\Current\Binaries\Silverlight\Telerik.Windows.Controls.GridView.dll
..\..\..\..\..\Work\WPF_Scrum\Current\Binaries\Silverlight\Telerik.Windows.Controls.Input.dll
..\..\..\..\..\Work\WPF_Scrum\Current\Binaries\Silverlight\Telerik.Windows.Controls.Navigation.dll
..\..\..\..\..\Work\WPF_Scrum\Current\Binaries\Silverlight\Telerik.Windows.Controls.Spreadsheet.dll
..\..\..\..\..\Work\WPF_Scrum\Current\Binaries\Silverlight\Telerik.Windows.Data.dll
..\..\..\..\..\Work\WPF_Scrum\Current\Binaries\Silverlight\Telerik.Windows.Documents.Core.dll
False
..\..\..\..\..\Work\WPF_Scrum\Current\Binaries\Silverlight\Telerik.Windows.Documents.Fixed.dll
..\..\..\..\..\Work\WPF_Scrum\Current\Binaries\Silverlight\Telerik.Windows.Documents.Spreadsheet.dll
..\..\..\..\..\Work\WPF_Scrum\Current\Binaries\Silverlight\Telerik.Windows.Documents.Spreadsheet.FormatProviders.Pdf.dll
..\..\..\..\..\Work\WPF_Scrum\Current\Binaries\Silverlight\Telerik.Windows.Maths.dll
..\..\..\..\..\Work\WPF_Scrum\Current\Binaries\Silverlight\Telerik.Windows.Themes.Windows8.dll
App.xaml
MainPage.xaml
True
True
Reference.svcmap
Designer
MSBuild:Compile
Designer
MSBuild:Compile
Designer
Designer
Designer
Reference.svcmap
WCF Proxy Generator
Reference.cs
^t v v h.WE0f RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\RadSpreadsheetPdfFontsExportDemo.csproj.user 9
DynamicPage
True
False
False
True
True
ct ) ) bM^E0w RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\Service References\FontServiceReference\configuration.svcinfo :G_
mt _ _ ^E0y RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\Service References\FontServiceReference\configuration91.svcinfo :G_
CustomBinding_FontService
System.ServiceModel.Configuration.BinaryMessageEncodingElement
64
16
2048
System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement
0
0
0
0
0
None
System.ServiceModel.Configuration.HttpTransportElement
False
524288
2147483647
False
00:00:00
Anonymous
False
True
StrongWildcard
True
2147483647
0
System.ServiceModel.Configuration.HttpMessageHandlerFactoryElement
(Collection)
Anonymous
Buffered
False
True
System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement
Never
TransportSelected
(Collection)
System.ServiceModel.Configuration.WebSocketTransportSettingsElement
Never
False
00:00:00
False
0
../FontService.svc
customBinding
CustomBinding_FontService
FontServiceReference.FontService
System.ServiceModel.Configuration.AddressHeaderCollectionElement
<Header />
System.ServiceModel.Configuration.IdentityElement
System.ServiceModel.Configuration.UserPrincipalNameElement
System.ServiceModel.Configuration.ServicePrincipalNameElement
System.ServiceModel.Configuration.DnsElement
System.ServiceModel.Configuration.RsaElement
System.ServiceModel.Configuration.CertificateElement
System.ServiceModel.Configuration.CertificateReferenceElement
My
LocalMachine
FindBySubjectDistinguishedName
False
CustomBinding_FontService
$t q q .^E0s RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\Service References\FontServiceReference\FontService.disco :G_
Ift rp^E0r RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\Service References\FontServiceReference\FontService.wsdl :G_
yt L^E0q RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\Service References\FontServiceReference\FontService.xsd :G_
t
4^E0s RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\Service References\FontServiceReference\FontService1.wsdl :G_
http://localhost:49533/FontService.svc
t ^E0r RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\Service References\FontServiceReference\FontService1.xsd :G_
>t 'б^E0r RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\Service References\FontServiceReference\FontService2.xsd :G_
t 0^E0 RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\Service References\FontServiceReference\RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontServiceFontData.datasource E
RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontServiceFontData, Service References.FontServiceReference.Reference.cs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
t B B -^E0n RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\Service References\FontServiceReference\Reference.cs Yw//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.18449
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
//
// This code was auto-generated by Microsoft.Silverlight.ServiceReference, version 5.0.61118.0
//
namespace RadSpreadsheetPdfFontsExportDemo.FontServiceReference {
using System.Runtime.Serialization;
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
[System.Runtime.Serialization.DataContractAttribute(Name="FontService.FontData", Namespace="http://schemas.datacontract.org/2004/07/RadSpreadsheetPdfFontsExportDemo.Web")]
public partial class FontServiceFontData : object, System.ComponentModel.INotifyPropertyChanged {
private byte[] BytesField;
private string FontFamilyNameField;
private bool IsBoldField;
private bool IsItalicField;
private bool IsValidField;
[System.Runtime.Serialization.DataMemberAttribute()]
public byte[] Bytes {
get {
return this.BytesField;
}
set {
if ((object.ReferenceEquals(this.BytesField, value) != true)) {
this.BytesField = value;
this.RaisePropertyChanged("Bytes");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public string FontFamilyName {
get {
return this.FontFamilyNameField;
}
set {
if ((object.ReferenceEquals(this.FontFamilyNameField, value) != true)) {
this.FontFamilyNameField = value;
this.RaisePropertyChanged("FontFamilyName");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public bool IsBold {
get {
return this.IsBoldField;
}
set {
if ((this.IsBoldField.Equals(value) != true)) {
this.IsBoldField = value;
this.RaisePropertyChanged("IsBold");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public bool IsItalic {
get {
return this.IsItalicField;
}
set {
if ((this.IsItalicField.Equals(value) != true)) {
this.IsItalicField = value;
this.RaisePropertyChanged("IsItalic");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public bool IsValid {
get {
return this.IsValidField;
}
set {
if ((this.IsValidField.Equals(value) != true)) {
this.IsValidField = value;
this.RaisePropertyChanged("IsValid");
}
}
}
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName) {
System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
if ((propertyChanged != null)) {
propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace="", ConfigurationName="FontServiceReference.FontService")]
public interface FontService {
[System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="urn:FontService/GetFontData", ReplyAction="urn:FontService/GetFontDataResponse")]
System.IAsyncResult BeginGetFontData(string fontFamilyName, bool isItalic, bool isBold, System.AsyncCallback callback, object asyncState);
RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontServiceFontData EndGetFontData(System.IAsyncResult result);
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public interface FontServiceChannel : RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontService, System.ServiceModel.IClientChannel {
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class GetFontDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
private object[] results;
public GetFontDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
base(exception, cancelled, userState) {
this.results = results;
}
public RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontServiceFontData Result {
get {
base.RaiseExceptionIfNecessary();
return ((RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontServiceFontData)(this.results[0]));
}
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
public partial class FontServiceClient : System.ServiceModel.ClientBase, RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontService {
private BeginOperationDelegate onBeginGetFontDataDelegate;
private EndOperationDelegate onEndGetFontDataDelegate;
private System.Threading.SendOrPostCallback onGetFontDataCompletedDelegate;
private BeginOperationDelegate onBeginOpenDelegate;
private EndOperationDelegate onEndOpenDelegate;
private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
private BeginOperationDelegate onBeginCloseDelegate;
private EndOperationDelegate onEndCloseDelegate;
private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
public FontServiceClient() {
}
public FontServiceClient(string endpointConfigurationName) :
base(endpointConfigurationName) {
}
public FontServiceClient(string endpointConfigurationName, string remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public FontServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base(endpointConfigurationName, remoteAddress) {
}
public FontServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base(binding, remoteAddress) {
}
public System.Net.CookieContainer CookieContainer {
get {
System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty();
if ((httpCookieContainerManager != null)) {
return httpCookieContainerManager.CookieContainer;
}
else {
return null;
}
}
set {
System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty();
if ((httpCookieContainerManager != null)) {
httpCookieContainerManager.CookieContainer = value;
}
else {
throw new System.InvalidOperationException("Unable to set the CookieContainer. Please make sure the binding contains an HttpC" +
"ookieContainerBindingElement.");
}
}
}
public event System.EventHandler GetFontDataCompleted;
public event System.EventHandler OpenCompleted;
public event System.EventHandler CloseCompleted;
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
System.IAsyncResult RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontService.BeginGetFontData(string fontFamilyName, bool isItalic, bool isBold, System.AsyncCallback callback, object asyncState) {
return base.Channel.BeginGetFontData(fontFamilyName, isItalic, isBold, callback, asyncState);
}
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontServiceFontData RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontService.EndGetFontData(System.IAsyncResult result) {
return base.Channel.EndGetFontData(result);
}
private System.IAsyncResult OnBeginGetFontData(object[] inValues, System.AsyncCallback callback, object asyncState) {
string fontFamilyName = ((string)(inValues[0]));
bool isItalic = ((bool)(inValues[1]));
bool isBold = ((bool)(inValues[2]));
return ((RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontService)(this)).BeginGetFontData(fontFamilyName, isItalic, isBold, callback, asyncState);
}
private object[] OnEndGetFontData(System.IAsyncResult result) {
RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontServiceFontData retVal = ((RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontService)(this)).EndGetFontData(result);
return new object[] {
retVal};
}
private void OnGetFontDataCompleted(object state) {
if ((this.GetFontDataCompleted != null)) {
InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
this.GetFontDataCompleted(this, new GetFontDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
}
}
public void GetFontDataAsync(string fontFamilyName, bool isItalic, bool isBold) {
this.GetFontDataAsync(fontFamilyName, isItalic, isBold, null);
}
public void GetFontDataAsync(string fontFamilyName, bool isItalic, bool isBold, object userState) {
if ((this.onBeginGetFontDataDelegate == null)) {
this.onBeginGetFontDataDelegate = new BeginOperationDelegate(this.OnBeginGetFontData);
}
if ((this.onEndGetFontDataDelegate == null)) {
this.onEndGetFontDataDelegate = new EndOperationDelegate(this.OnEndGetFontData);
}
if ((this.onGetFontDataCompletedDelegate == null)) {
this.onGetFontDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetFontDataCompleted);
}
base.InvokeAsync(this.onBeginGetFontDataDelegate, new object[] {
fontFamilyName,
isItalic,
isBold}, this.onEndGetFontDataDelegate, this.onGetFontDataCompletedDelegate, userState);
}
private System.IAsyncResult OnBeginOpen(object[] inValues, System.AsyncCallback callback, object asyncState) {
return ((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(callback, asyncState);
}
private object[] OnEndOpen(System.IAsyncResult result) {
((System.ServiceModel.ICommunicationObject)(this)).EndOpen(result);
return null;
}
private void OnOpenCompleted(object state) {
if ((this.OpenCompleted != null)) {
InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
this.OpenCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
}
}
public void OpenAsync() {
this.OpenAsync(null);
}
public void OpenAsync(object userState) {
if ((this.onBeginOpenDelegate == null)) {
this.onBeginOpenDelegate = new BeginOperationDelegate(this.OnBeginOpen);
}
if ((this.onEndOpenDelegate == null)) {
this.onEndOpenDelegate = new EndOperationDelegate(this.OnEndOpen);
}
if ((this.onOpenCompletedDelegate == null)) {
this.onOpenCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnOpenCompleted);
}
base.InvokeAsync(this.onBeginOpenDelegate, null, this.onEndOpenDelegate, this.onOpenCompletedDelegate, userState);
}
private System.IAsyncResult OnBeginClose(object[] inValues, System.AsyncCallback callback, object asyncState) {
return ((System.ServiceModel.ICommunicationObject)(this)).BeginClose(callback, asyncState);
}
private object[] OnEndClose(System.IAsyncResult result) {
((System.ServiceModel.ICommunicationObject)(this)).EndClose(result);
return null;
}
private void OnCloseCompleted(object state) {
if ((this.CloseCompleted != null)) {
InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
this.CloseCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
}
}
public void CloseAsync() {
this.CloseAsync(null);
}
public void CloseAsync(object userState) {
if ((this.onBeginCloseDelegate == null)) {
this.onBeginCloseDelegate = new BeginOperationDelegate(this.OnBeginClose);
}
if ((this.onEndCloseDelegate == null)) {
this.onEndCloseDelegate = new EndOperationDelegate(this.OnEndClose);
}
if ((this.onCloseCompletedDelegate == null)) {
this.onCloseCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnCloseCompleted);
}
base.InvokeAsync(this.onBeginCloseDelegate, null, this.onEndCloseDelegate, this.onCloseCompletedDelegate, userState);
}
protected override RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontService CreateChannel() {
return new FontServiceClientChannel(this);
}
private class FontServiceClientChannel : ChannelBase, RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontService {
public FontServiceClientChannel(System.ServiceModel.ClientBase client) :
base(client) {
}
public System.IAsyncResult BeginGetFontData(string fontFamilyName, bool isItalic, bool isBold, System.AsyncCallback callback, object asyncState) {
object[] _args = new object[3];
_args[0] = fontFamilyName;
_args[1] = isItalic;
_args[2] = isBold;
System.IAsyncResult _result = base.BeginInvoke("GetFontData", _args, callback, asyncState);
return _result;
}
public RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontServiceFontData EndGetFontData(System.IAsyncResult result) {
object[] _args = new object[0];
RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontServiceFontData _result = ((RadSpreadsheetPdfFontsExportDemo.FontServiceReference.FontServiceFontData)(base.EndInvoke("GetFontData", _args, result)));
return _result;
}
}
}
}
t 9
9
Hg^E0r RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\Service References\FontServiceReference\Reference.svcmap :G_
true
true
false
false
false
false
Auto
true
true
t } b'8QE0X RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo\ServiceReferences.ClientConfig <
]}t r ˘E0M RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo.Web\FontService.svc /x<%@ ServiceHost Language="C#" Debug="true" Service="RadSpreadsheetPdfFontsExportDemo.Web.FontService" CodeBehind="FontService.svc.cs" %>
t u p p 2W^E0P RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo.Web\FontService.svc.cs t^using System;
using System.IO;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.Windows;
using System.Windows.Media;
namespace RadSpreadsheetPdfFontsExportDemo.Web
{
[ServiceContract(Namespace = "")]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class FontService
{
[OperationContract]
public FontData GetFontData(string fontFamilyName, bool isItalic, bool isBold)
{
FontData data = new FontData()
{
IsValid = false,
Bytes = null,
FontFamilyName = fontFamilyName,
IsItalic = isItalic,
IsBold = isBold
};
FontFamily fontFamily = new FontFamily(fontFamilyName);
FontStyle fontStyle = isItalic ? FontStyles.Italic : FontStyles.Normal;
FontWeight fontWeight = isBold ? FontWeights.Bold : FontWeights.Normal;
Typeface typeface = new Typeface(fontFamily, fontStyle, fontWeight, FontStretches.Normal);
GlyphTypeface glyphTypeface;
if (typeface.TryGetGlyphTypeface(out glyphTypeface))
{
using(var memoryStream = new MemoryStream())
{
glyphTypeface.GetFontStream().CopyTo(memoryStream);
data.Bytes = memoryStream.ToArray();
data.IsValid = true;
}
}
return data;
}
public class FontData
{
public bool IsValid { get; set; }
public byte[] Bytes { get; set; }
public string FontFamilyName { get; set; }
public bool IsItalic { get; set; }
public bool IsBold { get; set; }
}
}
}
ft } O/E0X RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo.Web\Properties\AssemblyInfo.cs 'jusing 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("RadSpreadsheetPdfFontsExportDemo.Web")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RadSpreadsheetPdfFontsExportDemo.Web")]
[assembly: AssemblyCopyright("Copyright © 2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a095afb3-1cdd-4c2a-a5f1-3572e2144bdb")]
// 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 Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
!t -An$\E0i RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo.Web\RadSpreadsheetPdfFontsExportDemo.Web.csproj
Debug
AnyCPU
2.0
{FB5AB16E-E9E7-4C47-850D-25DF7B35B33E}
{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}
Library
Properties
RadSpreadsheetPdfFontsExportDemo.Web
RadSpreadsheetPdfFontsExportDemo.Web
v4.0
true
{4E345244-C59C-49E9-A9FD-22223270716F}|..\RadSpreadsheetPdfFontsExportDemo\RadSpreadsheetPdfFontsExportDemo.csproj|ClientBin|False
True
true
full
false
bin\
DEBUG;TRACE
prompt
4
pdbonly
true
bin\
TRACE
prompt
4
FontService.svc
Web.config
Web.config
10.0
$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
True
True
0
/
http://localhost:49533/
False
False
False
at + + h 7$\E0n RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo.Web\RadSpreadsheetPdfFontsExportDemo.Web.csproj.user m&
RadSpreadsheetPdfFontsExportDemoTestPage.aspx
SpecificPage
True
True
False
False
False
True
[RadSpreadsheetPdfFontsExportDemo.xap]
t f1E0k RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo.Web\RadSpreadsheetPdfFontsExportDemoTestPage.aspx ^<%@ Page Language="C#" AutoEventWireup="true" %>
RadSpreadsheetPdfFontsExportDemo
{t ` ` gdE0k RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo.Web\RadSpreadsheetPdfFontsExportDemoTestPage.html Z
RadSpreadsheetPdfFontsExportDemo
Y%t q UPE0L RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo.Web\Silverlight.js >n//v2.0.30511.0
if(!window.Silverlight)window.Silverlight={};Silverlight._silverlightCount=0;Silverlight.__onSilverlightInstalledCalled=false;Silverlight.fwlinkRoot="http://go2.microsoft.com/fwlink/?LinkID=";Silverlight.__installationEventFired=false;Silverlight.onGetSilverlight=null;Silverlight.onSilverlightInstalled=function(){window.location.reload(false)};Silverlight.isInstalled=function(b){if(b==undefined)b=null;var a=false,m=null;try{var i=null,j=false;if(window.ActiveXObject)try{i=new ActiveXObject("AgControl.AgControl");if(b===null)a=true;else if(i.IsVersionSupported(b))a=true;i=null}catch(l){j=true}else j=true;if(j){var k=navigator.plugins["Silverlight Plug-In"];if(k)if(b===null)a=true;else{var h=k.description;if(h==="1.0.30226.2")h="2.0.30226.2";var c=h.split(".");while(c.length>3)c.pop();while(c.length<4)c.push(0);var e=b.split(".");while(e.length>4)e.pop();var d,g,f=0;do{d=parseInt(e[f]);g=parseInt(c[f]);f++}while(f");delete a.id;delete a.width;delete a.height;for(var c in a)if(a[c])b.push('');b.push("");return b.join("")};Silverlight.createObjectEx=function(b){var a=b,c=Silverlight.createObject(a.source,a.parentElement,a.id,a.properties,a.events,a.initParams,a.context);if(a.parentElement==null)return c};Silverlight.buildPromptHTML=function(b){var a="",d=Silverlight.fwlinkRoot,c=b.version;if(b.alt)a=b.alt;else{if(!c)c="";a="";a=a.replace("{1}",c);a=a.replace("{2}",d+"108181")}return a};Silverlight.getSilverlight=function(e){if(Silverlight.onGetSilverlight)Silverlight.onGetSilverlight();var b="",a=String(e).split(".");if(a.length>1){var c=parseInt(a[0]);if(isNaN(c)||c<2)b="1.0";else b=a[0]+"."+a[1]}var d="";if(b.match(/^\d+\056\d+$/))d="&v="+b;Silverlight.followFWLink("149156"+d)};Silverlight.followFWLink=function(a){top.location=Silverlight.fwlinkRoot+String(a)};Silverlight.HtmlAttributeEncode=function(c){var a,b="";if(c==null)return null;for(var d=0;d96&&a<123||a>64&&a<91||a>43&&a<58&&a!=47||a==95)b=b+String.fromCharCode(a);else b=b+""+a+";"}return b};Silverlight.default_error_handler=function(e,b){var d,c=b.ErrorType;d=b.ErrorCode;var a="\nSilverlight error message \n";a+="ErrorCode: "+d+"\n";a+="ErrorType: "+c+" \n";a+="Message: "+b.ErrorMessage+" \n";if(c=="ParserError"){a+="XamlFile: "+b.xamlFile+" \n";a+="Line: "+b.lineNumber+" \n";a+="Position: "+b.charPosition+" \n"}else if(c=="RuntimeError"){if(b.lineNumber!=0){a+="Line: "+b.lineNumber+" \n";a+="Position: "+b.charPosition+" \n"}a+="MethodName: "+b.methodName+" \n"}alert(a)};Silverlight.__cleanup=function(){for(var a=Silverlight._silverlightCount-1;a>=0;a--)window["__slEvent"+a]=null;Silverlight._silverlightCount=0;if(window.removeEventListener)window.removeEventListener("unload",Silverlight.__cleanup,false);else window.detachEvent("onunload",Silverlight.__cleanup)};Silverlight.__getHandlerName=function(b){var a="";if(typeof b=="string")a=b;else if(typeof b=="function"){if(Silverlight._silverlightCount==0)if(window.addEventListener)window.addEventListener("onunload",Silverlight.__cleanup,false);else window.attachEvent("onunload",Silverlight.__cleanup);var c=Silverlight._silverlightCount++;a="__slEvent"+c;window[a]=b}else a=null;return a};Silverlight.onRequiredVersionAvailable=function(){};Silverlight.onRestartRequired=function(){};Silverlight.onUpgradeRequired=function(){};Silverlight.onInstallRequired=function(){};Silverlight.IsVersionAvailableOnError=function(d,a){var b=false;try{if(a.ErrorCode==8001&&!Silverlight.__installationEventFired){Silverlight.onUpgradeRequired();Silverlight.__installationEventFired=true}else if(a.ErrorCode==8002&&!Silverlight.__installationEventFired){Silverlight.onRestartRequired();Silverlight.__installationEventFired=true}else if(a.ErrorCode==5014||a.ErrorCode==2106){if(Silverlight.__verifySilverlight2UpgradeSuccess(a.getHost()))b=true}else b=true}catch(c){}return b};Silverlight.IsVersionAvailableOnLoad=function(b){var a=false;try{if(Silverlight.__verifySilverlight2UpgradeSuccess(b.getHost()))a=true}catch(c){}return a};Silverlight.__verifySilverlight2UpgradeSuccess=function(d){var c=false,b="2.0.31005",a=null;try{if(d.IsVersionSupported(b+".99")){a=Silverlight.onRequiredVersionAvailable;c=true}else if(d.IsVersionSupported(b+".0"))a=Silverlight.onRestartRequired;else a=Silverlight.onUpgradeRequired;if(a&&!Silverlight.__installationEventFired){a();Silverlight.__installationEventFired=true}}catch(e){}return c}et m , , #ÐE0H RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo.Web\Web.config m/
0t s e'鑐E0N RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo.Web\Web.Debug.config 2"
ѽt u P P cE0P RegisterFontsFromService\RadSpreadsheetPdfFontsExportDemo.Web\Web.Release.config h2
It Z .E05 RegisterFontsFromService\RegisterFontsFromService.sln +:
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RadSpreadsheetPdfFontsExportDemo", "RadSpreadsheetPdfFontsExportDemo\RadSpreadsheetPdfFontsExportDemo.csproj", "{4E345244-C59C-49E9-A9FD-22223270716F}"
ProjectSection(ProjectDependencies) = postProject
{FB5AB16E-E9E7-4C47-850D-25DF7B35B33E} = {FB5AB16E-E9E7-4C47-850D-25DF7B35B33E}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RadSpreadsheetPdfFontsExportDemo.Web", "RadSpreadsheetPdfFontsExportDemo.Web\RadSpreadsheetPdfFontsExportDemo.Web.csproj", "{FB5AB16E-E9E7-4C47-850D-25DF7B35B33E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4E345244-C59C-49E9-A9FD-22223270716F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4E345244-C59C-49E9-A9FD-22223270716F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E345244-C59C-49E9-A9FD-22223270716F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E345244-C59C-49E9-A9FD-22223270716F}.Release|Any CPU.Build.0 = Release|Any CPU
{FB5AB16E-E9E7-4C47-850D-25DF7B35B33E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FB5AB16E-E9E7-4C47-850D-25DF7B35B33E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FB5AB16E-E9E7-4C47-850D-25DF7B35B33E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FB5AB16E-E9E7-4C47-850D-25DF7B35B33E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
t ^ 0ICE09 " RegisterFontsFromService\RegisterFontsFromService.v11.suo hࡱ > " R % R o o t E n t r y pWG' <