???????????????APM??
???????????? ???????[ 2013/4/3 9:49:50 ] ????????
????????????н???????????????
AsyncInvokeDel calculateAction = cal.Calculate;
string resultStrAction = string.Empty;
// int result1 = calculateAction.Invoke(123?? 456?? ref resultStrAction);
IAsyncResult calculateResult1 = calculateAction.BeginInvoke(123?? 456?? ref resultStrAction?? null?? null);
int result1 = calculateAction.EndInvoke(ref resultStrAction?? calculateResult1);
???????????????????
???????? Windows ????????????????????????????????????????????????????????????????????????????μ??????????????????????????? bug????????????????????????????????????????????????
??????????????Щ????£???????????????????????????.NET Framework ??????κ????????????????
????1???????????????????????????????????
????????????????е?????????????????????н?Form??CheckForIllegalCrossThreadCalls????????????false??
// ?????????????????????????????????????
// ??Щ???????????ó????????????System.Windows.Forms.Control.Handle?????
// ???????????????????????? true??????? false??
public static bool CheckForIllegalCrossThreadCalls { get; set; }
????2??????????????
?????????????????????ò???????罫?????????????????????ò??????????????????????У????????????????????????????????????????????д??????????????????е?????????????????????д?????????
????????????????????ò???????罫??????????????????????????????????????????????????????????
????1?????BackgroundWork?????????????????AsyncOperationManager???AsyncOperation??????????????
????2?????TaskScheduler.FromCurrentSynchronizationContext() ??Task ????
????3?????Control????????Invoke ??BeginInvoke??????
??????????????IAsyncResult?????????????????????Invoke ??BeginInvoke???????????????
????Control???????ISynchronizeInvoke????????Invoke??BeginInvoke???????????????????GUI????????????
public interface ISynchronizeInvoke
{
// ?????????????????????????????????????????
bool InvokeRequired { get; }
// ?????????????????????????С?
AsyncResult BeginInvoke(Delegate method?? params object[] args);
object EndInvoke(IAsyncResult asyncResult);
// ??????????????????????????С?
object Invoke(Delegate method?? params object[] args);
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11