Mercurial > silverbladetech
annotate SilverlightExampleApp/SilverlightExampleApp.Web/Services/Helpers.asmx.cs @ 57:558c09d76726
Web host added
author | Steven Hollidge <stevenhollidge@hotmail.com> |
---|---|
date | Thu, 19 Apr 2012 14:39:59 +0100 |
parents | 502f5f365649 |
children |
rev | line source |
---|---|
49
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
1 using System; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
2 using System.Globalization; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
3 using System.Web.Services; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
4 using System.Windows; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
5 using System.Windows.Media; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
6 |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
7 namespace SilverlightExampleApp.Web.Services |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
8 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
9 [WebService(Namespace = "http://silverbladetechnology.com/")] |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
10 [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
11 [System.ComponentModel.ToolboxItem(false)] |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
12 public class Helpers : WebService |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
13 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
14 [WebMethod] |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
15 public string Text2Path(String strText, string strCulture, bool LtoR, string strTypeFace, int nSize) |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
16 { |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
17 if (strCulture == "") |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
18 strCulture = "en-us"; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
19 |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
20 CultureInfo ci = new CultureInfo(strCulture); |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
21 FlowDirection fd = LtoR ? FlowDirection.LeftToRight : FlowDirection.RightToLeft; |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
22 FontFamily ff = new FontFamily(strTypeFace); |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
23 Typeface tf = new Typeface(ff, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal); |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
24 FormattedText t = new FormattedText(strText, ci, fd, tf, nSize, Brushes.Black); |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
25 Geometry g = t.BuildGeometry(new Point(0, 0)); |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
26 PathGeometry p = g.GetFlattenedPathGeometry(); |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
27 |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
28 return p.ToString(); |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
29 } |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
30 } |
502f5f365649
Initial load for Silverlight Example Application
Steven Hollidge <stevenhollidge@hotmail.com>
parents:
diff
changeset
|
31 } |