解決的方法是在要匯入的地方加入Application.Current.Dispatcher.BeginInvoke((Action)delegate () {};這行,就可以解決問題了
private void ServerBrowserItemsUI(ListserverList) { Application.Current.Dispatcher.BeginInvoke((Action)delegate () { serverList.ToList().ForEach(args => { OPCServerSource.Add(new Model.OPCServer() { ProgName = args.progID, ProgID = args.clsid.ToString(), Url = new System.Windows.Media.Imaging.BitmapImage(new Uri(@"/OPCDASettingWPFLib;component/Common/Images/lightIcon_green_20.png", UriKind.RelativeOrAbsolute)) }); }); }); }
沒有留言:
張貼留言