|
@@ -7,6 +7,7 @@ using System.Windows.Media;
|
|
using InABox.Clients;
|
|
using InABox.Clients;
|
|
using InABox.Core;
|
|
using InABox.Core;
|
|
using InABox.WPF;
|
|
using InABox.WPF;
|
|
|
|
+using java.util;
|
|
|
|
|
|
namespace InABox.DynamicGrid
|
|
namespace InABox.DynamicGrid
|
|
{
|
|
{
|
|
@@ -74,6 +75,8 @@ namespace InABox.DynamicGrid
|
|
private TextBox History;
|
|
private TextBox History;
|
|
private TextBoxDecorator Scroll;
|
|
private TextBoxDecorator Scroll;
|
|
|
|
|
|
|
|
+ private string[]? _value = [];
|
|
|
|
+
|
|
public override int DesiredHeight()
|
|
public override int DesiredHeight()
|
|
{
|
|
{
|
|
return int.MaxValue;
|
|
return int.MaxValue;
|
|
@@ -189,13 +192,13 @@ namespace InABox.DynamicGrid
|
|
{
|
|
{
|
|
if (string.IsNullOrEmpty(History.Text))
|
|
if (string.IsNullOrEmpty(History.Text))
|
|
{
|
|
{
|
|
- History.AppendText(popup.Text);
|
|
|
|
|
|
+ _value = [popup.Text];
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
- var note = string.Format("{0:yyyy-MM-dd HH:mm:ss} {1}: {2}", DateTime.Now, ClientFactory.UserID, popup.Text);
|
|
|
|
- History.AppendText("\n===================================\n" + note);
|
|
|
|
|
|
+ _value = (_value ?? []).Concatenate([string.Format("{0:yyyy-MM-dd HH:mm:ss} {1}: {2}", DateTime.Now, ClientFactory.UserID, popup.Text)]);
|
|
}
|
|
}
|
|
|
|
+ History.Text = NotesEditor.FormatNotes(_value);
|
|
|
|
|
|
History.ScrollToEnd();
|
|
History.ScrollToEnd();
|
|
CheckChanged();
|
|
CheckChanged();
|
|
@@ -204,18 +207,22 @@ namespace InABox.DynamicGrid
|
|
|
|
|
|
protected override string[] RetrieveValue()
|
|
protected override string[] RetrieveValue()
|
|
{
|
|
{
|
|
- var results = new List<string>();
|
|
|
|
- if (!string.IsNullOrWhiteSpace(History.Text))
|
|
|
|
- results.AddRange(History.Text.Split('\n'));
|
|
|
|
- return results.ToArray();
|
|
|
|
|
|
+ return _value;
|
|
}
|
|
}
|
|
|
|
|
|
protected override void UpdateValue(string[] value)
|
|
protected override void UpdateValue(string[] value)
|
|
{
|
|
{
|
|
- if (value != null)
|
|
|
|
- History.Text = string.Join("\n", value);
|
|
|
|
|
|
+ if(value is not null)
|
|
|
|
+ {
|
|
|
|
+ _value = value;
|
|
|
|
+ History.Text = NotesEditor.FormatNotes(_value);
|
|
|
|
+ }
|
|
else
|
|
else
|
|
|
|
+ {
|
|
|
|
+ _value = null;
|
|
History.Text = "";
|
|
History.Text = "";
|
|
|
|
+ }
|
|
|
|
+
|
|
var AlwaysEnabled = EditorDefinition is NotesEditor && ((NotesEditor)EditorDefinition).AlwaysEnabled;
|
|
var AlwaysEnabled = EditorDefinition is NotesEditor && ((NotesEditor)EditorDefinition).AlwaysEnabled;
|
|
History.IsReadOnly = !AlwaysEnabled && !string.IsNullOrWhiteSpace(History.Text);
|
|
History.IsReadOnly = !AlwaysEnabled && !string.IsNullOrWhiteSpace(History.Text);
|
|
History.Background = History.IsReadOnly ? new SolidColorBrush(Colors.Gainsboro) : new SolidColorBrush(BGColor);
|
|
History.Background = History.IsReadOnly ? new SolidColorBrush(Colors.Gainsboro) : new SolidColorBrush(BGColor);
|