Refactor quick action output handling and extend case note support
This commit is contained in:
@@ -1,18 +1,11 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using static C4IT.Logging.cLogManager;
|
||||
using static System.Net.Mime.MediaTypeNames;
|
||||
|
||||
namespace FasdDesktopUi.Basics.Helper
|
||||
{
|
||||
@@ -20,7 +13,7 @@ namespace FasdDesktopUi.Basics.Helper
|
||||
{
|
||||
#region Unicode
|
||||
|
||||
public static void TraverseBlockAsUnicode(BlockCollection blocks, StringBuilder stringBuilder, bool isBlockFromList = false)
|
||||
public static void TraverseBlockAsUnicode(BlockCollection blocks, StringBuilder stringBuilder)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -54,15 +47,11 @@ namespace FasdDesktopUi.Basics.Helper
|
||||
|
||||
private static void TraverseParagraphAsUnicode(Paragraph paragraph, StringBuilder stringBuilder)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
foreach (var inline in paragraph.Inlines)
|
||||
foreach (Run run in paragraph.Inlines.OfType<Run>())
|
||||
{
|
||||
if (inline is Run run)
|
||||
{
|
||||
stringBuilder.Append(run.Text);
|
||||
}
|
||||
stringBuilder.Append(run.Text);
|
||||
}
|
||||
}
|
||||
catch (Exception E)
|
||||
@@ -73,32 +62,24 @@ namespace FasdDesktopUi.Basics.Helper
|
||||
|
||||
private static void TraverseListAsUnicode(List list, StringBuilder stringBuilder)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
if (list.MarkerStyle == TextMarkerStyle.Decimal)
|
||||
{
|
||||
|
||||
for (int i = 0; i < list.ListItems.Count; i++)
|
||||
{
|
||||
|
||||
stringBuilder.Append(i + 1 + ". ");
|
||||
TraverseBlockAsUnicode(list.ListItems.ElementAt(i).Blocks, stringBuilder, true);
|
||||
|
||||
TraverseBlockAsUnicode(list.ListItems.ElementAt(i).Blocks, stringBuilder);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var item in list.ListItems)
|
||||
{
|
||||
|
||||
stringBuilder.Append("- ");
|
||||
TraverseBlockAsUnicode(item.Blocks, stringBuilder, true);
|
||||
|
||||
TraverseBlockAsUnicode(item.Blocks, stringBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
@@ -108,18 +89,14 @@ namespace FasdDesktopUi.Basics.Helper
|
||||
|
||||
private static void TraverseImageAsUnicode(System.Windows.Controls.Image image, StringBuilder stringBuilder)
|
||||
{
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
stringBuilder.Append("[Image]");
|
||||
stringBuilder.Append($"[Image:\"{image.Name}\"]");
|
||||
}
|
||||
catch (Exception E)
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -151,12 +128,7 @@ namespace FasdDesktopUi.Basics.Helper
|
||||
else if (block is BlockUIContainer container)
|
||||
{
|
||||
if (container.Child is System.Windows.Controls.Image image)
|
||||
{
|
||||
|
||||
TraverseImageAsHtml(image, stringBuilder);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -223,7 +195,6 @@ namespace FasdDesktopUi.Basics.Helper
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
byte[] arr;
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
@@ -242,7 +213,6 @@ namespace FasdDesktopUi.Basics.Helper
|
||||
{
|
||||
LogException(E);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void TraverseRunAsHtml(Run run, StringBuilder stringBuilder)
|
||||
|
||||
Reference in New Issue
Block a user