Я изучил это и считаю, что нашел обходной путь.У меня была такая же проблема с программой на C # .Net, работающей в Mono, где сообщения не обрабатывались в потоке.Кажется, проблема в том, что поток не вызывается или не ожидает события.Обход, который я нашел, выглядит следующим образом.
1) Создайте событие формы (обратите внимание, что оно отличается от System.Timers)
private System.Windows.Forms.Timer timerForMonoResponsiveness;
2) Настройкасобытие формы в конструкторе или инициализации
// This is a fix for mono not updating messages until an event (such as movement of
// the mouse) happens
// We use an event timer to fire off an event on a regular basis.
// This calls a function that doesn't do anything.
if (Type.GetType("Mono.Runtime") != null) // Only run if in Mono
{
this.timerForMonoResponsiveness = new System.Windows.Forms.Timer(this.components);
this.timerForMonoResponsiveness.Interval = 100;
this.timerForMonoResponsiveness.Tick += new EventHandler(timertimerForMonoResponsiveness_Tick);
this.timerForMonoResponsiveness.Start();
}
ПРИМЕЧАНИЕ: « this.components » определено в Form.designer.cs формы (должно быть сделано автоматически) Мой выглядит следующим образом:
private System.ComponentModel.IContainer components = null;
Инициализируется как:
this.components = new System.ComponentModel.Container();
3) Создайте функцию тика для таймера
// This function executes a Tick event so the UI updates on Mono
// This is a Mono bug workaround as the message processing was not being processed
// and was waiting on invoke which on Mono only runs when a UI element is changed (or
// the mouse is moved). This function therefore runs regularly to mitigate this issue
// it is called within a Mono check and will not run on Windows
// The function is SUPPOSED TO DO NOTHING.
private void timerForMonoResponsiveness_Tick(object sender, EventArgs e)
{
this.timerMonoEventForMessagesToBeUpdated.Stop();
// This doesn't need to do anything, just call the event
this.timerMonoEventForMessagesToBeUpdated.Start();
}
Надеюсь, это поможет.