Skip to content

Commit dbbb3c1

Browse files
committed
More work on the queue
1 parent ada497a commit dbbb3c1

File tree

2 files changed

+38
-8
lines changed

2 files changed

+38
-8
lines changed

SmartImage 3/Mode/Shell/ShellMode.Handlers.cs

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Collections;
55
using System.Collections.Concurrent;
66
using System.Diagnostics;
7+
using System.Reflection;
78
using Kantan.Net.Utilities;
89
using Kantan.Text;
910
using Microsoft.Extensions.Logging;
@@ -185,24 +186,53 @@ private void Queue_Dialog()
185186
lv.SetFocus();
186187
};
187188

189+
tf.TextChanged += delegate(ustring ustring)
190+
{
191+
Debug.WriteLine($"{ustring}");
192+
};
193+
188194
tf.TextChanging += a =>
189195
{
190196

191-
var s = a.NewText.ToString().CleanString();
197+
var s = a.NewText.ToString().CleanString().Trim('\"');
192198

199+
// Application.MainLoop.Invoke(() => Task.Delay(TimeSpan.FromSeconds(1)));
193200
if (SearchQuery.IsValidSourceType(s)) {
194201
Queue.Enqueue(s);
195202
lv.Source = new ListWrapper(Queue.ToList());
196-
tf.DeleteAll();
197-
tf.Text = ustring.Empty;
198-
a.Cancel = true;
203+
/*tf.DeleteAll();
204+
tf.Text = ustring.Empty;
205+
a.Cancel = false;
199206
a.NewText = ustring.Empty;
207+
tf.DeleteAll();*/
200208
tf.DeleteAll();
201-
tf.SetFocus();
202-
tf.SetNeedsDisplay();
209+
Debug.WriteLine($"{tf.Text} {s}");
210+
// tf.Text = ustring.Empty;
211+
// a.NewText = ustring.Empty;
212+
// tf.SetFocus();
213+
// tf.SetNeedsDisplay();
214+
Application.MainLoop.Invoke(() => Action(tf));
215+
tf.Text = ustring.Empty;
216+
217+
Debug.WriteLine($"{tf.Text} {a.NewText}");
203218
}
204219
};
205220

221+
static void Action(TextField tf)
222+
{
223+
Debug.WriteLine($"clearing");
224+
// Task.Delay(TimeSpan.FromSeconds(3));
225+
// tf.Text = ustring.Empty;
226+
// tf.CursorPosition = 0;
227+
tf.DeleteAll();
228+
tf.ClearHistoryChanges();
229+
tf.ClearAllSelection();
230+
tf.SetNeedsDisplay();
231+
Debug.WriteLine($"cleared");
232+
}
233+
234+
void Reload() { }
235+
206236
d.Add(tf, lv);
207237
d.AddButton(btnRm);
208238
d.AddButton(btnRmAll);
@@ -247,7 +277,7 @@ private void Browse_Clicked()
247277
Queue.Enqueue(fs);
248278
}
249279

250-
NextQueue();
280+
// NextQueue();
251281
}
252282

253283
else {

SmartImage 3/Mode/Shell/ShellMode.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ public bool UseClipboard
287287
}
288288
else {
289289
m_cbCallbackTok = Application.MainLoop.RemoveTimeout(m_cbCallbackTok);
290-
m_clipboard.Clear();
290+
m_clipboard?.Clear();
291291
}
292292

293293
}

0 commit comments

Comments
 (0)