개정판 661b7416
issue #999: Add FromString to all of controls
Change-Id: I64093e34a5f9e8d367cbed769ff4db8d7472cb7a
MarkupToPDF/Controls/Etc/SignControl.cs | ||
---|---|---|
15 | 15 |
using MarkupToPDF.Common; |
16 | 16 |
using MarkupToPDF.Serialize.Core; |
17 | 17 |
using MarkupToPDF.Serialize.S_Control; |
18 |
using System.Windows.Media.Imaging; |
|
18 | 19 |
|
19 | 20 |
//강인구 추가 |
20 | 21 |
namespace MarkupToPDF.Controls.Etc |
... | ... | |
234 | 235 |
Base_Image = GetTemplateChild(PART_Image) as Image; |
235 | 236 |
SetImage(); |
236 | 237 |
} |
237 |
public void SetImage() |
|
238 |
|
|
239 |
private void SetImage() |
|
238 | 240 |
{ |
239 | 241 |
this.ApplyTemplate(); |
240 | 242 |
|
... | ... | |
320 | 322 |
} |
321 | 323 |
} |
322 | 324 |
|
323 |
public double LineSize |
|
325 |
/// <summary> |
|
326 |
/// create a signcontrol from given string |
|
327 |
/// </summary> |
|
328 |
/// <param name="str"></param> |
|
329 |
/// <returns></returns> |
|
330 |
public static SignControl FromString(string str, SolidColorBrush brush, string sProjectNo) |
|
331 |
{ |
|
332 |
SignControl instance = null; |
|
333 |
using (S_SignControl s = JsonSerializerHelper.JsonDeserialize<S_SignControl>(str)) |
|
334 |
{ |
|
335 |
instance = new SignControl |
|
336 |
{ |
|
337 |
Angle = s.Angle, |
|
338 |
StartPoint = s.StartPoint, |
|
339 |
TopRightPoint = s.TR, |
|
340 |
EndPoint = s.EndPoint, |
|
341 |
LeftBottomPoint = s.LB, |
|
342 |
PointSet = s.PointSet, |
|
343 |
Opacity = s.Opac, |
|
344 |
SignImage = null, |
|
345 |
UserID = s.UserID, |
|
346 |
Memo = s.Memo |
|
347 |
}; |
|
348 |
|
|
349 |
if (s.UserNumber != null) |
|
350 |
{ |
|
351 |
var _sign = GetUserSign.GetSign(s.UserNumber, sProjectNo); |
|
352 |
if (_sign != null) |
|
353 |
{ |
|
354 |
byte[] imageBytes = System.Convert.FromBase64String(_sign); |
|
355 |
|
|
356 |
System.IO.MemoryStream stream = new System.IO.MemoryStream(); |
|
357 |
stream.Write(imageBytes, 0, imageBytes.Length); |
|
358 |
stream.Position = 0; |
|
359 |
System.Drawing.Image img = System.Drawing.Image.FromStream(stream); |
|
360 |
BitmapImage returnImage = new BitmapImage(); |
|
361 |
returnImage.BeginInit(); |
|
362 |
System.IO.MemoryStream ms = new System.IO.MemoryStream(); |
|
363 |
img.Save(ms, System.Drawing.Imaging.ImageFormat.Png); |
|
364 |
ms.Seek(0, System.IO.SeekOrigin.Begin); |
|
365 |
returnImage.StreamSource = ms; |
|
366 |
returnImage.EndInit(); |
|
367 |
stream.Close(); |
|
368 |
instance.SignImage = returnImage; |
|
369 |
} |
|
370 |
} |
|
371 |
} |
|
372 |
|
|
373 |
return instance; |
|
374 |
} |
|
375 |
|
|
376 |
public double LineSize |
|
324 | 377 |
{ |
325 | 378 |
get; |
326 | 379 |
set; |
내보내기 Unified diff