FillDigitalSignatureControl.xaml.cs 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. using ComPDFKit.DigitalSign;
  2. using ComPDFKit.Import;
  3. using ComPDFKit.PDFAnnotation;
  4. using ComPDFKit.PDFAnnotation.Form;
  5. using ComPDFKit.PDFDocument;
  6. using ComPDFKit.PDFPage;
  7. using Compdfkit_Tools.Helper;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Drawing;
  11. using System.Drawing.Imaging;
  12. using System.IO;
  13. using System.Reflection;
  14. using System.Runtime.Remoting.Messaging;
  15. using System.Text;
  16. using System.Windows;
  17. using System.Windows.Controls;
  18. using System.Windows.Controls.Primitives;
  19. using System.Windows.Ink;
  20. using System.Windows.Input;
  21. using System.Windows.Media;
  22. using System.Windows.Media.Imaging;
  23. using static System.Windows.Forms.VisualStyles.VisualStyleElement;
  24. using Color = System.Drawing.Color;
  25. using Pen = System.Windows.Media.Pen;
  26. using PixelFormat = System.Windows.Media.PixelFormat;
  27. using Point = System.Windows.Point;
  28. using Window = System.Windows.Window;
  29. namespace Compdfkit_Tools.PDFControl
  30. {
  31. /// <summary>
  32. /// Interaction logic for CPDFSignControl.xaml
  33. /// </summary>
  34. public partial class FillDigitalSignatureControl : UserControl
  35. {
  36. private readonly string logoPath = "Logo_opa40.png";
  37. private string imagePath = string.Empty;
  38. private string Text = string.Empty;
  39. private Dictionary<string, Border> TabDict { get; set; }
  40. private CPDFSignatureConfig tempSignatureConfig = new CPDFSignatureConfig();
  41. private CPDFSignatureCertificate signatureCertificate;
  42. public CPDFDocument Document;
  43. private string signatureName = string.Empty;
  44. private string location = string.Empty;
  45. private string reason = string.Empty;
  46. private float[] textColor = new float[] { 0, 0, 0 };
  47. private string _signaturePath = string.Empty;
  48. public string SignaturePath
  49. {
  50. get => _signaturePath;
  51. set
  52. {
  53. _signaturePath = value;
  54. }
  55. }
  56. private string _password = string.Empty;
  57. public string Password
  58. {
  59. get => _password;
  60. set
  61. {
  62. _password = value;
  63. signatureCertificate = CPDFPKCS12CertHelper.GetCertificateWithPKCS12Path(SignaturePath, Password);
  64. signatureName = DictionaryValueConverter.GetGrantorFromDictionary(signatureCertificate.SubjectDict);
  65. tempSignatureConfig.Text = signatureName;
  66. InitTempSignature();
  67. }
  68. }
  69. private void InitTempSignature()
  70. {
  71. NameChk.IsChecked = true;
  72. DateChk.IsChecked = true;
  73. LogoChk.IsChecked = true;
  74. TabChk.IsChecked = true;
  75. SetProperty();
  76. CreateTempSignature();
  77. KeyboardInPutTextBox.Text = signatureName;
  78. }
  79. public CPDFSignatureWidget signatureWidget { get; set; }
  80. public event EventHandler<string> AfterFillSignature;
  81. public FillDigitalSignatureControl()
  82. {
  83. InitializeComponent();
  84. TabDict = new Dictionary<string, Border>
  85. {
  86. ["Keyboard"] = KeyboardBorder,
  87. ["Trackpad"] = TrackpadBorder,
  88. ["Image"] = ImageBorder,
  89. ["None"] = NoneBorder
  90. };
  91. SetCheckedTab("Keyboard");
  92. ReasonCmb.SelectedIndex = 0;
  93. }
  94. private void CreateTempSignature()
  95. {
  96. CPDFDocument tempDocument = CPDFDocument.CreateDocument();
  97. tempDocument.InsertPage(0, 200, 200, string.Empty);
  98. CPDFPage page = tempDocument.PageAtIndex(0);
  99. CPDFSignatureWidget signatureWidget = page.CreateWidget(C_WIDGET_TYPE.WIDGET_SIGNATUREFIELDS) as CPDFSignatureWidget;
  100. signatureWidget.SetRect(new CRect(0, 100, 300, 0));
  101. tempSignatureConfig.IsDrawLogo = (bool)LogoChk.IsChecked;
  102. if (tempSignatureConfig.IsDrawLogo)
  103. {
  104. using (FileStream fileData = File.OpenRead(logoPath))
  105. {
  106. BitmapFrame frame = null;
  107. BitmapDecoder decoder = BitmapDecoder.Create(fileData, BitmapCreateOptions.None, BitmapCacheOption.Default);
  108. if (decoder != null && decoder.Frames.Count > 0)
  109. {
  110. frame = decoder.Frames[0];
  111. }
  112. if (frame != null)
  113. {
  114. byte[] imageArray = new byte[frame.PixelWidth * frame.PixelHeight * 4];
  115. int ImageWidth = frame.PixelWidth;
  116. int ImageHeight = frame.PixelHeight;
  117. frame.CopyPixels(imageArray, frame.PixelWidth * 4, 0);
  118. if(signatureWidget.IsValid())
  119. {
  120. tempSignatureConfig.LogoData = imageArray;
  121. tempSignatureConfig.LogoWidth = ImageWidth;
  122. tempSignatureConfig.LogoHeight = ImageHeight;
  123. //signatureWidget.UpdateApWithImage(ImageArray, ImageWidth, ImageHeight, C_Scale_Type.fitCenter, 0);
  124. }
  125. }
  126. }
  127. //tempSignatureConfig.LogoData = CommonHelper.ConvertBitmapToByteArray(new Bitmap(logoPath));
  128. }
  129. tempSignatureConfig.Content = Text;
  130. tempSignatureConfig.TextColor = textColor;
  131. tempSignatureConfig.ContentColor = new float[] { 0, 0, 0 };
  132. signatureWidget.UpdataApWithSignature(tempSignatureConfig);
  133. byte[] signatureBitmapBytes = GetTempSignatureImage(signatureWidget, out int width, out int height);
  134. signatureWidget.ReleaseAnnot();
  135. if (signatureBitmapBytes.Length > 0)
  136. {
  137. PixelFormat fmt = PixelFormats.Bgra32;
  138. BitmapSource bps = BitmapSource.Create(width, height, 96, 96, fmt, null, signatureBitmapBytes, (width * fmt.BitsPerPixel + 7) / 8);
  139. imageControl.Source = bps;
  140. }
  141. else
  142. {
  143. imageControl.Source = null;
  144. }
  145. }
  146. public static byte[] GetTempSignatureImage(CPDFSignatureWidget signatureWidget, out int width, out int height)
  147. {
  148. CRect rect = signatureWidget.GetRect();
  149. var flags = BindingFlags.NonPublic | BindingFlags.Static;
  150. var dpiProperty = typeof(SystemParameters).GetProperty("Dpi", flags);
  151. int dpi = (int)dpiProperty.GetValue(null, null);
  152. width = (int)(rect.width() * dpi / 72D * 2);
  153. height = (int)(rect.height() * dpi / 72D * 2);
  154. byte[] imageData = new byte[width * height * 4];
  155. signatureWidget.RenderAnnot(width, height, imageData, CPDFAppearanceType.Normal);
  156. return imageData;
  157. }
  158. private void TextAlignBtn_Click(object sender, RoutedEventArgs e)
  159. {
  160. ToggleButton checkBtn = sender as ToggleButton;
  161. if (checkBtn == null)
  162. {
  163. return;
  164. }
  165. checkBtn.IsChecked = true;
  166. if (checkBtn != TextAlignLeftBtn)
  167. {
  168. tempSignatureConfig.IsContentAlignLeft = true;
  169. TextAlignLeftBtn.IsChecked = false;
  170. }
  171. if (checkBtn != TextAlignRightBtn)
  172. {
  173. tempSignatureConfig.IsContentAlignLeft = false;
  174. TextAlignRightBtn.IsChecked = false;
  175. }
  176. CreateTempSignature();
  177. }
  178. private void Border_MouseDown(object sender, MouseButtonEventArgs e)
  179. {
  180. Border clickBorder = sender as Border;
  181. if (clickBorder == null || clickBorder.Tag == null)
  182. {
  183. return;
  184. }
  185. SetCheckedTab(clickBorder.Tag.ToString());
  186. ImagePickPanel.Visibility = Visibility.Hidden;
  187. if (clickBorder == NoneBorder)
  188. {
  189. tempSignatureConfig.IsDrawOnlyContent = true;
  190. }
  191. else
  192. {
  193. tempSignatureConfig.IsDrawOnlyContent = false;
  194. if (clickBorder == KeyboardBorder)
  195. {
  196. tempSignatureConfig.Text = signatureName;
  197. //tempSignatureConfig.ImageBitmap = null;
  198. KeyboardPopup.Visibility = Visibility.Visible;
  199. }
  200. else
  201. {
  202. tempSignatureConfig.Text = string.Empty;
  203. if (clickBorder == TrackpadBorder)
  204. {
  205. CanvaDrawPopup.Visibility = Visibility.Visible;
  206. }
  207. else if (clickBorder == ImageBorder)
  208. {
  209. ImagePickPanel.Visibility = Visibility.Visible;
  210. if (!string.IsNullOrEmpty(imagePath))
  211. {
  212. //tempSignatureConfig.ImageBitmap = new Bitmap(imagePath);
  213. }
  214. }
  215. }
  216. }
  217. SetProperty();
  218. CreateTempSignature();
  219. }
  220. private void SetCheckedTab(string tab)
  221. {
  222. if (TabDict != null && TabDict.ContainsKey(tab))
  223. {
  224. foreach (string key in TabDict.Keys)
  225. {
  226. Border checkBorder = TabDict[key];
  227. if (checkBorder == null)
  228. {
  229. continue;
  230. }
  231. checkBorder.BorderThickness = new Thickness(0);
  232. if (key == tab)
  233. {
  234. checkBorder.BorderThickness = new Thickness(0, 0, 0, 2);
  235. }
  236. }
  237. }
  238. }
  239. private void CanvasPopupClose_Click(object sender, RoutedEventArgs e)
  240. {
  241. CanvaDrawPopup.Visibility = Visibility.Collapsed;
  242. }
  243. private void CanvasClearBtn_Click(object sender, RoutedEventArgs e)
  244. {
  245. DrawInkCanvas.Strokes.Clear();
  246. }
  247. private void CanvasPopupConfirm_Click(object sender, RoutedEventArgs e)
  248. {
  249. //tempSignatureConfig.ImageBitmap = GetDrawInk();
  250. CanvaDrawPopup.Visibility = Visibility.Collapsed;
  251. SetProperty();
  252. CreateTempSignature();
  253. }
  254. public Bitmap GetDrawInk()
  255. {
  256. if (DrawInkCanvas != null && DrawInkCanvas.Strokes != null && DrawInkCanvas.Strokes.Count > 0)
  257. {
  258. Rect bound = DrawInkCanvas.Strokes.GetBounds();
  259. DrawingVisual drawVisual = new DrawingVisual();
  260. DrawingContext drawContext = drawVisual.RenderOpen();
  261. foreach (Stroke drawStroke in DrawInkCanvas.Strokes)
  262. {
  263. Pen drawPen = new Pen(new SolidColorBrush(drawStroke.DrawingAttributes.Color), drawStroke.DrawingAttributes.Width);
  264. PathGeometry drawPath = new PathGeometry();
  265. PathFigureCollection Figures = new PathFigureCollection();
  266. PathFigure AddFigure = new PathFigure();
  267. Figures.Add(AddFigure);
  268. drawPath.Figures = Figures;
  269. if (drawStroke.StylusPoints.Count > 1)
  270. {
  271. StylusPoint startPoint = drawStroke.StylusPoints[0];
  272. AddFigure.StartPoint = new Point(startPoint.X - bound.X, startPoint.Y - bound.Y);
  273. for (int i = 1; i < drawStroke.StylusPoints.Count; i++)
  274. {
  275. StylusPoint drawPoint = drawStroke.StylusPoints[i];
  276. Point offsetPoint = new Point(drawPoint.X - bound.X, drawPoint.Y - bound.Y);
  277. LineSegment drawSegment = new LineSegment();
  278. drawSegment.Point = offsetPoint;
  279. AddFigure.Segments.Add(drawSegment);
  280. }
  281. }
  282. if (AddFigure.Segments.Count > 0)
  283. {
  284. drawContext.DrawGeometry(null, drawPen, drawPath);
  285. }
  286. }
  287. drawContext.Close();
  288. RenderTargetBitmap renderBitmap = new RenderTargetBitmap((int)bound.Width, (int)bound.Height, 96, 96, PixelFormats.Pbgra32);
  289. renderBitmap.Render(drawVisual);
  290. BitmapFrame newFrame = BitmapFrame.Create(renderBitmap);
  291. PngBitmapEncoder pngEncoder = new PngBitmapEncoder();
  292. pngEncoder.Frames.Add(newFrame);
  293. using (MemoryStream newStream = new MemoryStream())
  294. {
  295. pngEncoder.Save(newStream);
  296. return new Bitmap(newStream);
  297. }
  298. }
  299. else
  300. {
  301. return null;
  302. }
  303. }
  304. private void SetProperty()
  305. {
  306. Text = string.Empty;
  307. if ((bool)NameChk.IsChecked)
  308. {
  309. if ((bool)TabChk.IsChecked)
  310. {
  311. Text += "Name: ";
  312. }
  313. Text += DictionaryValueConverter.GetGrantorFromDictionary(signatureCertificate.SubjectDict) + "\n";
  314. }
  315. if ((bool)DateChk.IsChecked)
  316. {
  317. if ((bool)TabChk.IsChecked)
  318. {
  319. Text += "Date: ";
  320. }
  321. DateTime currentDateTime = DateTime.Now;
  322. string customFormat = "yyyy.MM.dd HH:mm:ss";
  323. string formattedDateTime = currentDateTime.ToString(customFormat);
  324. Text += formattedDateTime + "\n";
  325. }
  326. if ((bool)LogoChk.IsChecked)
  327. {
  328. tempSignatureConfig.IsDrawLogo = true;
  329. }
  330. else
  331. {
  332. tempSignatureConfig.IsDrawLogo = false;
  333. }
  334. if ((bool)ReasonChk.IsChecked)
  335. {
  336. if ((bool)TabChk.IsChecked)
  337. {
  338. Text += "Reason: ";
  339. }
  340. Text += (ReasonCmb.SelectedItem as ComboBoxItem).Content.ToString() + "\n";
  341. }
  342. if ((bool)DistinguishableNameChk.IsChecked)
  343. {
  344. if ((bool)TabChk.IsChecked)
  345. {
  346. Text += "DN: ";
  347. }
  348. var keyOrder = new List<string> { "CN", "O", "OU", "emailAddress", "L", "ST", "C" };
  349. var keyMapping = new Dictionary<string, string>
  350. {
  351. { "CN", "cn" },
  352. { "OU", "ou" },
  353. { "O", "o" },
  354. { "L", "l" },
  355. { "ST", "st" },
  356. { "C", "c" },
  357. { "emailAddress", "email" }
  358. };
  359. var stringBuilder = new StringBuilder();
  360. foreach (var originalKey in keyOrder)
  361. {
  362. if (keyMapping.TryGetValue(originalKey, out string newKey) &&
  363. signatureCertificate.SubjectDict.TryGetValue(originalKey, out string value) && !string.IsNullOrEmpty(value))
  364. {
  365. if (stringBuilder.Length > 0)
  366. {
  367. stringBuilder.Append(",");
  368. }
  369. stringBuilder.Append(newKey + "=" + value);
  370. }
  371. }
  372. Text += stringBuilder.ToString()+"\n";
  373. }
  374. if ((bool)ComPDFKitVersionChk.IsChecked)
  375. {
  376. Assembly assembly = Assembly.GetExecutingAssembly();
  377. Version version = assembly.GetName().Version;
  378. if ((bool)TabChk.IsChecked)
  379. {
  380. Text += "ComPDFKit Version: ";
  381. }
  382. Text += version.Major.ToString() + "." + version.Minor.ToString() + "." + version.Build.ToString() + "." + version.Revision.ToString() + "\n";
  383. }
  384. if ((bool)PositionChk.IsChecked)
  385. {
  386. if ((bool)TabChk.IsChecked)
  387. {
  388. Text += "Position: ";
  389. }
  390. Text += PositionTbx.Text + "\n";
  391. }
  392. }
  393. private void ReasonCheckBox_Click(object sender, RoutedEventArgs e)
  394. {
  395. CheckBox checkItem = sender as CheckBox;
  396. if (checkItem == null)
  397. {
  398. return;
  399. }
  400. ReasonPanel.Visibility = checkItem.IsChecked == true ? Visibility.Visible : Visibility.Collapsed;
  401. }
  402. private void BrowseTxt_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  403. {
  404. string filter = "Image files (*.jpg, *.jpeg, *.png, *.bmp)|*.jpg;*.jpeg;*.png;*.bmp";
  405. string pngPath = CommonHelper.GetExistedPathOrEmpty(filter);
  406. if (!string.IsNullOrEmpty(pngPath))
  407. {
  408. imagePath = pngPath;
  409. try
  410. {
  411. //tempSignatureConfig.ImageBitmap = new Bitmap(imagePath);
  412. }
  413. catch (Exception exception)
  414. {
  415. MessageBox.Show("The image is invalid.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
  416. return;
  417. }
  418. SetProperty();
  419. CreateTempSignature();
  420. }
  421. }
  422. private void ClearTxt_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
  423. {
  424. imagePath = string.Empty;
  425. //tempSignatureConfig.ImageBitmap = null;
  426. SetProperty();
  427. CreateTempSignature();
  428. }
  429. private void NameChk_Click(object sender, RoutedEventArgs e)
  430. {
  431. SetProperty();
  432. CreateTempSignature();
  433. }
  434. private void DateChk_Click(object sender, RoutedEventArgs e)
  435. {
  436. SetProperty();
  437. CreateTempSignature();
  438. }
  439. private void LogoChk_Click(object sender, RoutedEventArgs e)
  440. {
  441. SetProperty();
  442. CreateTempSignature();
  443. }
  444. private void ReasonChk_Click(object sender, RoutedEventArgs e)
  445. {
  446. if (!(bool)ReasonChk.IsChecked)
  447. {
  448. Reasonstp.Visibility = Visibility.Collapsed;
  449. }
  450. else
  451. {
  452. Reasonstp.Visibility = Visibility.Visible;
  453. }
  454. SetProperty();
  455. CreateTempSignature();
  456. }
  457. private void DistinguishableNameChk_Click(object sender, RoutedEventArgs e)
  458. {
  459. SetProperty();
  460. CreateTempSignature();
  461. }
  462. private void PositionChk_Click(object sender, RoutedEventArgs e)
  463. {
  464. if (!(bool)PositionChk.IsChecked)
  465. {
  466. PositionStp.Visibility = Visibility.Collapsed;
  467. }
  468. else
  469. {
  470. PositionStp.Visibility = Visibility.Visible;
  471. }
  472. SetProperty();
  473. CreateTempSignature();
  474. }
  475. private void TabChk_Click(object sender, RoutedEventArgs e)
  476. {
  477. SetProperty();
  478. CreateTempSignature();
  479. }
  480. private void ReasonCmb_SelectionChanged(object sender, SelectionChangedEventArgs e)
  481. {
  482. SetProperty();
  483. CreateTempSignature();
  484. }
  485. private void ComPDFKitVersionChk_Click(object sender, RoutedEventArgs e)
  486. {
  487. SetProperty();
  488. CreateTempSignature();
  489. }
  490. private void PositionTbx_TextChanged(object sender, TextChangedEventArgs e)
  491. {
  492. if (!(bool)PositionChk.IsChecked)
  493. {
  494. PositionStp.Visibility = Visibility.Collapsed;
  495. }
  496. else
  497. {
  498. PositionStp.Visibility = Visibility.Visible;
  499. }
  500. SetProperty();
  501. CreateTempSignature();
  502. }
  503. private void ContinueBtn_Click(object sender, RoutedEventArgs e)
  504. {
  505. string filePath = CommonHelper.GetGeneratePathOrEmpty("PDF files (*.pdf)|*.pdf", Document.FileName + "_Signed.pdf");
  506. if (string.IsNullOrEmpty(filePath))
  507. {
  508. return;
  509. }
  510. if (filePath.ToLower() == Document.FilePath.ToLower())
  511. {
  512. MessageBox.Show("Do not use the new file name that is the same as the current file name.");
  513. return;
  514. }
  515. if ((bool)ReasonChk.IsChecked)
  516. {
  517. reason = (ReasonCmb?.SelectedItem as ComboBoxItem)?.Content?.ToString();
  518. }
  519. else
  520. {
  521. reason = string.Empty;
  522. }
  523. if ((bool)PositionChk.IsChecked)
  524. {
  525. location = PositionTbx.Text;
  526. }
  527. else
  528. {
  529. location = string.Empty;
  530. }
  531. signatureWidget.UpdataApWithSignature(tempSignatureConfig);
  532. if (Document.WriteSignatureToFilePath(signatureWidget, filePath, SignaturePath, Password, location, reason, CPDFSignaturePermissions.CPDFSignaturePermissionsNone))
  533. {
  534. signatureCertificate.AddToTrustedCertificates();
  535. AfterFillSignature?.Invoke(sender, filePath);
  536. }
  537. CloseWindow(sender);
  538. }
  539. private void CancelBtn_Click(object sender, RoutedEventArgs e)
  540. {
  541. CloseWindow(sender);
  542. }
  543. private void CloseWindow(object sender)
  544. {
  545. Window parentWindow = Window.GetWindow(sender as DependencyObject);
  546. parentWindow?.Close();
  547. }
  548. private void TextColorPickerControl_Loaded(object sender, RoutedEventArgs e)
  549. {
  550. TextColorPickerControl.SetIsChecked(0);
  551. TextColorPickerControl.Brush = new SolidColorBrush(Colors.Black);
  552. }
  553. private void TextColorPickerControl_ColorChanged(object sender, EventArgs e)
  554. {
  555. KeyboardInPutTextBox.Foreground = TextColorPickerControl.Brush;
  556. }
  557. private void KeyboardCancel_Click(object sender, RoutedEventArgs e)
  558. {
  559. KeyboardPopup.Visibility = Visibility.Collapsed;
  560. }
  561. private void KeyboardClear_Click(object sender, RoutedEventArgs e)
  562. {
  563. KeyboardInPutTextBox.Text = string.Empty;
  564. }
  565. private void KeyboardSave_Click(object sender, RoutedEventArgs e)
  566. {
  567. signatureName = KeyboardInPutTextBox.Text;
  568. tempSignatureConfig.Text = signatureName;
  569. SolidColorBrush solidColorBrush = TextColorPickerControl.Brush as SolidColorBrush;
  570. float red = solidColorBrush.Color.R;
  571. float green = solidColorBrush.Color.G;
  572. float blue = solidColorBrush.Color.B;
  573. textColor = new[] { red / 255, green / 255, blue / 255 };
  574. KeyboardPopup.Visibility = Visibility.Collapsed;
  575. SetProperty();
  576. CreateTempSignature();
  577. }
  578. private void KeyboardPopupClose_Click(object sender, RoutedEventArgs e)
  579. {
  580. KeyboardPopup.Visibility = Visibility.Collapsed;
  581. }
  582. }
  583. }