개정판 661b7416
issue #999: Add FromString to all of controls
Change-Id: I64093e34a5f9e8d367cbed769ff4db8d7472cb7a
MarkupToPDF/Controls/Line/LineControl.cs | ||
---|---|---|
14 | 14 |
using MarkupToPDF.Common; |
15 | 15 |
using MarkupToPDF.Serialize.S_Control; |
16 | 16 |
using MarkupToPDF.Serialize.Core; |
17 |
using System.Linq; |
|
17 | 18 |
|
18 | 19 |
namespace MarkupToPDF.Controls.Line |
19 | 20 |
{ |
... | ... | |
355 | 356 |
Base_LinePath = GetTemplateChild("PART_LinePath") as Path; |
356 | 357 |
SetLinePath(); |
357 | 358 |
} |
359 |
|
|
358 | 360 |
public void updateControl() |
359 | 361 |
{ |
360 | 362 |
this.StartPoint = new Point(this.PointSet[0].X, this.PointSet[0].Y); |
... | ... | |
402 | 404 |
this.OverViewPathData = this.PathData; |
403 | 405 |
} |
404 | 406 |
|
405 |
public void SetLinePath()
|
|
407 |
private void SetLinePath()
|
|
406 | 408 |
{ |
407 | 409 |
this.ApplyTemplate(); |
408 | 410 |
if (this.DashSize != null) |
... | ... | |
515 | 517 |
return "|DZ|" + JsonSerializerHelper.CompressString((STemp.JsonSerialize())); |
516 | 518 |
} |
517 | 519 |
} |
520 |
|
|
521 |
/// <summary> |
|
522 |
/// create a linecontrol from given string |
|
523 |
/// </summary> |
|
524 |
/// <param name="str"></param> |
|
525 |
/// <returns></returns> |
|
526 |
public static LineControl FromString(string str, SolidColorBrush brush, string sProjectNo) |
|
527 |
{ |
|
528 |
LineControl instance = null; |
|
529 |
using (S_LineControl s = JsonSerializerHelper.JsonDeserialize<S_LineControl>(str)) |
|
530 |
{ |
|
531 |
string[] data2 = s.SizeSet.Split(delimiterChars2, StringSplitOptions.RemoveEmptyEntries); |
|
532 |
instance = new LineControl() |
|
533 |
{ |
|
534 |
LineStyleSet = s.LineStyleSet, |
|
535 |
StartPoint = s.StartPoint, |
|
536 |
DimSize = s.DimSize, |
|
537 |
EndPoint = s.EndPoint, |
|
538 |
DashSize = s.DashSize, |
|
539 |
Interval = s.Interval, |
|
540 |
PointSet = s.PointSet, |
|
541 |
Opacity = s.Opac, |
|
542 |
StrokeColor = brush, |
|
543 |
UserID = s.UserID, |
|
544 |
LineSize = Convert.ToDouble(data2.First()), |
|
545 |
}; |
|
546 |
} |
|
547 |
|
|
548 |
return instance; |
|
549 |
} |
|
518 | 550 |
} |
519 | 551 |
} |
내보내기 Unified diff