[英]Delphi XE7 Android Indy IRC
加入頻道后,應用程序將在幾秒鍾后自行終止。 程序在真實電話LG L65(未簽名)上運行,我有一個事件IdIRC1Raw。 有什么建議嗎?
procedure THeaderFooterwithNavigation.IdIRC1Raw(ASender: TIdContext; AIn: Boolean; const AMessage: string);
begin
Memo1.Lines.Add(AMessage)
end;
當AIn
參數為真時, OnRaw
事件處理程序被調用在內部的工作線程運行的上下文TIdIRC
(由表示AContext
參數)。 當AIn
是假的, OnRaw
被稱為在任何線索要發送一個命令(和上下文AContext
為零)。
由於OnRaw
並不總是在主UI線程的上下文中運行,因此必須與主UI線程同步才能安全地更新備忘錄,例如:
procedure THeaderFooterwithNavigation.IdIRC1Raw(ASender: TIdContext; AIn: Boolean; const AMessage: string);
begin
TThread.Synchronize(nil,
procedure
begin
Memo1.Lines.Add(AMessage);
end
);
end;
但是,請記住,在XE7之前,FireMonkey中的TThread.Synchronize()
已損壞 ,盡管有一個簡單的解決方法可用(在上面的鏈接中提到):
procedure THeaderFooterwithNavigation.Timer1Timer(Sender: TObject);
begin
CheckSynchronize;
end;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.