簡體   English   中英

如何從另一個線程UWP訪問列表框

[英]How to access Listbox from another Thread UWP

我想從另一個線程登錄到uwp中的列表框。

我從Windows窗體知道我應該使用委托。 但是它們不是調用方法。 這是我用於記錄的界面。 那是我嘗試使用的第一件事。

public interface ILoggingService
{
    void LogInformation(LogEntryType logEntryType,string logEntryMessage);
}



delegate void LoggerDelegate(LogEntryType logEntryType,string message);
LoggerDelegate _loggerDelegate = new LoggerDelegate(LogInformation);

public void LogInformation(LogEntryType logEntryType,string logEntryMessage)
    {
        if (lbxInformation.InvokeRequired)
        {
           lbxRequestInformation.Invoke(logRequestInformationDelegate,message);
        }
        else
        {
            lbxInformation.Items.Add(message);
        }
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM